Forum Discussion
Altera_Forum
Honored Contributor
11 years agoBidirectional bus - noob question
Sorry if this is a basic misunderstanding, but I'm just learning FPGAs (I did electronics at university, but that was 20+ years ago). I've got the Cyclone II dev kit, and I'm trying to set it u...
Altera_Forum
Honored Contributor
11 years agoThere is probably where writing some HDL is going to be a massive life saver. For this you need an address decoder, which in HDL would be something like this:
--turn everything off unless decoded.
reg_en <= '0';
sram_en <= '0';
temp_sensor_en <= '0';
case cpu_addr(7 downto 4) is
when x"0" =>
--access some registers
reg_en <= '1';
when x"1" =>
sram_en <= '1';
when x"2" =>
temp_sensor_en <= '1';
----etc
I wouldnt want to write that out in logic gates. Let the synthesisor do the work for you. If you insist on schematics, you can use lpm_compare blocks and lpm_constants for the values. Extract the bits out of the address bus to decode into individual enables.