-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #433 from os-fpga/task/EDA-3187/add_setup_lec_sim
updated the script and added simulation
- Loading branch information
Showing
2 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
RTL_testcases/titan_benchmarks/cic_integrator/sim/co_sim_tb/co_sim_cic_i.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
`timescale 1ns/1ps | ||
module co_sim_cic_i; | ||
// Clock signals | ||
reg clk; | ||
// Reset signals | ||
reg reset_n; | ||
|
||
wire [13:0] data_out , data_out_netlist; | ||
reg [7:0] data_in; | ||
reg in_dv; | ||
integer mismatch = 0; | ||
|
||
cic_i golden (.*); | ||
|
||
`ifdef PNR_SIM | ||
cic_i_post_route route_net (.*, .data_out(data_out_netlist) ); | ||
`else | ||
cic_i_post_synth synth_net (.*, .data_out(data_out_netlist) ); | ||
`endif | ||
|
||
// clock initialization for clk | ||
initial begin | ||
clk = 1'b0; | ||
forever #5.0 clk = ~clk; | ||
end | ||
//Reset Stimulus generation | ||
initial begin | ||
$display ("***Reset Test is applied***"); | ||
reset_n <= 0; | ||
{data_in, in_dv } <= 'd0; | ||
repeat (2) @(negedge clk); | ||
reset_n <= 1; | ||
@(negedge clk); | ||
compare(); | ||
$display ("***Reset Test is ended***"); | ||
//Random stimulus generation | ||
repeat(100) @ (negedge clk) begin | ||
data_in <= $urandom(); | ||
in_dv <= 1; | ||
compare(); | ||
end | ||
|
||
// ----------- Corner Case stimulus generation ----------- | ||
repeat (2) @(negedge clk); | ||
data_in <= 8'd255; | ||
in_dv <= 1'd1; | ||
compare(); | ||
|
||
if(mismatch == 0) | ||
$display("**** All Comparison Matched *** \n Simulation Passed\n"); | ||
else | ||
begin | ||
$display("%0d comparison(s) mismatched\nERROR: SIM: Simulation Failed", mismatch); | ||
$fatal(1); | ||
end | ||
repeat(20) @(posedge clk); | ||
$finish; | ||
end | ||
|
||
task compare(); | ||
if ( data_out !== data_out_netlist ) begin | ||
$display("Data Mismatch: Actual output: %0d, Netlist Output %0d, Time: %0t ", data_out, data_out_netlist, $time); | ||
mismatch = mismatch+1; | ||
end | ||
else | ||
$display("Data Matched: Actual output: %0d, Netlist Output %0d, Time: %0t ", data_out, data_out_netlist, $time); | ||
endtask | ||
|
||
initial begin | ||
$dumpfile("tb.vcd"); | ||
$dumpvars; | ||
end | ||
|
||
endmodule |