function cmp_one_byte(a, b: std_ulogic_vector(7 downto 0)) return std_ulogic_vector;
- function ppc_signed_compare(a, b: signed(63 downto 0)) return std_ulogic_vector;
- function ppc_unsigned_compare(a, b: unsigned(63 downto 0)) return std_ulogic_vector;
+ function ppc_signed_compare(a, b: signed(63 downto 0); so: std_ulogic) return std_ulogic_vector;
+ function ppc_unsigned_compare(a, b: unsigned(63 downto 0); so: std_ulogic) return std_ulogic_vector;
function ra_or_zero(ra: std_ulogic_vector(63 downto 0); reg: std_ulogic_vector(4 downto 0)) return std_ulogic_vector;
return ret;
end;
- function ppc_signed_compare(a, b: signed(63 downto 0)) return std_ulogic_vector is
- variable ret: std_ulogic_vector(3 downto 0);
+ function ppc_signed_compare(a, b: signed(63 downto 0); so: std_ulogic) return std_ulogic_vector is
+ variable ret: std_ulogic_vector(2 downto 0);
begin
if a < b then
- ret := "1000";
+ ret := "100";
elsif a > b then
- ret := "0100";
+ ret := "010";
else
- ret := "0010";
+ ret := "001";
end if;
- return ret;
+ return ret & so;
end;
- function ppc_unsigned_compare(a, b: unsigned(63 downto 0)) return std_ulogic_vector is
- variable ret: std_ulogic_vector(3 downto 0);
+ function ppc_unsigned_compare(a, b: unsigned(63 downto 0); so: std_ulogic) return std_ulogic_vector is
+ variable ret: std_ulogic_vector(2 downto 0);
begin
if a < b then
- ret := "1000";
+ ret := "100";
elsif a > b then
- ret := "0100";
+ ret := "010";
else
- ret := "0010";
+ ret := "001";
end if;
- return ret;
+ return ret & so;
end;
function ra_or_zero(ra: std_ulogic_vector(63 downto 0); reg: std_ulogic_vector(4 downto 0)) return std_ulogic_vector is
function ppc_mulhw (ra, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector;
function ppc_mulhwu (ra, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector;
- function ppc_cmpi (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0)) return std_ulogic_vector;
- function ppc_cmp (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector;
- function ppc_cmpli (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0)) return std_ulogic_vector;
- function ppc_cmpl (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector;
+ function ppc_cmpi (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0);
+ so: std_ulogic) return std_ulogic_vector;
+ function ppc_cmp (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0);
+ so: std_ulogic) return std_ulogic_vector;
+ function ppc_cmpli (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0);
+ so: std_ulogic) return std_ulogic_vector;
+ function ppc_cmpl (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0);
+ so: std_ulogic) return std_ulogic_vector;
function ppc_cmpb (rs, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector;
return std_ulogic_vector(tmp(63 downto 32)) & std_ulogic_vector(tmp(63 downto 32));
end;
- function ppc_cmpi (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0)) return std_ulogic_vector is
+ function ppc_cmpi (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0);
+ so: std_ulogic) return std_ulogic_vector is
variable tmp: signed(ra'range);
begin
tmp := signed(ra);
tmp := resize(signed(ra(31 downto 0)), tmp'length);
end if;
- return ppc_signed_compare(tmp, resize(signed(si), tmp'length));
+ return ppc_signed_compare(tmp, resize(signed(si), tmp'length), so);
end;
- function ppc_cmp (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector is
+ function ppc_cmp (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0);
+ so: std_ulogic) return std_ulogic_vector is
variable tmpa, tmpb: signed(ra'range);
begin
tmpa := signed(ra);
tmpb := resize(signed(rb(31 downto 0)), ra'length);
end if;
- return ppc_signed_compare(tmpa, tmpb);
+ return ppc_signed_compare(tmpa, tmpb, so);
end;
- function ppc_cmpli (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0)) return std_ulogic_vector is
+ function ppc_cmpli (l: std_ulogic; ra: std_ulogic_vector(63 downto 0); si: std_ulogic_vector(15 downto 0);
+ so: std_ulogic) return std_ulogic_vector is
variable tmp: unsigned(ra'range);
begin
tmp := unsigned(ra);
tmp := resize(unsigned(ra(31 downto 0)), tmp'length);
end if;
- return ppc_unsigned_compare(tmp, resize(unsigned(si), tmp'length));
+ return ppc_unsigned_compare(tmp, resize(unsigned(si), tmp'length), so);
end;
- function ppc_cmpl (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector is
+ function ppc_cmpl (l: std_ulogic; ra, rb: std_ulogic_vector(63 downto 0);
+ so: std_ulogic) return std_ulogic_vector is
variable tmpa, tmpb: unsigned(ra'range);
begin
tmpa := unsigned(ra);
tmpb := resize(unsigned(rb(31 downto 0)), ra'length);
end if;
- return ppc_unsigned_compare(tmpa, tmpb);
+ return ppc_unsigned_compare(tmpa, tmpb, so);
end;
function ppc_cmpb (rs, rb: std_ulogic_vector(63 downto 0)) return std_ulogic_vector is