Is this allowed?
input w;
input [8:0]y;
output reg [8:0]x;
always@(w)
begin
//x[0] or A is never on in any next state
as
The procedural continuous assign
statement was intended to be an optimized way of writing a mux-like behavior. For example, if you have
always @(A or B or select)
if (select)
out = A;
else
out = B;
You could write this as
always @(select)
assign out = A;
else
assign out = B;
But people don't like having to deal with sensitivity lists, so @(*)
was added to Verilog, and SystemVerilog added always_comb
.
But the real killer for this construct is that many people would write code like
always @(*)
assign out = A;
Which simulates fine, but you now have a double penalty in performance because the assign
statement is already sensitive to changes in A, but so is the always
block. This repeatedly executes the procedural assign
statement replacing the same RHS.
You can, it's called a "Procedural Continuous Assignment". It overrides ordinary procedural assignments, there doesn't seem to be a call for them in the code you've posted. I'm not sure if they're synthesisable, but I never have cause to use them anyway.
A note on your code - you're missing y
from your sensitivity list: eg always @( w or y )
or always @(*)
is safer.
There is no need using assign inside a procedural block (In this case Always)
Assign is a continuous assignment, and it has to go outside a procedural block.
Yes, but you don't want to. Since x[] doesn't depend on x[] the order doesn't matter. Just use <= instead of assign =.
Assign is a continuous assignment statement which is used with wires in Verilog. assign statements don't go inside procedural blocks such as always. Registers can be given values in an always block.
Assign statements can be viewed as:
always @(*)
statements for wires.