본문 바로가기

Verilog/HDLbits

[HDLBits] Exams/m2014 q4k

1. 문제 및 설명

  • 아래 그림의 회로를 구현하시오

2. 모듈 정의

module top_module (
    input clk,
    input resetn,   // synchronous reset
    input in,
    output out);

 

 

3. 답

module top_module (
    input clk,
    input resetn,   // synchronous reset
    input in,
    output out);
    
    wire [3:0] q;
    
    assign out = q[3];
    
    always@(posedge clk)
        begin
            if(!resetn)
                q <= 4'b0;
            else
                begin
                    q[3:0] <= {q[2:0], in};
                end
        end
    
                

endmodule

'Verilog > HDLbits' 카테고리의 다른 글

[HDLBits] Exams/ece241 2013 q12  (0) 2026.01.25
[HDLBits] Exams/2014 q4b  (0) 2026.01.22
[HDLBits] Shift18  (0) 2026.01.22
[HDLBits] Mt2015 lfsr  (0) 2026.01.22
[HDLBits] Lfsr5  (0) 2026.01.22