verilog编写的三八译码器,module decode(Y,A);output[7:0]Y;intput[2:0]A;reg[7:0]Y;always...
发布网友
发布时间:2022-04-30 02:18
我来回答
共2个回答
热心网友
时间:2023-10-05 10:45
mole add32(x, y, cin, of, zf, out);
input [7:0]x,y;
input cin;
output [32:0]out;
output zf, of;
reg [32:0]out;
wire [31:0]a;
wire [31:0]b;
[7:0]a=x;
[7:0]b=y;
[15:8]a = x;
[15:8]b = y;
[31:16]a = [15:0]a;
[31:16]b = [15:0]b;
always@(out or cin or a or b)
begin
case(cin)
1'b0:
begin
out = a + b;
end
1'b1: begin
out = a - ~b +cin;
out[32] = out[32] + 1;
end
endcase
end
assign zf = ~(out[8]|out[7]|out[6]|out[5]|out4|out[3]|out[2]|out[1]|out[0]);
assign of = (a[31] == b[31]) && (out[31] != a[13]);
endmole
问题出在
[7:0]a=x;
[7:0]b=y;
[15:8]a = x;
[15:8]b = y;
[31:16]a = [15:0]a;
[31:16]b = [15:0]b;
这里,老是expecting endmole,应该怎么写?初学求解答,大概就是把输入的x重复的赋到a中,由四个八位的x构成一个32位的a。
热心网友
时间:2023-10-05 10:46
(Y,A);output[7:0]Y;intput[2:0]A;reg