私はスタックを表すためにVerilogで有限状態マシンを設計しています。"複数の定数ドライバ"エラーVerilog with Quartus Prime
module state_machine (s, Enable, Clock, Resetn, c, OF_Err, UF_Err);
input [2:0] s;
input Enable, Clock, Resetn;
output reg [1:0] c;
output reg OF_Err = 0, UF_Err = 0;
reg [2:0] y, Y;
parameter [2:0] A = 3'b000, B = 3'b001, C = 3'b010, D = 3'b011, E = 3'b100;
always @(s, y, Enable)
if (Enable)
begin
case (y)
A: if (s == 3'b000) Y = B;
else
begin
Y = A;
UF_Err = 1;
end
B: if (s == 3'b000) Y = C;
else if (s == 3'b001) Y = A;
else
begin
Y = B;
UF_Err = 1;
end
C: if (s == 3'b000) Y = D;
else if (s == 3'b100) Y = C;
else Y = B;
D: if (s == 3'b000) Y = E;
else if (s == 3'b100) Y = D;
else Y = C;
E: if (s == 3'b000)
begin
Y = E;
OF_Err = 1;
end
else if (s == 3'b100) Y = E;
else Y = D;
default: Y = 3'bxxx;
endcase
c[1] = y[1];
c[0] = y[0];
end
always @(negedge Resetn, posedge Clock)
begin
if (Resetn == 0)
begin
y <= A;
OF_Err = 0; //Problem
UF_Err = 0; //Problem
end
else y <= Y;
end
OF_Err
とUF_Err
は、それぞれ、オーバーフロー及びアンダーフローの誤差の指標である次のようにモジュールです。私のプロジェクトをコンパイルするとき
はしかし、私は、次のエラーを取得:
Error (10028): Can't resolve multiple constant drivers for net "OF_Err" at state_machine.v(59) Error (10029): Constant driver at state_machine.v(10) Error (10028): Can't resolve multiple constant drivers for net "UF_Err" at state_machine.v(59)
私はコメント行を追加した後、これらのみ登場しました。私は、FSMがリセットされたときに、オーバーフローとアンダーフローのインジケータをリセットしたいのですが、私が持っている方法ではできません。これをどうやって行うのですか?
(任意の値の場合、これはアルテラDE2-115で実行されます)。
「推測ラッチ」については、インストラクタまたはTAにお尋ねください。このコードにはいくつかのコードがあり、修正する必要があります。 – skrrgwasme