We try to describe how a logic circuit behaves
We have a new keyword : assign, which provides an assignment which is continuous
Whenever a signal changes, the expression is re-evaluated
The order doesn't matter here, they are evaluated in parrallel
Procedural statements
We can use procedural statements within an always block
- Here, the order matters !!
General format
always @*
begin
//code goes here
endIt treats all input signals used as triggers
- Whenever any input to the logic changes, the entire block is executed from top to bottom
During those blocks, we can use if statements, switch-case statements.
if statements need an else clause
2-1 MUX
module mux2to1 (input w1, w2, s, output s);
always @* begin
if(s == 0) begin
f = w1;
end
else begin
f = w2;
end
end
endmodule