2021年5月12日 星期三

HBLbits_Verilog Basic_Tb/tb2

HBLbits_Verilog Basic_Tb/tb2 

The waveform below sets clkin, 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.

`timescale 1ps / 1ps
module top_module();
    reg clk;
    reg in;
    reg [2:0] s;
    wire out;
    
    q7  dut(
        .clk(clk),
        .in(in),
        .s(s),
        .out(out)
    );
    
    initial begin
        clk=0;
        s = 3'b010;in=0;
        #10;
        s = 3'b110;
        #10;
        s = 3'b010;in=1;
        #10;
        s = 3'b111;in=0;
        #10;
        s = 3'b000;in=1; 
        #30;  in=0;       
    end

   
  always
begin
           #5 clk=~clk;
end 
   
endmodule



沒有留言:

張貼留言

Telegram +ESP32自動發報機

  Telegram   +ESP32自動發報機 這套系統是一個典型的 IoT(物聯網)架構 ,結合了遠端配置(Python)、通訊中介(MQTT)與硬體執行(ESP32)。 以下我為您拆解這兩支程式的核心運作原理: 一、 系統架構流程 Python 端 (控制台) :使用者輸入...