summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src
diff options
context:
space:
mode:
authorgalmes2004-03-01 23:35:02 +0000
committergalmes2004-03-01 23:35:02 +0000
commit12cbb114ef4ed01a33f23dd67c4e9bc9b67f1e2b (patch)
treeafee03d44a4a762eb2d533644e8d464a14b50b6b /2004/n/fpga/src
parent2ac3370482b0a39a687f42110287df6f7e914455 (diff)
Test du gpio en cours de remaniement !
Diffstat (limited to '2004/n/fpga/src')
-rw-r--r--2004/n/fpga/src/gpio/bch_gpio.vhd75
1 files changed, 59 insertions, 16 deletions
diff --git a/2004/n/fpga/src/gpio/bch_gpio.vhd b/2004/n/fpga/src/gpio/bch_gpio.vhd
index 16e5ca3..f2a5335 100644
--- a/2004/n/fpga/src/gpio/bch_gpio.vhd
+++ b/2004/n/fpga/src/gpio/bch_gpio.vhd
@@ -50,6 +50,11 @@ architecture sim1 of bch_gpio is
signal cs_reg_it_mask : std_logic := '0';
signal cs_reg_read_output : std_logic := '0';
+ constant REG_DATA : std_logic_vector(1 downto 0) := "00";
+ constant REG_DIRECTION : std_logic_vector(1 downto 0) := "01";
+ constant REG_IT : std_logic_vector(1 downto 0) := "10";
+ constant READ_OUTPUT : std_logic_vector(1 downto 0) := "11";
+
begin
-- -----------------------------------------------------
-- mapping du gpio. A reprendre pour le mapping final !!
@@ -78,16 +83,54 @@ begin
-- déclaration de procédures de test.
-- ----------------------------------
-- Lire dans un registre ou la sortie !
- --procedure do_read (address : in T_ADDRESS) is
- --begin
--- rw <= ISA_READ;
--- bus_address <= address;
--- bus_data <= "ZZZZZZZZ"; --est en sortie.
--- end do_read;
+ procedure do_read (action : in std_logic_vector(1 downto 0)) is
+ begin
+ -- sélection du registre
+ cs_reg_data_write <= '0';
+ cs_reg_direction <= '0';
+ cs_reg_it_mask <= '0';
+ cs_reg_read_output <= '0';
+
+ if (action = REG_DATA) then
+ cs_reg_data_write <= '1';
+ end if;
+ if (action = REG_DIRECTION) then
+ cs_reg_direction <= '1';
+ end if;
+ if (action = REG_IT) then
+ cs_reg_it_mask <= '1';
+ end if;
+ if (action = READ_OUTPUT) then
+ cs_reg_read_output <= '1';
+ end if;
+ -- on lit.
+ rw <= ISA_READ;
+ bus_data <= "ZZZZZZZZ"; --est en sortie.
+ end do_read;
-- Ecrire dans un registre !
- procedure do_write (data : in T_DATA) is
+ procedure do_write (action : in std_logic_vector(1 downto 0); data : in
+ T_DATA) is
begin
+ -- sélection du registre
+ cs_reg_data_write <= '0';
+ cs_reg_direction <= '0';
+ cs_reg_it_mask <= '0';
+ cs_reg_read_output <= '0';
+
+ if (action = REG_DATA) then
+ cs_reg_data_write <= '1';
+ end if;
+ if (action = REG_DIRECTION) then
+ cs_reg_direction <= '1';
+ end if;
+ if (action = REG_IT) then
+ cs_reg_it_mask <= '1';
+ end if;
+ if (action = READ_OUTPUT) then
+ cs_reg_read_output <= '1';
+ end if;
+ -- On écrit.
rw <= ISA_WRITE;
bus_data <= data;
end do_write;
@@ -103,20 +146,19 @@ begin
begin
-- Ecriture dans les trois registres.
- wait for (3*CK_PERIOD);
- cs_reg_direction <= '1';
- do_write ("00000111"); -- 3 bits poid faible : in.
- wait for (3*CK_PERIOD);
- cs_reg_direction <= '0';
- cs_reg_data_write <= '1';
- do_write (x"01"); -- 3 bits poid faible : in.
+ wait for (ISA_CK_PERIOD);
+ do_write (REG_DIRECTION, "00000111"); -- 3 bits poid faible : in.
+ wait for (ISA_CK_PERIOD);
+ do_write (REG_DATA, x"01"); -- 3 bits poid faible : in.
+-- wait for (ISA_CK_PERIOD);
+-- cs_reg_data_write <= '0';
-- interruption sur les 5 bits de poid faible.
-- wait for (3*CK_PERIOD);
-- do_write (A_IO1_REG_INTERRUPT_MASK, "11111000");
-- Lecture dans les trois registres.
--- wait for (3*CK_PERIOD);
--- do_read (A_IO1_REG_INTERRUPT_MASK);
+ wait for (3*CK_PERIOD);
+ do_read (REG_DIRECTION);
-- wait for (3*CK_PERIOD);
-- do_read (A_IO1_REG_DIRECTION);
-- wait for (3*CK_PERIOD);
@@ -130,6 +172,7 @@ begin
rst <= '1','0' after (CK_PERIOD/5);
clk_m <= not clk_m after (CK_PERIOD/2);
+ clk_i <= not clk_i after (ISA_CK_PERIOD/2);
-- Affecter des entrées sur la sortie : test des interruptions
io_output <= "00001ZZZ",