Professional Documents
Culture Documents
NCLAUNCH
This tutorial explains how to simulate a behavioral code using NCLaunch. In order to do so,
lets consider the verilog codes below.
CNT_16 Module:
16 bit up counter with asynchronous active-low reset
`timescale 1ns/1ps
endmodule
CMP_16 Module:
Comparator which compares the 16 bit input with 50.
`timescale 1ns/1ps
reg OUT;
always@(IN) begin
if(IN <= 50) begin
OUT = 0;
end
else begin
OUT = 1;
end
end
endmodule
TOP Module:
The top module which connects both. The resulting design makes OUT=1 after 50 clock
cycles.
`timescale 1ns/1ps
endmodule
TEST_TOP Module:
Testbench module to test the top module.
`timescale 1ns/1ps
module TEST_TOP;
initial begin
RSTB = 0;
CLK = 0;
#3 RSTB = 1;
#10000 $finish;
end
Lets choose Multiple Step for step by step compilation, elaboration and simulation. Single
Step makes all these three in one step.
In order to initialize NCLaunch, we need a cds.lib file. Lets click on Create cds.lib File
And save newly created cds.lib file into our simulation folder.
When asked for which libraries to include, select Dont include any libraries for verilog
designs.
Lets select the verilog files from the left panel and click Launch Verilog Compiler icon.
Alternatively we can double click on each file to compile.
If there are no errors, the compiled designs are shown under the worklib.
Lets click on testbench module TEST_TOP and click Launch Elaborator icon to elaborate
the testbench.
Elaborated testbench module is shown under Snapshots. Lets select that module and click
Launch Simulator icon.
The simulator program SimVision opens. From the Design Browser window, lets select the
design to see the waveform names.
Lets select waveforms then click Send to Waveform window icon.
Now we can see the waveform names in the left pane. Lets click Run the simulation icon.
Lets click Zoom Out icon to see more of our waveforms.
Lets check whether the value of the counter is 50 when OUT goes high. In order to add the
output of the counter to the waveform window, lets click on Browse the design hierarchy
icon.
The OUT_16 wire of TOP module would to the trick, so lets find and select the new
waveform to be added. Just clicking on the wire name will add it to the waveform window.
Next, lets click on Collapse the Design Browser to get rid of Design Browser.
As we can see, the newly added waveform is empty. In order to see the waveform, we should
run the simulation again. In order to do so, lets click on Reset the simulation icon
Now lets click on the Run the simulation icon once again.
Then zoom out once again to see more.
Since we humans can understand decimal digits easier, lets right click on the cursor column
and select Decimal in Radix/Mnemonic tab.
As we can see, the OUT goes high when the counter hits 50, so the design works as expected.
Now lets change the design a little bit. Lets return to NCLaunch window and right click on
CMP_16 submodule, then select Edit.
Lets change the compared value from 50 to 40.
After we save the file and exit from the editor, we can see that icons of some designs in the
right panel have a little clock, which means that they are outdated. In order to update them,
lets right click on the elaborated testbench and select Update.
Then click OK
All design files are now updated. As we can see, updating elaborated testbench is enough to
update all submodules.
To simulate our new design, we can close the SimVision and launch it again from NCLaunch.
But if we do that, out waveform selections and waveform configurations such as selecting
decimal radix of OUT_16 will be lost. So, in order to make things faster, lets click on
Reinvoke Simulator from the Simulation menu of SimVision.
As we can see, the new design works as expected. The OUT goes high when the counter hits
40.