[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.

module top_module();
	reg clk;
    reg in;
    reg [2:0] s;
    wire out;
    
    q7 u_q7(
        .clk(clk),
        .in(in),
        .s(s)
        .out(out)
    );

    always #5 clk=~clk;

    initial begin
        clk=1'b0;
        in=1'b0;
        s=3'd2;
        #10 s=3'd6;
        #10 s=3'd2;
        in=1'b1;
        #10 s=3'd7;
        in=1'b0;
        #10 s=3'd0;
        in=1'b1;
        #30 in=1'b0;
    end

endmodule

相关推荐

  1. 作业2.2

    2024-05-25 19:20:28       26 阅读
  2. <span style='color:red;'>2</span>.<span style='color:red;'>2</span>作业

    2.2作业

    2024-05-25 19:20:28      33 阅读
  3. 2.2作业

    2024-05-25 19:20:28       28 阅读
  4. 假期作业 2.2

    2024-05-25 19:20:28       33 阅读
  5. 2024/2/2

    2024-05-25 19:20:28       30 阅读
  6. 作业2024/2/2

    2024-05-25 19:20:28       33 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-05-25 19:20:28       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-25 19:20:28       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-25 19:20:28       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-25 19:20:28       20 阅读

热门阅读

  1. 从零入门激光SLAM(二十)——IESKF代码实现

    2024-05-25 19:20:28       13 阅读
  2. 二叉树

    二叉树

    2024-05-25 19:20:28      9 阅读
  3. Go 语言中的 Viper 库来读取 YAML 配置文件

    2024-05-25 19:20:28       12 阅读
  4. SCSS基本使用:解锁CSS预处理器的高效与优雅

    2024-05-25 19:20:28       12 阅读
  5. React Native 之 处理触摸事件(八)

    2024-05-25 19:20:28       9 阅读
  6. 中移物联OneMO Cat.1模组推动联网POS规模应用

    2024-05-25 19:20:28       11 阅读
  7. C++之左值、右值、完美转发

    2024-05-25 19:20:28       10 阅读