Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.numeric_std.all;
- use ieee.std_logic_textio.all;
- library std;
- use std.textio.all;
- library work;
- use work.mipsISA.all;
- entity aluCtrlExt_tb is
- end aluCtrlExt_tb;
- architecture behavioral of aluCtrlExt_tb is
- signal aluop : std_logic_vector(1 downto 0);
- signal f : std_logic_vector(5 downto 0);
- signal op_uut: std_logic_vector(3 downto 0);
- signal jr_uut: std_logic;
- type type_f_array is array(natural range <>) of std_logic_vector(5 downto 0);
- type type_aluOp_array is array (natural range <>) of std_logic_vector(1 downto 0);
- type type_op_array is array(natural range <>) of std_logic_vector(3 downto 0);
- type type_jr_array is array(natural range <>) of std_logic;
- constant aluOp_array : type_aluOp_array := ("00", "00", "00", "01", "01","01", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "11" );
- constant f_array : type_f_array := ("100011", "101011", "111000", "000100", "000000", "010101", "100001", "100000", "000000", "100011", "100010", "100100", "100101", "100111", "001000", "111001", "101011", "101010", "111100", "111111", "101010");
- constant op_array : type_op_array := ("0010", "0010", "0010", "0110", "0110", "0110", "0001", "0001", "0001", "0110", "0110", "0000", "0001", "1100", "0001", "0001", "0111", "0111", "0001", "1101", "1111");
- constant jr_array : type_jr_array := ('0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0');
- begin
- uut: entity work.aluCtrlExt(behavioral)
- port map(aluOp => aluop,
- f => f,
- operation => op_uut,
- jr => jr_uut);
- test:process
- variable numErrors : integer := 0;
- variable l : line;
- begin
- for i in 0 to 15 loop
- aluOp <= aluOp_array(i);
- f <= f_array(i);
- wait for 5 ns;
- if op_uut /= op_array(i) then
- write(l, time'image(now));
- write(l, string'(": Falsches Ergebnis am AluCtrl-Modul: operation = """));
- write(l, op_uut);
- write(l, string'(""" (erwartet: """));
- write(l, op_array(i));
- write(l, string'(""")"));
- writeline(OUTPUT, l);
- numErrors := numErrors + 1;
- end if;
- if jr_uut /= jr_array(i) then
- write(l, time'image(now));
- write(l, string'(": Falsches Ergebnis am AluCtrl-Modul: jr = """));
- write(l, jr_uut);
- write(l, string'(""" (erwartet: """));
- write(l, jr_array(i));
- write(l, string'(""")"));
- writeline(OUTPUT, l);
- numErrors := numErrors + 1;
- end if;
- wait for 5 ns;
- end loop;
- if numErrors = 0 then
- report "Das AluCtrlEXt-Modul funktioniert einwandfrei! (Punktzahl: 2/2)" severity note;
- else
- write(l, string'("Sie haben "));
- write(l, numErrors);
- write(l, string'(" Fehler "));
- report "Das AluCtrlExt-Modul ist fehlerhaft! (Punktzahl: 0/2)" severity failure;
- end if;
- wait;
- end process ;
- end behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement