Professional Documents
Culture Documents
Techniques
Lior Grinzaig
ADVA Optical Networking
• Simulator level.
• Code level.
– General programming coding style.
• Time tracking
Initial begin
forever
begin
wait ( (VALID == 1) && (READY == 1) );
count++;
@(posedge clk);
end
end
always @(*)
begin
case (DELAY_SEL)
2'd0 : OUT = IN0 ;
2'd1 : OUT = IN1 ;
2'd2 : OUT = IN2 ;
2'd3 : OUT = IN3 ;
endcase
end
always @(*)
begin
case (DELAY_SEL)
4'd0 : OUT = IN0 ;
4'd1 : OUT = IN1 ;
4'd2 : OUT = IN2 ;
4'd3 : OUT = IN3 ;
endcase
end
• Complexity of ~N.
© Accellera Systems Initiative 11
Asynchronous Example
This type of modification caused a simulation of SoC of
40M gates to run faster by a factor of 2.
How?
– The delay module was instantiated on each bit of 128 bits
bus.
– There where 128 possible phases.
– That bus run on the fastest bus in the testbench.
initial
begin
@( startDelay);
repeat (cycleDelay) @(posedge clk);
do_something();
end
© Accellera Systems Initiative 14
Time tracking
• It is possible to keep using #:
initial begin
@( startDelay);
@(posedge clk);
samplePosedge1 = $realtime;
@(posedge clk);
samplePosedge2 = $realtime;
period = samplePosedge2 - samplePosedge1;
->delay;
end
initial begin
@(delay);
#( period * ( cycleDelay – 2 ) ); // 2 clocks were "wasted"
do_somthing();
end
© Accellera Systems Initiative 15
Macro code modifications
• System modes.
generate if ( ! DIVIDER1_SIMPLIFIED_MODEL )
begin :package_model
divider u_divider1
(
.port_A (a),
.port_B (b),
.port_C (c)
);
end
else
begin : simplified_model
simpified_divider u_divider1
(
.port_A (a),
.port_B (b),
.port_C (c)
);
end endgenerate 19
Flexible Use of BFM/stub
• You can choose when to use what:
– Debug/development mode.
– Full / mini regression.
– Per test/tests-list.