CAD For VLSI Design - I
CAD For VLSI Design - I
Behavioral Modeling
Learning Objectives
Use of structured procedures always and initial Delay-based, Event-based and Level-sensitive timing controls Conditional statements if and else Multiway branching case, casex and casez Looping Statements while, for, repeat and forever Blocks sequential and parallel blocks, naming and disabling blocks.
Timing Controls
Delay-Based
Regular delay control Intra-assignment delay control Zero delay control
Intra-assignment Delay
reg x,y,z; initial begin x=0;z=0; y=#5x+z;//Takevalueofxandzatthetime=0,evaluate x+zandthen //wait5timeunitstoassignvaluetoy.Anychangetoxandz after //time=0andbefore5willnotaffectthevalueofy end //Theabovecodeisequivalentto //x=0;y=0;temp_xz =x+z;#5y=temp_xz; //where,temp_xz isatemporaryvariable
Event OR control
// Sensitivity list always @(reset or clock or d) // if any one of reset,clock,d changes its value begin if (reset) q = 1b0; else if (clock) q = d; end
Conditional Statements
The if-else statement if (logical_expression) then <block> else <block> <block> = single statement or begin <block> end Nested if-else
if <block> else if <block> else if <block>
Multiway Branching
The case statement The casex and casez statements
An example
casex (encoding) 4b1xxx: next_state = 3; 4bx1xx: next_state = 2; 4bxx1x: next_state = 1; 4bxxx1: next_state = 0; endcase //encoding = 4b10xz will cause next_state=3
Parallel Blocks
initial begin fork x = 1b0; #5 y = 1b1; //After 5 units #10 z = {x,y}; //After 10 units join #20 w = {y,x}; end
Named Blocks
initial begin j = 0; begin:block1 //Naming while (j < 16) begin if (flag[j]) begin $display(Encountered TRUE bit at %d,j); disable block1; end j = j + 1; end //while end //block1 end//initial
Loops
while (condition) <block> for (count = 0; count < 128; count = count + 1) <block>
forever loop
initial begin clk = 1b0; forever #10 clock = ~clock; end
Thank You