Remove the keyword assign
from all your functions. assign
statements are for continuous assignments that should only be declared in a module
; not a task
, function
, initial
or always
.
There is a typo too. A couple places you have "substract" and should be "subtract".
You are also missing CarryIn
from your sensitivity list. If your sensitivity list is not complete it will infer complex latching logic. Better yet, switch to a IEEE 1364-2001 coding style and use always @(*)
or always @*
instead of always @ (left or right or sel or CarryIn)
. They auto construct the sensitivity list for combinational logic.