c2b040193a777c09bdc595c95492b57a2521db87
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

1) -- MIPS I system
2) -- Copyright 2011-2012 Stefan Schuermans <stefan@schuermans.info>
3) -- Copyleft GNU public license V2 or later
4) --          http://www.gnu.org/copyleft/gpl.html
5) 
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

6) LIBRARY ieee;
7) USE ieee.std_logic_1164.all;
8) USE ieee.numeric_std.all;
9) USE work.mips_types.all;
10) 
11) ENTITY e_mips_cmp IS
12)     PORT (
13)         i_cmp: IN  t_cmp;
14)         i_op1: IN  std_logic_vector(31 DOWNTO 0);
15)         i_op2: IN  std_logic_vector(31 DOWNTO 0);
16)         o_res: OUT std_logic
17)     );
18) END ENTITY e_mips_cmp;
19) 
20) ARCHITECTURE a_mips_cmp OF e_mips_cmp IS
21) 
22) BEGIN
23) 
24)     p_cmp: PROCESS(i_cmp, i_op1, i_op2)
25)         VARIABLE v_op1_s: signed(31 DOWNTO 0);
26)         VARIABLE v_op2_s: signed(31 DOWNTO 0);
27)         VARIABLE v_res: boolean;
28)     BEGIN
29)         v_op1_s := signed(i_op1);
30)         v_op2_s := signed(i_op2);
31)         CASE i_cmp IS
32)             WHEN cmp_eq => v_res := i_op1 = i_op2;
33)             WHEN cmp_gez => v_res := v_op1_s >= 0;
34)             WHEN cmp_gtz => v_res := v_op1_s > 0;
35)             WHEN cmp_lez => v_res := v_op1_s <= 0;
36)             WHEN cmp_ltz => v_res := v_op1_s < 0;
37)             WHEN cmp_ne => v_res := i_op1 /= i_op2;
Stefan Schuermans if not comparing, jump is u...

Stefan Schuermans authored 12 years ago

38)             WHEN OTHERS => v_res := true;