a077c55ece90f12ffd2b0a589115566ef4521aa6
Stefan Schuermans compare unit, initial PC ideas

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

33)             WHEN OTHERS => v_res := true;