RRRED
Newbie level 5
soc buffer
Hello,
I am working on this Z80 SoC running on Altera DE1 board.
So far, all leds, switches, keys and 7 segment displays can be addressed using IN/OUT commands.
The computer has a ROM for the user program, and the SRAM for storing data.
I did not test the gpio pins.
My question is, when interfacing with an external hardware, all pins must be asserted at same time?
I supposed so, and created a buffer for every pin, so, when an OUT command is sent to write to gpio pins, it is buffered by the hardware, and only asserts the pins (all 36 pins at same time) when another OUT in sent to a specific control port.
Is this approach correct?
I supposed I will have to buffer the input as well?
regards.
Roni
Hello,
I am working on this Z80 SoC running on Altera DE1 board.
So far, all leds, switches, keys and 7 segment displays can be addressed using IN/OUT commands.
The computer has a ROM for the user program, and the SRAM for storing data.
I did not test the gpio pins.
My question is, when interfacing with an external hardware, all pins must be asserted at same time?
I supposed so, and created a buffer for every pin, so, when an OUT command is sent to write to gpio pins, it is buffered by the hardware, and only asserts the pins (all 36 pins at same time) when another OUT in sent to a specific control port.
Code:
process(Clk_Z80)
variable NUMBER0_sig : std_logic_vector(3 downto 0);
variable NUMBER1_sig : std_logic_vector(3 downto 0);
variable NUMBER2_sig : std_logic_vector(3 downto 0);
variable NUMBER3_sig : std_logic_vector(3 downto 0);
variable LEDG_sig : std_logic_vector(7 downto 0);
variable LEDR_sig : std_logic_vector(9 downto 0);
variable GPIO_0_buf_out: std_logic_vector(35 downto 0);
variable GPIO_1_buf_out: std_logic_vector(35 downto 0);
begin
if Clk_Z80'event and Clk_Z80 = '1' then
if IORQ_n = '0' and Wr_n = '0' then
if A(7 downto 0) = x"01" then
LEDG_sig := DO_CPU;
elsif A(7 downto 0) = x"02" then
LEDR_sig(7 downto 0) := DO_CPU;
elsif A(7 downto 0) = x"10" then
NUMBER0_sig := DO_CPU(3 downto 0);
NUMBER1_sig := DO_CPU(7 downto 4);
elsif A(7 downto 0) = x"11" then
NUMBER2_sig := DO_CPU(3 downto 0);
NUMBER3_sig := DO_CPU(7 downto 4);
elsif A(7 downto 0) = x"A0" then
GPIO_0_buf_out(7 downto 0) := DO_CPU;
elsif A(7 downto 0) = x"A1" then
GPIO_0_buf_out(15 downto 8) := DO_CPU;
elsif A(7 downto 0) = x"A2" then
GPIO_0_buf_out(23 downto 16) := DO_CPU;
elsif A(7 downto 0) = x"A3" then
GPIO_0_buf_out(31 downto 24) := DO_CPU;
elsif A(7 downto 0) = x"A4" then
GPIO_0_buf_out(35 downto 32) := DO_CPU(3 downto 0);
elsif A(7 downto 0) = x"B0" then
GPIO_1_buf_out(7 downto 0) := DO_CPU;
elsif A(7 downto 0) = x"B1" then
GPIO_1_buf_out(15 downto 8) := DO_CPU;
elsif A(7 downto 0) = x"B2" then
GPIO_1_buf_out(23 downto 16) := DO_CPU;
elsif A(7 downto 0) = x"B3" then
GPIO_1_buf_out(31 downto 24) := DO_CPU;
elsif A(7 downto 0) = x"B4" then
GPIO_1_buf_out(35 downto 32) := DO_CPU(3 downto 0);
elsif A(7 downto 0) = x"C0" then
GPIO_1 <= GPIO_0_buf_out;
elsif A(7 downto 0) = x"C1" then
GPIO_1 <= GPIO_1_buf_out;
end if;
end if;
end if;
NUMBER0 <= NUMBER0_sig;
NUMBER1 <= NUMBER1_sig;
NUMBER2 <= NUMBER2_sig;
NUMBER3 <= NUMBER3_sig;
LEDR(7 downto 0) <= LEDR_sig(7 downto 0);
LEDG <= LEDG_sig;
end process;
Is this approach correct?
I supposed I will have to buffer the input as well?
regards.
Roni