]> rtime.felk.cvut.cz Git - fpga/virtex2/uart.git/blobdiff - openMSP430_uart.vhd
Peripheral connected to the quadcount module and an incremental encoder. Interrupt...
[fpga/virtex2/uart.git] / openMSP430_uart.vhd
index cbcd0ef237ccd422b141c780fd23f8a9cd9dea9b..eafcbc8df48ce99494f4d7a028e70aa8e44b44ef 100644 (file)
@@ -9,7 +9,12 @@ entity openMSP430_uart is
     RESET: in std_logic;
 
     RXD : out std_logic;
-    TXD : in std_logic
+    TXD : in std_logic;
+    
+    ROT_FEED : out std_logic;
+    ROT_A : in std_logic;
+    ROT_B : in std_logic;
+    ROT_PRESS : in std_logic
   );
 end openMSP430_uart;
 
@@ -168,6 +173,17 @@ architecture rtl of openMSP430_uart is
     );
   end component;
 
+  component qcounter is
+    port (
+      clock    : in std_logic;
+      reset    : in std_logic;
+      a0, b0   : in std_logic;
+      qcount   : out std_logic_vector (31 downto 0);
+      a_rise, a_fall, b_rise, b_fall, ab_event : out std_logic;
+      ab_error : out std_logic
+    );
+  end component;
+
 
   signal mclk : std_logic;
   signal puc : std_logic;
@@ -200,6 +216,9 @@ architecture rtl of openMSP430_uart is
 
   signal irq_ta0 : std_logic;
   signal irq_ta1 : std_logic;
+  signal omsp_quadcount_irq : std_logic;
+
+  signal qcount : std_logic_vector (31 downto 0);
 
 --------------------------------------------------------------------------------
 
@@ -359,10 +378,24 @@ begin
     per_wen     => "00",
     puc         => '0',
     per_irq_acc => '0',
-    per_irq     => open,
+    per_irq     => omsp_quadcount_irq,
     per_dout    => omsp_quadcount_dout,
     
-    qcount      => X"0001E240" -- 123456
+    qcount      => qcount
+  );
+
+  qcounter_0 : qcounter port map (
+    clock     => mclk,
+    reset     => ROT_PRESS,
+    a0        => ROT_A,
+    b0        => ROT_B,
+    qcount    => qcount,
+    a_rise    => open,
+    a_fall    => open,
+    b_rise    => open,
+    b_fall    => open,
+    ab_event  => open,
+    ab_error  => open
   );
 
 --------------------------------------------------------------------------------
@@ -371,7 +404,10 @@ begin
   
   irq <= (9 => irq_ta0,
           8 => irq_ta1,
+          7 => omsp_quadcount_irq,
           others => '0');
   
+  ROT_FEED <= '1';
+  
 end rtl;