-- Testbench fuer die Full-System-Simulation
-- Version 1.0 / Lars H. Hahn 16.02.99

-- Es wird die Datei 'eingabe.data' eingelesen
-- die Datei 'ausgabe.data' wird erzeugt

Library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use std.textio.all;
use work.chips.all;

entity tb_system is
end;

architecture tb of tb_system is

signal one, zero : std_logic;
signal nrst, clk, to_flex_rec, to_flex_snd : std_logic;
signal ab_data_rec, ba_data_rec, ab_send_request_rec, ba_send_request_rec, ab_busy_hold_rec, ba_busy_hold_rec : std_logic;
signal ab_data_snd, ba_data_snd, ab_send_request_snd, ba_send_request_snd, ab_busy_hold_snd, ba_busy_hold_snd : std_logic;
signal ac_send_request_rec, ca_send_request_rec, ac_busy_hold_rec, ca_busy_hold_rec : std_logic;
signal ac_send_request_snd, ca_send_request_snd, ac_busy_hold_snd, ca_busy_hold_snd : std_logic;
signal rs232_txd_snd, rs232_rxd_snd, irda_rxda_snd, irda_txd_snd : std_logic;
signal nwe_ram_snd, ncs_ram_snd, nras_ram_snd, ncas_ram_snd : std_logic;
signal rs232_txd_rec, rs232_rxd_rec, irda_rxda_rec, irda_txd_rec : std_logic;
signal nwe_ram_rec, ncs_ram_rec, nras_ram_rec, ncas_ram_rec : std_logic;
signal char_inout_rec, char_inout_snd, data_ram_snd, data_ram_rec : std_logic_vector(7 downto 0);
signal dip_switches : std_ulogic_vector(7 downto 0);
signal address_ram_snd, address_ram_rec : std_ulogic_vector(10 downto 0);
signal baud_rate_select_snd, baud_rate_select_rec: std_ulogic_vector(2 downto 0);

 signal HelloSUB : string (1 to  43) := "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG"; 
 constant T_BAUD : time := 104167 ns; -- 1 / 9600 bps = 104.16666666 us     
 signal      t_s : time := T_BAUD;  
 signal strobe_s : std_ulogic;
 signal    bin_s : std_ulogic_vector (7 downto 0);
 signal    chr_s : character;

   component string2txd
     port(
               t :  in time;       -- T_BAUD = 1/(baud rate)
               s :  in string;     -- text string to send
             txd : out std_ulogic  -- RS232 TxD signal of the string 's'
         );
   end component;

   component rxd2char
     port(
                  t :  in time;                           -- T_BAUD = 1/(baud rate)
          rs232_rxd :  in std_ulogic;                     -- RS232 RxD signal input
                bin : out std_ulogic_vector (7 downto 0); -- binary code
                chr : out character;                      -- character
             strobe : out std_ulogic                      -- strobe signal
          );
   end component;

