Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

How to use the $setup() system function in the testbench?

Altera_Forum
Honored Contributor II
1,593 Views

I want to use the $setup() and $hold() system function to check the setup time and hold time in the Verilog testbench,but there is a note show that " unexpected "$setup"" in the Modelsim. 

could you help me? 

thank you!
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
886 Views

ha ha!I have found the usage of the $setup(). 

`timescale 1 ns/ 1 ps module diff_notifier(clk,data_A,data_B,data_out,reset); input clk; input reset; input data_A; input data_B; output data_out; specify $setup(data_A,posedge clk,1); $hold(posedge clk,data_A,0.1); endspecify endmodule module LED_vlg_tst(); reg eachvec; // test vector input registers reg clk; reg data_A; reg data_B; reg reset; reg pha,phb; // wires wire data_out; wire notifier; integer TF; integer i; // assign statements (if any) LED i1 ( // port map - connection between master ports and signals/registers .clk(clk), .data_A(data_A), .data_B(data_B), .data_out(data_out), .reset(reset) ); diff_notifier U1(clk,data_A,data_B,data_out,reset); initial begin clk=0; TF=$fopen("DATABASE.txt"); $readmemb("WY.txt",pha); $readmemb("KL.txt",phb); for(i=0;i<8;i=i+1) begin # 5; data_A=pha; data_B=phb; # 10; $fdisplay(TF,"%b",data_out); # 5; end $fclose(TF); $display("Running testbench"); end always# 10 clk=~clk; endmodule
0 Kudos
Reply