D触发器二分频的modelsim和Isim仿真
时间:10-02
整理:3721RD
点击:
初学FPGA对modelsim仿真也不熟悉,仿真几次感觉带时钟的模块老是不对劲,请教一下类似分频,计数的这种模块,testbench该如何写?顺便附上我的一个练习,走过的路过的给个建议,帮助,谢谢了。
- module div2cnt(
- input wire clk,
- input wire clr,
- output reg q
- );
- wire D;
- assign D = ~q;
- always @ (posedge clk or posedge clr)
- begin
- if(clr == 1)
- q <= 0;
- else
- q <= D;
- end
- endmodule
- module div2_tsb;
- // Inputs
- reg clk;
- reg clr;
- // Outputs
- wire q;
- // Instantiate the Unit Under Test (UUT)
- div2cnt uut (
- .clk(clk),
- .clr(clr),
- .q(q)
- );
- initial begin
- // Initialize Inputs
- clk = 0;
- clr = 0;
- // Wait 100 ns for global reset to finish
- #100;
-
- // Add stimulus here
- repeat(100)
- begin
- clk = ~clk;
- #20;
- end
- end
-
- endmodule
小编用的vivado还是ISE?
用的ISE14.7啊。才学没多久,感觉一头雾水
我也是啊,不知道学什么,我用vivado资料更少。你用的什么板子?
nexys 2...而且我感觉xinlinx的资料也比Altera的少。
