Design
- RTL
- blocks
- modules
- vectors
- assignments
- arrays
Verification
- signals, states
- interfaces
- clocking block
- scheduling
- functions
- tasks
- class
- random
- constraints
- coverage
- queues and arrays
Methodology
- objects
- components
- messaging
- virtual interfaces
- TLM ports
- field macros
- event pool
- transaction recording
- phases
- transactions
- sequence item
- sequences
- parameterization
- callbacks
- configuration-db
- factory
- register model
Concepts
- Test Layer and Functional Coverage
- Scenario Layer
- Generator / Virtual Sequence
- Environment
- Functional Layer
- Agent
- Scoreboard
- Checker
- Command Layer
- Driver
- Assertions
- Monitor
- Signal Layer
- Dut
- Interface
- Phases
- Build phase
- Generate configuration:
- Randomize the configuration of the DUT
- Randomize the surrounding environment
- Build environment
- Allocate and connect the test bench components based on the configuration
- A testbench component exists in the testbench as opposed to physical components in the design.
- Reset DUT
- Configure DUT
- load DUT command registers
- Initialization
- Run phase
- Start Environment
- Run the test bench components, BFMs and stimulus generators.
- Run the test
- Start the test and wait for doneness.
- For random test, use the testbench layers as a guide. Wait for a layer to drain all the inputs from the previous layer and become idle. Then wait for the next lower layer.
- Use time-out checkers to make sure it doesn't lock-up.
- Wrap-up phase
- Sweep
- After the lower layer completes, wait for the final transactions to drain out of the DUT
- Report
- Once the DUT is idle, sweep the testbench for lost data
- Check scoreboard for leftover transactions held that never came out.
- Create the final report on whether the test passed.
- If it failed, delete incorrect functional coverage results.
- Constrained-random test with a test plan
- First, build layered test bench, including self-checking portion.
- Second, creating stimulus specific to a goal in test plan.
- Error injection
- Third, add instrumentation to the environment and gathers functional coverage data.
- Fourth, analyze the results to see if the goals are met.
Data Types
- 4-state: logic, reg, integer, time
- use $isunknown(some_logic_port) == 1 to check
- 2-state: bit, byte, int, shortint, longint, real
- String Methods
Arrays
- Fixed-size Arrays
- Dynamic Arrays
- Queues
- Associative Arrays
`default_nettype none
int cs[16];
int sc[15:0];
int array0 [7:0][3:0]; // packed, int=32bit
int array1[4] = '{0,1,2,3};
int descent[5] = '{9,8,default:0};
int addr[] = new[4];
array0[7][3] = 1;
bit [7:0] b_unpack[3]; // unpacked
bit [3:0][7:0] test[1:10]; // 10 entries of 4 bytes packed into 32bits
// packed array
bit [1:0] [2:0] [3:0] barray;
barray = '{'{4’h6, 4’h5, 4’h4}, '{4’h3, 4’h2, 4’h1}};
bit [3:0] nibble[];
integer mem[]; // dynamic array of integers
// Array Operations
for (int i=0; i<$size(array1); i++) array1[i] = i;
foreach (descent[j]) descent[j] = array1[j] * 4;
foreach (array0[i,j])
$display ("@%0t: array[%0d][%0d] = %0d", $time, i, j, array0[i][j]);
array0 = '{'{9,8,7}, '{3{'5}}}; // tick - packed
int md[2][3] = ‘{‘{0,1,2}, ‘{3,4,5}};
foreach (md[i,j]) $display(“%d “, md[i][j]);
foreach (md[,j]) $display(“%d “, md[1][j]);
bit [31:0] src[5] = '{5{5}};
$displayb(src[0],, src[0][0],, src[2][2:1]);
// Dynamic Arrays
int dyn[], d2[];
dyn = new[5];
d2=new[20](dyn);
dyn=new[100];
dyn = ‘{dyn,5};
// shrinking
dyn = dyn[1:3];
integer addr[];
addr = new[100];
addr = new[200](addr); // double the size and preserving previous values.
addr = new [addr.size()*4](addr); // quadruple addr array
addr.delete; // delete all contents
addr.delete();
// var = $size(addr);
//
// Associative Arrays
// Unused elements don't use memory, unlike standard array
//
int item[*]; // not recommended
int item[string];
int item[integer];
int item[classname];
item [ 2'b3 ] = 1;
item[ 16’hffff ] = 2;
item[ 4b’1000 ] = 3;
$display( "%0d entries\n", item.num ); // prints "3 entries"
// item.num = 3; // returns only number of assigned elements
item.delete; // remove all entries
item.delete (2'b3); // remove index 3
byte unsigned assoc[int], idx = 1;
int map [string];
map["is"] = 2;
map.delete["easy"];
if (map.exists("is")) map["is"] +=1;
// map.first(s) // assign map[s] to be the first value
// map.last(s)
// map.next(s)
// map.prev(s)
// Queues
int q[$] = {1,2,3,5,8}; //unbounded queue, initialized with 5 locations;
typedef struct {int a, b; bit flag} packet_t;
packet_t q3 [$:16]; //a bounded queue, with a maximum size of 16
// Queue Methods
// insert(value)
// delete(value)
// push_front(value)
// push_back(value)
// var = pop_front()
// var = pop_back()
// var = q[index]
// var = size()
No comments:
Post a Comment