大家好,又见面了,我是你们的朋友全栈君。always@(posedge CLK or negedge nRESET)
begin
if(!nRESET)
begin
end
else
begin
if(key_en)
begin
case (key_value_1)
7’b0001_001: key_value <= 4’d1; //1
7’b0010_001: key_value <= 4’d4; //4
7’b0100_001: key_value <= 4’d7; //7
7’b1000_001: key_value <= 4’d0; //*
7’b0001_010: key_value <= 4’d2; //2
7’b0010_010: key_value <= 4’d5; //5
7’b0100_010: key_value <= 4’d8; //8
7’b1000_010: key_value <= 4’d0; //0
7’b0001_100: key_value <= 4’d3; //3
7’b0010_100: key_value <= 4’d6; //6
7’b0100_100: key_value <= 4’d9; //9
7’b1000_100: key_value <= 4’d0; //#
endcase
end
else
begin
end
end
end
结果正确
always@(posedge CLK or negedge nRESET)
begin
if(!nRESET)
begin
key_value <= 4’d0;
end
else
begin
if(key_en)
begin
case (key_value_1)
7’b0001_001: key_value <= 4’d1; //1
7’b0010_001: key_value <= 4’d4; //4
7’b0100_001: key_value <= 4’d7; //7
7’b1000_001: key_value <= 4’d0; //*
7’b0001_010: key_value <= 4’d2; //2
7’b0010_010: key_value <= 4’d5; //5
7’b0100_010: key_value <= 4’d8; //8
7’b1000_010: key_value <= 4’d0; //0
7’b0001_100: key_value <= 4’d3; //3
7’b0010_100: key_value <= 4’d6; //6
7’b0100_100: key_value <= 4’d9; //9
7’b1000_100: key_value <= 4’d0; //#
endcase
end
else
begin
key_value <= 4’d0;
end
end
end
结果错误
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/136704.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...