Docsity

Processor Design: Importance of Verification and Validation, Study notes of Computer Science

Partial preview of the text

Download Processor Design: Importance of Verification and Validation and more Study notes Computer Science in PDF only on Docsity!

  • CS3220: Processor DesignCS3220: Processor Design November 20,

Verification and Validation^ • What’s^ the^ difference?L^ l

We’re^ going^ to^ focus^ on^ Verification,^ but^ the^ two^ are^ obviously^ related

  • Loosely:– Verification:^ Are^ you^ building

but^ the^ two are^ obviously^ related it correctly?

  • Verification:^ Are^ you^ building

it^ correctly?

  • This^ is^ what^ engineers,^ programmers,

etc.,^ usually^ worry^ about

  • Does^ the^ divider^ work^ correctly?D^ h^ b^ l d^ if^ k^

i^ F^ h?

  • Does^ the^ robot^ explode^ if^ spoken

to^ in^ French?

  • Validation:^ Are^ you^ building

the^ correct^ thing? Validation:^ Are^ you^ building

the^ correct^ thing?

  • This^ is^ what^ designers,^ marketing,

etc.,^ usually^ worry^ about

  • Did^ the^ customer^ even^ need^ a^ division

unit^ in^ their^ CPU? What^ language^ did^ the^ Army^ specify

self destruct^ codewords in?

  • What^ language^ did^ the^ Army^ specify

self‐destruct^ codewords^ in?

How Do you Know “What it Should Be”?y^ • If^ testing^ a^ structurally

‐implemented^ module,

can

compare^ output^ to^ a^ behavioral

implementation

compare^ output^ to^ a^ behavioral

implementation

  • What^ if^ you^ only^ have

one^ implementation?Model checking– Model checking• Use some higher‐level description^ to^ describe^ behavior

and/or properties^ of^ operation • Feed^ implementation^ and^ model(s)

to^ a^ model^ checker

  • Model^ checkers^ make^ use^ of^ SAT

‐solvers,^ constraint^ solvers^ and^ other automated techniques: typically either^ proves^ correctness,^ or id t l ( )provides counter‐example(s)

Limitations of Black-Box Testing

g

  • For^ true^ black‐box^ testing,

full^ (or^ even^ close^ to^ full)

coverage^ can^ be^ very^ hard

to^ achieve^ in^ practice

coverage^ can^ be^ very^ hard

to^ achieve^ in^ practice

  • Consider^32 ‐bit^ adder^ (two

32 ‐bit^ inputs^ =^64 ‐bit^ test^ vector) (^64 4) – Brute force: 2 =^ 18 446 744 073 709 551 616Brute force: 2 =^ 18,446,744,073,709,551,616• That’s 18+ Quintillion^ input possibilities• Assuming you can test 1 Billion^ inputs^ per^ second,^ this^ would

still t k^8 t^ iftake^ you^ over^584 years^ to^ verify– Let’s^ say^ you^ only^ have^6 months

to^ verify^ the^ adder…

  • You’ll^ only^ be^ able^ to^ verify^ 0.086%

of^ the^ possible^ inputsy y p^ p

  • 64‐bit^ adder?• 10.7^ Quintillion^ Millennia

With^ a^ little for full verificationb dd h h more^ than 116,000 processors, you can get it done^ in^ time

  • 128‐bit^ SIMD^ adder?^ …^

ha^ ha can^ get^ it^ done^ in^ time^5

Testing with Knowledge of Internalsg^

g

  • Circuits^ are^ usually^ not

black^ boxes if ’ th th t^ b ilt^ th^ i^ th^ fi^ t^

Grey‐Box^ Testingl

  • esp.^ if^ we’re^ the^ ones^ that

built^ them^ in^ the^ first^ place

  • So^ make^ use^ of^ that

knowledge A C

X 6 inputs,^ so^64 B^ possible^ input^ vectors^ D

Y Idea:^ make^ sure^ every^ signal^ (wire)^ is^ tested^ (wire)^ is^ tested^ E F 7 internal^ signals,^ test^ both^ high test^ both^ highStill^ black‐box^ and^ low^

‐like;^ apply^ input,^ observe output

Testing withAccess to Internalsg^ • Observe^ any^ internal

nodes,^ too p tA C

X p B q t u D

Y

r v E F s G ll diffi lt^ t^ i^ l^ t

• Generally^ more^ difficult

to^ implement

-^ Verilog:^ need^ to^ change

interface^ to^ export^ internal

signals (can^ see^ in^ graphical^ timing

viewer) (can^ see^ in^ graphical^ timing

viewer)

-^ Hardware:^ very^ expensive

Example: Simply Parity Detectorp^ :^ p y

y 0 Assume^ we^ start^ in^ state

0

Assume 0

we^ start^ in^ state^0 Input^ sequence^ of:0,^ 1,^ 0,^1 would visit all^ states^ and^ all^ edges 1 1

