Advertisement
Jupakez

Untitled

Nov 3rd, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 4.16 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company: BSUIR
  3. -- Engineer: Alexander Volchkov
  4. --
  5. -- Create Date: 27.09.2018 14:32:22
  6. -- Design Name:
  7. -- Module Name: test_bench_serial - Behavioral
  8. -- Project Name: Lab_3 (var 14)
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24. use ieee.std_logic_textio.ALL;
  25. use std.textio.ALL;
  26.  
  27. -- Uncomment the following library declaration if using
  28. -- arithmetic functions with Signed or Unsigned values
  29. --use IEEE.NUMERIC_STD.ALL;
  30.  
  31. -- Uncomment the following library declaration if instantiating
  32. -- any Xilinx leaf cells in this code.
  33. --library UNISIM;
  34. --use UNISIM.VComponents.all;
  35.  
  36. entity test_bench_serial is
  37. --  Port ( );
  38. end test_bench_serial;
  39.  
  40. architecture arch_1 of test_bench_serial is
  41. file filedest : TEXT open WRITE_MODE is "test.txt";
  42. component look_ahead_carry_serial
  43.   port (
  44.     n_G0, n_G1, n_G2, n_G3 : in std_logic;
  45.     n_P0, n_P1, n_P2, n_P3 : in std_logic;
  46.     Cn                     : in std_logic;
  47.     Cn_x, Cn_y, Cn_z       : out std_logic;
  48.     n_G, n_P               : out std_logic
  49.   );
  50.   end component;
  51.  
  52.   signal n_G0    : std_logic                    := '0';
  53.   signal n_G1    : std_logic                    := '0';
  54.   signal n_G2    : std_logic                    := '0';
  55.   signal n_G3    : std_logic                    := '0';
  56.   signal n_P0    : std_logic                    := '0';
  57.   signal n_P1    : std_logic                    := '0';
  58.   signal n_P2    : std_logic                    := '0';
  59.   signal n_P3    : std_logic                    := '0';
  60.   signal Cn      : std_logic                    := '0';
  61.   signal Cn_x    : std_logic                    := '0';
  62.   signal Cn_y    : std_logic                    := '0';
  63.   signal Cn_z    : std_logic                    := '0';
  64.   signal n_G     : std_logic                    := '0';
  65.   signal n_P     : std_logic                    := '0';
  66.   signal ref_out : std_logic_vector(4 downto 0) := "00000";
  67.   signal cur_out : std_logic_vector(4 downto 0) := "00000";
  68.  
  69. begin
  70.   uut: look_ahead_carry_serial port map (
  71.                                    n_G0 => n_G0,
  72.                                    n_G1 => n_G1,
  73.                                    n_G2 => n_G2,
  74.                                    n_G3 => n_G3,
  75.                                    n_P0 => n_P0,
  76.                                    n_P1 => n_P1,
  77.                                    n_P2 => n_P2,
  78.                                    n_P3 => n_P3,
  79.                                    Cn   => Cn,
  80.                                    Cn_x => Cn_x,
  81.                                    Cn_y => Cn_y,
  82.                                    Cn_z => Cn_z,
  83.                                    n_G  => n_G,
  84.                                    n_P  => n_P );
  85.  
  86.   n_G0 <= not n_G0 after 2            ns;
  87.   n_G1 <= not n_G1 after 4            ns;
  88.   n_G2 <= not n_G2 after 8            ns;
  89.   n_G3 <= not n_G3 after 16           ns;
  90.   n_P0 <= not n_P0 after 32           ns;
  91.   n_P1 <= not n_P1 after 64           ns;
  92.   n_P2 <= not n_P2 after 128          ns;
  93.   n_P3 <= not n_P3 after 256          ns;
  94.   Cn   <= not Cn   after 512          ns;
  95.  
  96.    process
  97.         variable current_line : line;
  98.         variable v            : std_logic_vector(13 downto 0);
  99.         variable i            : integer := 0;
  100.    begin
  101.         if i = 0 then          
  102.             wait for 1 ns;
  103.         else
  104.             wait for 2 ns;
  105.         end if;
  106.            
  107.         v(0)  :=  n_G0;
  108.         v(1)  :=  n_G1;
  109.         v(2)  :=  n_G2;
  110.         v(3)  :=  n_G3;
  111.         v(4)  :=  n_P0;
  112.         v(5)  :=  n_P1;
  113.         v(6)  :=  n_P2;
  114.         v(7)  :=  n_P3;
  115.         v(8)  :=  Cn  ;
  116.         v(9 ) :=  Cn_x;
  117.         v(10) :=  Cn_y;
  118.         v(11) :=  Cn_z;
  119.         v(12) :=  n_G ;
  120.         v(13) :=  n_P ;
  121.        
  122.         if i < 513 then
  123.           write(current_line, v, right, 14);
  124.           writeline(filedest, current_line);
  125.         end if;
  126.         i := i + 1;
  127.    end process;
  128. end arch_1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement