西南交大计算机组成原理考试大纲,西南交大计算机组成原理实验二七段LED数码管显示译码器的设计.docx...

该博客介绍了两个Verilog模块的设计:译码模块和LED显示模块。译码模块根据输入信号转换为特定的7段LED编码,而LED显示模块则根据时钟信号和控制信号在多个数码管上动态显示不同的数值或字符。博客内容详细展示了这两个模块的内部逻辑和工作流程。
摘要由CSDN通过智能技术生成

//译码模块

module xianshi(input [3:0]xs,output reg [6:0]l);

always @ (xs)

begin

case(xs)

4'b0000: l<=7'b111_1110;

4'b0001: l<=7'b011_0000;

4'b0010: l<=7'b110_1101;

4'b0011: l<=7'b111_1001;

4'b0100: l<=7'b011_0011;

4'b0101: l<=7'b101_1011;

4'b0110: l<=7'b101_1111;

4'b0111: l<=7'b111_0000;

4'b1000: l<=7'b111_1111;

4'b1001: l<=7'b111_1011;

4'b1010: l<=7'b111_0111;

4'b1011: l<=7'b001_1111;

4'b1100: l<=7'b100_1110;

4'b1101: l<=7'b011_1101;

4'b1110: l<=7'b100_1111;

4'b1111: l<=7'b100_0111;

default: l<=7'b000_0000;

endcase

end

endmodule

//LED显示模块

module show(control,L1,L2,L3,L4,clk,cout,dig);

input clk;

input [1:0]control;

input[6:0] L1,L2,L3,L4;//定义4个数码管

output reg [6:0]cout;

output reg[2:0]dig;

reg[16:0]s;

reg[3:0]temp;

wire[6:0]tempe;

initial temp = 4'b0000;

initial s<=1;

always @(negedge clk)

begin

if(s<40)

begin

s<=s+1;

temp<=temp+1;

if(s%10==0)

temp<=0;

end

else

begin

s<=1;

end

end

xianshi x(temp,tempe);

always @ (s)

begin

if(s<=10)

begin

dig = 3'b000;

if(control==2'b00|control==2'b11)

cout = L1;

else if(control==2'b01)

cout = 7'b111_1110;

else if(control==2'b10)

cout = tempe;

end

if(s>10&s<=20)

begin

dig = 3'b001;

if(control==2'b00|control==2'b11)

cout = L2;

else if(control==2'b01)

cout = 7'b111_1110;

else if(control==2'b10)

cout = tempe;

end

if(s>20&s<=30)

begin

dig = 3'

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值