On Fri, 12 Oct 2007 07:00:48 -0700,
Silver <> wrote:
>I'm having a problem concerning concurrent write of one signal from
>within two processes. My signal acts as a register and is of type
>std_logic_vector. It is written and read by one of the processes
>synchronously. Another process acts as a "poker" - it allows to
>asynchonously read and write the register.
You just can't do that. VHDL signal assignment doesn't work
that way. Each process represents a driver on the signal; the
value seen on the signal is the result of applying the signal's
resolution function to all its drivers.
You say you don't care about hazards, so it's easy enough to
make something like this happen. I guess that you are looking
for "last write wins" semantics. The way to get it is to
have THREE processes, one of which implements your last-write-wins
protocol by looking at the outputs of the other two. Don't
expect this to be synthesisable.
signal source1, source2, result: std_logic;
last_write_wins : process
begin
--- Wait until any of the drivers is written.
wait on source1'transaction, source2'transaction;
if source1'active then
-- there was a write to source1 (has priority over source2)
result <= source1;
elsif source2'active then
-- no write to source1, but source2 was written
lresult <= source2;
end if;
end process;
Then write two more processes, one driving source1 and the
other driving source2.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.