]> rtime.felk.cvut.cz Git - fpga/virtex2/msp_motion.git/commitdiff
GPIO connected to MCU
authorVladimir Burian <buriavl2@fel.cvut.cz>
Sun, 17 Apr 2011 11:17:18 +0000 (13:17 +0200)
committerVladimir Burian <buriavl2@fel.cvut.cz>
Sun, 17 Apr 2011 11:17:18 +0000 (13:17 +0200)
msp_motion.prj
msp_motion.vhd

index 03a97658058fc04b7e2b14f2393477e8c7b3e421..adab07416ab1349cca2b25fd04d1034e453b0f17 100644 (file)
@@ -61,6 +61,13 @@ vhdl    work quadcount/dff.vhd
 vhdl    work quadcount/qcounter.vhd
 
 
+#==============================================================================#
+# MCU peripherals                                                              #
+#==============================================================================#
+
+vhdl    work mcu_periph/gpio.vhd
+
+
 #==============================================================================#
 # Top-level design file                                                        #
 #==============================================================================#
index fb48d3d6c9f9c260d5a2e7da1116e5ad2631e974..286c02290e38467f338e2a2cb751a85c0890959d 100644 (file)
@@ -60,6 +60,15 @@ architecture rtl of msp_motion is
   signal per_en    : std_logic;
   signal per_addr  : std_logic_vector (7 downto 0);
 
+  ------------------------------------------------------------------------------
+  -- MCU peripherals
+  ------------------------------------------------------------------------------
+  -- GPIO
+  signal GPIO_IN    : std_logic_vector (15 downto 0);
+  signal GPIO_OUT   : std_logic_vector (15 downto 0);
+  signal GPIO_DAT_O : std_logic_vector (15 downto 0);
+  signal GPIO_SEL   : std_logic;
+  
   ------------------------------------------------------------------------------
   -- Dual-port shared memory
   ------------------------------------------------------------------------------
@@ -158,7 +167,35 @@ begin
 
   -- Peripheral bus address decoder and data multiplexer.
   ------------------------------------------------------------------------------
-  per_dout <= (others => '0');          -- MUST be 0 when nothing is addressed
+  per_dout <= GPIO_DAT_O when GPIO_SEL = '1' else
+              (others => '0');          -- MUST be 0 when nothing is addressed
+  
+  GPIO_SEL <= '1' when per_addr(7 downto 2) = 16#0140#/2/4 else '0';
+
+
+  ------------------------------------------------------------------------------
+  -- MCU peripherals
+  ------------------------------------------------------------------------------
+  GPIO_IN(0) <= HAL0;
+  GPIO_IN(1) <= HAL1;
+  GPIO_IN(2) <= HAL2;
+  GPIO_IN(3) <= IRC_INDEX;
+
+  gpio_0 : entity work.gpio
+    generic map (
+      W => 16)
+    port map (
+      ACK_O  => open,
+      ADR_I  => per_addr (1 downto 0),
+      CLK_I  => mclk,
+      DAT_I  => per_din,
+      DAT_O  => GPIO_DAT_O,
+      RST_I  => puc,
+      SEL_I  => GPIO_SEL,
+      STB_I  => per_en,
+      WE_I   => per_wen16,
+      GPIO_I => GPIO_IN,
+      GPIO_O => GPIO_OUT);