Friday, October 14, 2011

Concurrent Signal Assignments

Both Conditional and Selected signal assignments are forms of Concurrent Signal Assignements (in which changes are performed concurrently to other active statements.)

They can be assigned inside a process or architecture block.


Conditional Signal Assignment : Priority


Conditional signal assignment is similar to if-then-else.
A conditional signal assignment consists of an assignment to one output (or a collection of outputs, such as an array of any type) and a series of conditional when statements, as shown. To ensure that all conditions are covered, you can use a terminating when others clause.

architecture mux1 of my_mux is
begin
    Y <= A when Sel = "00" else
             B when Sel = "01" else
             C when Sel = "10" else
             D when others;
end mux1;
Selected Signal AssignmentA selected signal assignment is similar to a conditional signal assignment but differs in that the input conditions specified have no implied priority.
The "else" is the difference. These are bad examples because the code does not depend on the type of signal assignment. Either would work in this case.

begin
    with Sel select
        Y <= A when "00",
             B when "01",
             C when ?0",
             D when others;
end mux1;
From here.

1 comment:

  1. http://www.vhdl.renerta.com/mobile/source/vhd00063.htm

    ReplyDelete