我想做一個模塊,執行值的二進制補碼,如果msb是1.它工作在節奏,但是當我嘗試合成它時,我得到以下錯誤:錯誤當試圖合成verilog代碼
無法測試變量X_parallel
,因爲它不在事件表達式中或極性錯誤。
該模塊的代碼如下:
module xTwosComp (X_parallel, Clk, Reset, X_pos);
input [13:0] X_parallel;
input Clk, Reset;
//wire X_msb; //was an attempt at fixing the problem
output [13:0] X_pos;
reg [13:0] X_pos;
//assign X_msb=X_parallel[13];//failled attempt at fixing
always @ (posedge Clk or posedge Reset)
begin
if (X_parallel[13]) begin
X_pos = ~(X_parallel) +1;
end else begin
X_pos = X_parallel;
end
end
endmodule