vrilog设计流水灯

module yck_1716_2(codeout,clk,en,Q);
    input clk,en;
    output [2: 0] Q;
    output [6: 0] codeout;
    3_1 a(clk,en,Q);
    3_2 b(codeout, Q);
endmodule

module jyt_1919_chap_3_2(codeout, Q);
    input[2: 0] Q;            
    output reg[6: 0] codeout;        
    
    always @ (*)            //用always块语句描述逻辑
    begin
        case (Q)
        3'd0: codeout <= 7'b0000001;
        3'd1: codeout <= 7'b0000011;
        3'd2: codeout <= 7'b0000111;
        3'd3: codeout <= 7'b0001111;
        3'd4: codeout <= 7'b0011111;
        3'd5: codeout <= 7'b0111111;
        3'd6: codeout <= 7'b0000000; 
        default: codeout <= 7'bx;    
        endcase
    end
endmodule

module jyt_1919_chap_3_1(clk,en,Q);//七进制计数器
input clk,en;
output reg[2:0] Q;

always @(posedge clk)
begin
    if(en == 1'b1)
    begin
        if(Q < 3'd6)
        Q <= Q + 1'b1;
        else
        Q <= 0;
    end
    else
    Q <= Q;
end
endmodule
        

 

  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值