I'm getting the error
[Synth 8-2576] procedural assignment to a non-register result is not permitted ["lpm_mult.v":29]
What am i doing wrong?
module lpm_mult (
dataa, datab, // multiplicand,multiplier
sum, // partial sum
clock, // pipeline clock
clken, // clock enable
aclr, // asynch clear
result // product
);
input clock;
input clken;
input aclr;
input [31:0] dataa;
input [31:0] datab;
input [63:0] sum;
output [63:0] result;
always @ (clken or posedge clock) begin
if (1==clken) begin
assign result = dataa * datab;
end
end
endmodule
There are more issues then then giving error message. As others have already pointed out
result
should be defined asoutput reg [63:0] result;
The other issues will not generate a compiling error; they are generating incorrect behavior and are unsynthesizable. With the code:
clken
is asynchronous trigger; it should not be in the sensitivity list.An
assign
statement inside the always block is call a procedural continuous assignment. Once the assignment is triggered, it will be continuously and immediately updated on any change todataa
ordatab
(ignoring the conditions ofclken
andclock
).Note: IEEE is considering depreciating procedural continuous assignment, so in the future it will likely become illegal syntax. IEEE Std 1800-2012 C.4.2 Procedural assign and deassign statements:
Regular continuous assignments (
assign
outside of procedural block) will remain as legal legal syntax.Verilog and SystemVerilog were officially merged by IEEE with IEEE Std 1800-2009.
Synchronous logic should use non-blocking (
<=
) assignments. It is legal syntax to blocking (=
) assignments in synchronous logic blocks, but is it not recommenced. Using blocking assignments in synchronous logic blocks may cause race conditions in the simulator resulting in behavioral mismatch between RTL and synthesized circuit.assign
statements must use blocking assignments (non-blocking is illegal syntax).Your code should look something line the following to compile and behave correctly in simulation:
You are assigning to
result
inside analways
block, which is not allowed, becauseresult
is awire
, not areg
.Declare
result
as follows to make it work:By default all input and output signals are 'wires'. Wires cannot be assigned in the procedural blocks.
This should fix the error.