h^ l^ k^ l d^ fNote: this leverages^ our^ knowledge^ of 1 the state^ transition^ diagram^ (i.e.,^ we know^ the^ implementation ) 0

Can’t Do This with Black-Box Testing

g

Partity Detector^ FSM0, 1, 0, 1 0,^ 1,^

1,^0 FSM Implemented^ Correctly?p^ y 0 0

For^ this^0 *^ *^ *^1 00^ implementation 1 110 11

: no(two edges not^ This^ implementation^ justexercised by thehappens^ to^ correctly^ output 11 test^100 For^ this^0

sequence;the^ first^ fourand^ they’reincorrect^ in this^ case)

bits^11 implementation :^1 yes^

Run-Time Verification^ • Many^ systems^ contain

Built‐In^ Self^ Test/ing (BIST)O b t ( ll h^ th^ t^ t^

t )

  • On^ boot^ up^ (or^ really^ whenever

the^ system^ wants^ to), invoke^ the^ BIST^ to^ verify^ the

correct^ operation^ of^ the system – Older^ systems^ would^ display

memory^ checks^ at^ boot‐up (Power‐On^ Self^ Test^ or^ POST)C^ t^ t^ till^ d^ thi

th^ j^ t^ d^ ’t^ di^ l^ thi• Current systems still do this,^ they^ just^ don’t^ display^ everything anymore

More on BIST^ • Normal^ verification

techniques^ can^ be^ very

slow

E^ i^ l ti^ th^ d

illi^ f^ t^ t^ t

  • E.g.,^ simulating^ thousands

or^ millions^ of^ test^ vectors

  • Simulation^ is^ orders^ of^ magnitude

slower^ than^ real^ HW

  • Idea:^ do^ what^ you^ need

to^ in^ simulation^ to^ get

as

much^ right^ as^ possiblemuch^ right^ as^ possible • Then^ let^ BIST^ simulate

a^ much,^ much^ larger^ number

of^ test^ inputs^ in^ much^

less^ timep – Can build a simple PRNG^ and^ verifier

What’s the “Verifier”?^ • Reuse^ simpler^ componentsT^ if^ th^ lti li

k^ th^ dd^ f^

“l

  • To^ verify^ the^ multiplier,

make^ the^ adder^ perform^

“long addition”• M^ *^ N^ =^ M^ +^ M^ +^ M^ +^ …^ +^ M

(N^ times)

  • Use^ known^ results^ – Don’t^ use^ a^ PRNG^ for

the^ input^ generator,^ rather

use known^ inputs• Or^ use^ the^ PRNG^ with^ a^ known

seed^ so^ that^ you^ still^ know^ what Or^ use^ the^ PRNG^ with^ a^ known

seed^ so^ that^ you^ still^ know^ what test^ sequences^ it^ will^ generate– Keep^ a^ table^ of^ expected^ outputs

Let’s Say Something’s Wrongy^

g^ g

  • What^ to^ do^ next?d^ b^

d^ l

  • Need^ observation^ and

control– For our projects, we can^ make^ use^ of^ the^ LCD^ and

LEDs b t^ di^ tl^ i^ ifi

i^ l^ t^ th^ t^ t

  • …^ but^ we^ directly^ wire^ specific

signals^ to^ these^ outputs

  • ...^ also^ not^ convenient^ for

observing^ a^ lot^ of^ information• e.g., all of the state inside the^ processor^ (could^ be^ many^ kilobytesg , p^ (^ y^

y of^ registers,^ flip‐flops,^ etc.)

Scan Registerg^

To^ Next^ Scan^ Register^ in^ Chain 0 NormalInput^

Normal 0 1

NormalOutput Variant^ #1:^ Partial^ Scan ScanMode

Variant^ #1:^ Partial^ Scan(not^ all^ registers^ are connected^ into^ the^ chain) From^ Previous^ ScanRegister^ in^ Chain^

Variant^ #2:^ Parallel^ Scan(more^ than^ one^ set^ of^ pins^ Æ^ faster^ reading)^19

Scan Chains in Practice^ • Used^ in^ real^ designs– Not^ useful^ unless^ you

know^ what^ the^ bits^ correspond

to Not^ useful^ unless^ you^ know^

what^ the^ bits^ correspond^ to • E.g., in theory you could try to^ hack^ a^ real^ chip’s^ scan^ chain^ interface and read out its internal data,^ but^ without^ knowing^ the^ actual

internal structure^ (implementation)^ and^ the^ order^ in^ which^ the^ registers^ are^ f hooked^ up^ in^ the^ scan^ chain,^ it’ll^

just^ be^ a^ lot^ of^ meaningless^ bits

  • Needs^ externally^ controllable

clock

  • Operation:Operation:– Assert^ scan^ mode– Feed^ in^ desired^ state^

(put^ values^ on^ scan‐in^ pin^ and

clock^ as needed)needed) – Deassert scan^ mode– Apply^ one^ clock – Scan^ out^ state^ and^ see^ if^ it’s

what^ you^ expected