added pc_communication and btn_a to quartus project
[hwmod.git] / src / calc.vhd
index d398bd31ffe170a3577f7c97312bbc7933c10f87..420e2734e01b700bfa5847f51fca5d90129ffbf2 100644 (file)
@@ -14,7 +14,7 @@ entity calc is
                sys_clk : in std_logic;
                sys_res_n : in std_logic;
                -- btnA
-               -- TODO: pins
+               btn_a : in std_logic;
                -- rs232
                rxd : in std_logic;
                txd : out std_logic;
@@ -56,6 +56,12 @@ architecture top of calc is
        signal p_wdone : std_logic;
        signal p_write : hbyte;
        signal p_finished : std_logic;
+       --history/pc_com
+       signal pc_get : std_logic;
+       signal pc_spalte : hspalte;
+       signal pc_zeile : hzeile;
+       signal pc_char : hbyte;
+       signal pc_done : std_logic;
        -- parser/scanner
        signal do_it, finished : std_logic;
        -- debouncing
@@ -65,6 +71,9 @@ architecture top of calc is
        signal rx_data : std_logic_vector (7 downto 0);
        signal tx_new, tx_done : std_logic;
        signal tx_data : std_logic_vector (7 downto 0);
+
+       signal btn_a_sync : std_logic;
+
 begin
        -- vga/ipcore
        textmode_vga_inst : entity work.textmode_vga(struct)
@@ -143,11 +152,11 @@ begin
                p_write => p_write,
                p_finished => p_finished,
                -- pc communication
-               pc_get =>  '0',
-               pc_spalte => (others => '0'),
-               pc_zeile => (others => '0'),
-               pc_char => open,
-               pc_done => open
+               pc_get =>  pc_get,
+               pc_spalte => pc_spalte,
+               pc_zeile => pc_zeile,
+               pc_char => pc_char,
+               pc_done => pc_done
 
        );
 
@@ -231,6 +240,21 @@ begin
                data_out => rxd_sync
        );
 
+       -- debouncer fuer btn_a
+       btn_a_debounce_inst : debounce
+       generic map (
+               CLK_FREQ => 33330000,
+               TIMEOUT => 1 ms,
+               RESET_VALUE => '1',
+               SYNC_STAGES => 2
+       )
+       port map (
+               sys_clk => sys_clk,
+               sys_res_n => '1',
+               data_in => btn_a,
+               data_out => btn_a_sync
+       );
+
        -- rs232-rx
        rs232rx_inst : entity work.uart_rx(beh)
        generic map (
@@ -259,5 +283,27 @@ begin
                tx_new => tx_new,
                tx_done => tx_done
        );
+
+       pc_com_inst : entity work.pc_communication(beh)
+       port map (
+               sys_clk => sys_clk,
+               sys_res_n => sys_res_n,
+               --button
+               btn_a => btn_a_sync,
+               --uart_tx
+               tx_data => tx_data,
+               tx_new => tx_new,
+               tx_done => tx_done,
+               --uart_rx
+               rx_data => rx_data,
+               rx_new => rx_new,
+               -- History
+               d_zeile => pc_zeile,
+               d_spalte => pc_spalte,
+               d_get => pc_get,
+               d_done => pc_done,
+               d_char => pc_char
+       );
+
 end architecture top;