There are a 32 bit output bus, which is connected to two modules. There is a 5 bit Address bus, and a read signal controlled by bus master. The task is to have 2 readable registers on the bus, with address 1 and 2, and data 1 and 2. The problem is, that if both is in one process, then it works, and if they are in different processes (does not matter, if in different file, or in the same file), they does not work. --Works: Decode: process(read) begin outbus <= (others => 'Z'); if read = '1' then if A(10 downto 5) = "000001" then outbus <= x"00000001"; end if; if A(10 downto 5) = "000010" then outbus <= x"00000002"; end if; end if; end process; --Does Not work: Decode: process(read) begin outbus <= (others => 'Z'); if read = '1' then if A(10 downto 5) = "000001" then outbus <= x"00000001"; end if; end if; end process; Decode2: process(read) begin outbus <= (others => 'Z'); if read = '1' then if A(10 downto 5) = "000010" then outbus <= x"00000002"; end if; end if; end process; Any help would be highly appreciated. Thank You, Bence
In the first process (which should work), I would have used an else: if A(10 downto 5) = "000001" then outbus <= x"00000001"; elsif A(10 downto 5) = "000010" then outbus <= x"00000002"; end if; The second processes: As far as I know, this should not work because only one process may drive an output signal. (But I might be wrong)
You could use tristate busses. But I can't really recommend this:
1 | Decode: process(read) |
2 | begin
|
3 | outbus1 <= (others => 'Z'); |
4 | if read = '1' then |
5 | if A(10 downto 5) = "000001" then |
6 | outbus1 <= x"00000001"; |
7 | end if; |
8 | end if; |
9 | end process; |
10 | |
11 | Decode2: process(read) |
12 | begin
|
13 | outbus2 <= (others => 'Z'); |
14 | if read = '1' then |
15 | if A(10 downto 5) = "000010" then |
16 | outbus2 <= x"00000002"; |
17 | end if; |
18 | end if; |
19 | end process; |
20 | |
21 | outbus <= outbus1 or outbus2; |
This will be replaced on synthesis by an multiplexer. So you can do this replacement by your own. Duke
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.