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

//译码模块

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'


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部