2021年4月19日 星期一

HBLbits_Verilog Basic_Module shift8

 HBLbits_Verilog Basic_Module shift8

The module provided to you is: module my_dff8 ( input clk, input [7:0] d, output [7:0] q );




module top_module ( 
    input clk, 
    input [7:0] d, 
    input [1:0] sel, 
    output [7:0] q 
);
    wire [7:0]q1,q2,q3;
    reg [7:0] out ;
    my_dff8 inst1 ( clk, d, q1 );
    my_dff8 inst2 ( clk, q1, q2 );
    my_dff8 inst3 ( clk, q2, q3 );
    always @(*)
        case(sel)
            2'd0: out=d;
            2'd1: out=q1;
            2'd2: out=q2;
            2'd3: out=q3;
        endcase    
    assign q=out;
endmodule

沒有留言:

張貼留言

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站 (ESP32 + DHT22 + 1602 LCD)

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站(溫度 濕度) (ESP32 + DHT22 + 1602 LCD) 想學物聯網(IoT)與 ESP32 電子實作,卻擔心接線與電壓規範搞砸嗎?透過強大的線上模擬器 Wokwi ,我們不需要花費任何硬體費用,打開瀏覽器...