1
我在組合賦值時遇到了問題。我不明白爲什麼我不能使用總是組合結構集合我的輸出變量。當我使用分配時,我沒有得到分配錯誤。Verilog:在賦值的左側必須具有可變數據類型
我想分配,總是@(*)都來阻擋(組合分配)
module control_unit(input wire [31:0] instruction
,output wire RegDst
,output wire ALUSrc
,output wire RegWrite
,output wire MemRead
,output wire MemWrite
,output wire MemToReg
,output wire Branch
);
wire [5:0] opcode;
assign opcode = instruction[31:26];
[email protected](*) begin
case(opcode)
6'b000000: begin // r-type
RegDst = 1'b1;
ALUSrc = 1'b0;
RegWrite = 1'b1;
MemRead = 1'b0;
MemWrite = 1'b0;
MemToReg = 1'b0;
Branch = 1'b0;
end
.
.
.
default: begin
RegDst = 1'b0;
ALUSrc = 1'b0;
RegWrite = 1'b0;
MemRead = 1'b0;
MemWrite = 1'b0;
MemToReg = 1'b0;
Branch = 1'b0;
end
endcase
end // end always_comb
endmodule
我對線和區別之間的區別有點困惑。根據我的理解,電線用於連接輸入和輸出端口,而reg用於存儲信息?什麼時候爲什麼輸出需要成爲reg? – Sugihara
@Jack:當你正在對它進行過程分配時,輸出需要是一個reg,例如在always塊中。 – toolic
這是由於語義?或者有硬件原因嗎? – Sugihara