在Quartus中写了一个非常简单的分频器module testdiv(mclk, out),编译OK,quartus生成testbench模板如下,在always块加入时钟产生语句,out=~out;如下
- `timescale 1 ps/ 1 ps
- module testdiv_vlg_tst();
- // constants
- // general purpose registers
- reg eachvec;
- // test vector input registers
- reg mclk;
- // wires
- wire out;
- // assign statements (if any)
- testdiv i1 (
- // port map - connection between master ports and signals/registers
- .mclk(mclk),
- .out(out)
- );
- initial
- begin
- // code that executes only once
- // insert code here --> begin
-
- // --> end
- $display("Running testbench");
- end
- always
- // optional sensitivity list
- // @(event1 or event2 or .... eventn)
- begin
- // code executes for every event on sensitivity list
- // insert code here --> begin
- <font color="Red"># 10 mclk=~mclk ; </font>
- @eachvec;
- // --> end
- end
- endmodule
复制代码然后添加testbench,点击RTL Simulation调用Modlesim
仿真,结果不出来波形啊,如下图:
才接触Modlesim,折腾好久了,真心不知道该怎么搞了,求大大们拯救啊
我是菜鸟
一周热门 更多>