begin

  my_snd_a: epf10k10lc84a port map -- Kompressor
    (nrst => nrst, clk => clk, nsend_receive => zero, to_flex => to_flex_snd,
    request => ca_send_request_snd, send => ac_send_request_snd, hold => ca_busy_hold_snd, busy => ac_busy_hold_snd,
    request_rsa => ab_send_request_snd, send_rsa => ba_send_request_snd, hold_rsa => ab_busy_hold_snd, busy_rsa => ba_busy_hold_snd,
    char_inout => char_inout_snd, data_in => ba_data_snd, data_out => ab_data_snd);
  
  my_snd_b: epf10k10lc84b port map -- RSA-Verschlüsseln
    (nrst => nrst, clk => clk, nsend_receive => zero, to_flex => to_flex_snd,
    request => ab_send_request_snd, send => ba_send_request_snd, hold => ab_busy_hold_snd, busy => ba_busy_hold_snd,
    char_inout => char_inout_snd, data_in => ab_data_snd, data_out => ba_data_snd);
  
  my_snd_c: epm7160slc84 port map -- IrDA - Sender
    (clk=>clk, nrst=>nrst, baud_rate_select=>baud_rate_select_snd, nsend_receive=>zero, rs232_txd=>rs232_txd_snd, rs232_rxd=>rs232_rxd_snd,
     irda_rxda=>irda_rxda_snd, irda_txd=>irda_txd_snd, nkey=>one, dip_switches=>dip_switches, data=>data_ram_snd, address=>address_ram_snd,
     nwe=>nwe_ram_snd, ncs=>ncs_ram_snd, nras=>nras_ram_snd, ncas=>ncas_ram_snd, to_flex => to_flex_snd, flex_iodata => char_inout_snd,
     flex_busy => ca_busy_hold_snd, flex_request => ac_send_request_snd, flex_hold => ac_busy_hold_snd, flex_send => ca_send_request_snd);
  
  my_rec_a: epf10k10lc84a port map -- Dekompressor
    (nrst => nrst, clk => clk, nsend_receive => one, to_flex => to_flex_rec,
    request => ca_send_request_rec, send => ac_send_request_rec, hold => ca_busy_hold_rec, busy => ac_busy_hold_rec,
    request_rsa => ab_send_request_rec, send_rsa => ba_send_request_rec, hold_rsa => ab_busy_hold_rec, busy_rsa => ba_busy_hold_rec,
    char_inout => char_inout_rec, data_in => ba_data_rec, data_out => ab_data_rec);
  
  my_rec_b: epf10k10lc84b port map -- RSA-Entschlüsseln
    (nrst => nrst, clk => clk, nsend_receive => one, to_flex => to_flex_rec,
    request => ab_send_request_rec, send => ba_send_request_rec, hold => ab_busy_hold_rec, busy => ba_busy_hold_rec,
    char_inout => char_inout_rec, data_in => ab_data_rec, data_out => ba_data_rec);
    
  my_rec_c: epm7160slc84 port map -- IrDa Empfaenger
    (clk=>clk, nrst=>nrst, baud_rate_select=>baud_rate_select_rec, nsend_receive=>one, rs232_txd=>rs232_txd_rec, rs232_rxd=>rs232_rxd_rec,
     irda_rxda=>irda_rxda_rec, irda_txd=>irda_txd_rec, nkey=>one, dip_switches=>dip_switches, data=>data_ram_rec, address=>address_ram_rec,
     nwe=>nwe_ram_rec, ncs=>ncs_ram_rec, nras=>nras_ram_rec, ncas=>ncas_ram_rec, to_flex => to_flex_rec, flex_iodata => char_inout_rec,
     flex_busy => ca_busy_hold_rec, flex_request => ac_send_request_rec, flex_hold => ac_busy_hold_rec, flex_send => ca_send_request_rec);
  
  zero <= '0';
  one <= '1';
  dip_switches <= (others=>'0');
  baud_rate_select_snd <= "010";
  baud_rate_select_rec <= "010";
  
  hsdla_p : process (irda_txd_snd)
            begin
	       if (irda_txd_snd'event and irda_txd_snd='0') then
                   irda_rxda_rec <= '0' after 1 us, '1' after 3.2 us;
	       end if; 
            end process;

   s2txd_i : string2txd port map (t_s, HelloSUB, rs232_txd_snd);
   rxd2c_i : rxd2char   port map (t_s, rs232_rxd_rec, bin_s, chr_s, strobe_s);
    
    
-- Taktfrequenz ( 16,67 MHz = 30.00 ns )
-- Taktfrequenz ( 16,00 MHz = 31.25 ns )
  clk_pro: process
  begin
    clk <= '0';
    wait for 31.25 ns;
    clk <= '1';
    wait for 31.25 ns;
  end process;
  
  nrst_pro: process
  begin
    nrst <= '0';
    wait for 141 ns;
    nrst <= '1';
    wait;
  end process;

end tb;

configuration cfg_tb_system of tb_system is
  for tb
  end for;
end;

<div align="center"><br /><script type="text/javascript"><!--
google_ad_client = "pub-7293844627074885";
//468x60, Created at 07. 11. 25
google_ad_slot = "8619794253";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />&nbsp;</div>