当前位置:   article > 正文

[HDLBits] Tb/tb2

[HDLBits] Tb/tb2

Tb/tb2

The waveform below sets clk, in, and s:

Module q7 has the following declaration:

module q7 (
    input clk,
    input in,
    input [2:0] s,
    output out
);

Write a testbench that instantiates module q7 and generates these input signals exactly as shown in the waveform above.

  1. module top_module();
  2. reg clk;
  3. reg in;
  4. reg [2:0] s;
  5. wire out;
  6. q7 u_q7(
  7. .clk(clk),
  8. .in(in),
  9. .s(s)
  10. .out(out)
  11. );
  12. always #5 clk=~clk;
  13. initial begin
  14. clk=1'b0;
  15. in=1'b0;
  16. s=3'd2;
  17. #10 s=3'd6;
  18. #10 s=3'd2;
  19. in=1'b1;
  20. #10 s=3'd7;
  21. in=1'b0;
  22. #10 s=3'd0;
  23. in=1'b1;
  24. #30 in=1'b0;
  25. end
  26. endmodule

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/623274
推荐阅读
相关标签
  

闽ICP备14008679号