if ステートメントを使用できるかどうか疑問に思っていたので、ALU を構築しようとしています。データパス テスト ベンチからデータパスに値を渡し、データパスから ALU に値を渡し、ALU からデータパスに戻します。対応する control_ALU が有効になっている場合にのみ、特定のコンポーネントを介して値を渡すコントロール ユニットを作成しようとしています。
ここに私のVerilogコードがあります:
module ALU (
input en_ALU, clk_ALU,
input [31:0] inputA, inputB, control_ALU,
output [31:0] resultc
);
wire [31:0] res_out;
always @(control_ALU)
begin
if(control_ALU[1]) begin
andLogic andLogic_component(
.dataA (inputA),
.dataB (inputB) ,
.resultA (res_out)
);
end
if(control_ALU[2]) begin
negate m0(
.inputnegate (inputA),
.resultnegate (res_out)
);
end
end
reg64bit z(
.clk(clk_ALU) ,
.clr(clr),
.enable(en_ALU),
.inputd(res_out),
.outputq(resultc)
);
endmodule