这是我的代码。但是当我编译它时,我收到了错误消息。
我的代码怎么了?
// seg7dec.v
module seg7dec (
input [3:0] val,
output reg [6:0] seg // from MSB A, B, C, D, E, F, G
);
always @(*)
begin
case (val[3:0])
4'h0: seg[6:0] = 7'b111_1110;
4'h1: seg[6:0] = 7'b011_0000;
4'h2: seg[6;0] = 7'b110_1101;
4'h3: seg[6;0] = 7'b111_1001;
4'h4: seg[6;0] = 7'b011_0011;
4'h5: seg[6;0] = 7'b101_1011;
4'h6: seg[6;0] = 7'b101_1111;
4'h7: seg[6;0] = 7'b111_0000;
4'h8: seg[6;0] = 7'b111_1111;
4'h9: seg[6;0] = 7'b111_1011;
4'ha: seg[6;0] = 7'b111_1101;
4'hb: seg[6;0] = 7'b001_1111;
4'hc: seg[6;0] = 7'b100_1110;
4'hd: seg[6;0] = 7'b100_1111;
4'hg: seg[6;0] = 7'b111_1011;
default: seg[6:0] = 7'b100_0111 ; // 4'hF
endcase
end
endmodule
这些是错误消息:
;'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(14): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(15): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(16): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(17): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(18): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(19): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(20): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(21): near ";": syntax error, unexpected ';'.
** Error: (vlog-13069) C:/Intel/seg7dec.v(22): near ";": syntax error, unexpected ';'.
** Error: (vlog-13057) C:/Intel/seg7dec.v(23): Expecting numeric digits.
** Error: (vlog-13069) C:/Intel/seg7dec.v(23): near "g": syntax error, unexpected IDENTIFIER, expecting ':'.
答案 0 :(得分:2)
从一行
4'h2: seg[6;0] = 7'b110_1101;
您已添加;而不是:在6到0之间。
答案 1 :(得分:2)
[MSB:LSB]
。seg[6;0]
更改为seg[6:0]
。seg
被声明为7位宽,因此无需在[6:0]
上添加seg
。4'hg
应该是4'he
。