Rework decode2

The decode2 stage was spaghetti code and needed cleaning up.
Create a series of functions to pull fields from a ppc instruction
and also a series of helpers to extract values for the execution
units.

As suggested by Paul, we should pass all signals to the execution
units and only set the valid signal conditionally, which should
use less resources.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
nia-debug
Anton Blanchard 5 years ago committed by Anton Blanchard
parent d1fdc286c4
commit 5e140298a5

@ -17,19 +17,18 @@ core.o: common.o wishbone_types.o fetch1.o fetch2.o decode1.o decode2.o register
cr_file.o: common.o cr_file.o: common.o
crhelpers.o: common.o crhelpers.o: common.o
decode1.o: common.o decode_types.o decode1.o: common.o decode_types.o
decode2.o: decode_types.o common.o helpers.o decode2.o: decode_types.o common.o helpers.o insn_helpers.o
decode_types.o: decode_types.o:
execute1.o: decode_types.o common.o helpers.o crhelpers.o ppc_fx_insns.o sim_console.o execute1.o: decode_types.o common.o helpers.o crhelpers.o ppc_fx_insns.o sim_console.o
execute2.o: common.o crhelpers.o ppc_fx_insns.o execute2.o: common.o crhelpers.o ppc_fx_insns.o
fetch1.o: common.o fetch1.o: common.o
fetch2.o: common.o wishbone_types.o fetch2.o: common.o wishbone_types.o
fetch_tb.o: common.o wishbone_types.o fetch.o
glibc_random_helpers.o: glibc_random_helpers.o:
glibc_random.o: glibc_random_helpers.o glibc_random.o: glibc_random_helpers.o
helpers.o: helpers.o:
insn_helpers.o:
loadstore1.o: common.o loadstore1.o: common.o
loadstore2.o: common.o helpers.o wishbone_types.o loadstore2.o: common.o helpers.o wishbone_types.o
loadstore_tb.o: common.o simple_ram_types.o simple_ram.o loadstore1.o loadstore2.o
multiply_tb.o: common.o glibc_random.o ppc_fx_insns.o multiply.o multiply_tb.o: common.o glibc_random.o ppc_fx_insns.o multiply.o
multiply.o: common.o decode_types.o ppc_fx_insns.o crhelpers.o multiply.o: common.o decode_types.o ppc_fx_insns.o crhelpers.o
ppc_fx_insns.o: helpers.o ppc_fx_insns.o: helpers.o

@ -41,9 +41,9 @@ package common is
read_reg2: std_ulogic_vector(4 downto 0); read_reg2: std_ulogic_vector(4 downto 0);
read_data1: std_ulogic_vector(63 downto 0); read_data1: std_ulogic_vector(63 downto 0);
read_data2: std_ulogic_vector(63 downto 0); read_data2: std_ulogic_vector(63 downto 0);
const1: std_ulogic_vector(23 downto 0); const1: std_ulogic_vector(7 downto 0);
const2: std_ulogic_vector(6 downto 0); const2: std_ulogic_vector(5 downto 0);
const3: std_ulogic_vector(6 downto 0); const3: std_ulogic_vector(4 downto 0);
cr: std_ulogic_vector(31 downto 0); cr: std_ulogic_vector(31 downto 0);
lr: std_ulogic; lr: std_ulogic;
rc: std_ulogic; rc: std_ulogic;

@ -6,6 +6,7 @@ library work;
use work.decode_types.all; use work.decode_types.all;
use work.common.all; use work.common.all;
use work.helpers.all; use work.helpers.all;
use work.insn_helpers.all;


entity decode2 is entity decode2 is
port ( port (
@ -28,38 +29,141 @@ end entity decode2;
architecture behaviour of decode2 is architecture behaviour of decode2 is
signal d : Decode1ToDecode2Type; signal d : Decode1ToDecode2Type;


alias insn_rs : std_ulogic_vector(4 downto 0) is d.insn(25 downto 21); type decode_input_reg_t is record
alias insn_rt : std_ulogic_vector(4 downto 0) is d.insn(25 downto 21); reg_valid : std_ulogic;
alias insn_ra : std_ulogic_vector(4 downto 0) is d.insn(20 downto 16); reg : std_ulogic_vector(4 downto 0);
alias insn_rb : std_ulogic_vector(4 downto 0) is d.insn(15 downto 11); data : std_ulogic_vector(63 downto 0);
alias insn_si : std_ulogic_vector(15 downto 0) is d.insn(15 downto 0); end record;
alias insn_ui : std_ulogic_vector(15 downto 0) is d.insn(15 downto 0);
alias insn_l : std_ulogic is d.insn(21); function decode_input_reg_a (t : input_reg_a_t; insn_in : std_ulogic_vector(31 downto 0);
alias insn_sh32 : std_ulogic_vector(4 downto 0) is d.insn(15 downto 11); reg_data : std_ulogic_vector(63 downto 0)) return decode_input_reg_t is
alias insn_mb32 : std_ulogic_vector(4 downto 0) is d.insn(10 downto 6); begin
alias insn_me32 : std_ulogic_vector(4 downto 0) is d.insn(5 downto 1); case t is
alias insn_li : std_ulogic_vector(23 downto 0) is d.insn(25 downto 2); when RA =>
alias insn_lk : std_ulogic is d.insn(0); return ('1', insn_ra(insn_in), reg_data);
alias insn_rc : std_ulogic is d.insn(0); when RA_OR_ZERO =>
alias insn_bd : std_ulogic_vector(13 downto 0) is d.insn(15 downto 2); return ('1', insn_ra(insn_in), ra_or_zero(reg_data, insn_ra(insn_in)));
alias insn_bf : std_ulogic_vector(2 downto 0) is d.insn(25 downto 23); when RS =>
alias insn_fxm : std_ulogic_vector(7 downto 0) is d.insn(19 downto 12); return ('1', insn_rs(insn_in), reg_data);
alias insn_bo : std_ulogic_vector(4 downto 0) is d.insn(25 downto 21); when NONE =>
alias insn_bi : std_ulogic_vector(4 downto 0) is d.insn(20 downto 16); return ('0', (others => '0'), (others => '0'));
alias insn_bh : std_ulogic_vector(1 downto 0) is d.insn(12 downto 11); end case;
alias insn_d : std_ulogic_vector(15 downto 0) is d.insn(15 downto 0); end;
alias insn_ds : std_ulogic_vector(13 downto 0) is d.insn(15 downto 2);
alias insn_to : std_ulogic_vector(4 downto 0) is d.insn(25 downto 21); function decode_input_reg_b (t : input_reg_b_t; insn_in : std_ulogic_vector(31 downto 0);
alias insn_bc : std_ulogic_vector(4 downto 0) is d.insn(10 downto 6); reg_data : std_ulogic_vector(63 downto 0)) return decode_input_reg_t is

begin
-- can't use an alias for these case t is
signal insn_sh : std_ulogic_vector(5 downto 0); when RB =>
signal insn_me : std_ulogic_vector(5 downto 0); return ('1', insn_rb(insn_in), reg_data);
signal insn_mb : std_ulogic_vector(5 downto 0); when RS =>
return ('1', insn_rs(insn_in), reg_data);
when CONST_UI =>
return ('0', (others => '0'), std_ulogic_vector(resize(unsigned(insn_ui(insn_in)), 64)));
when CONST_SI =>
return ('0', (others => '0'), std_ulogic_vector(resize(signed(insn_si(insn_in)), 64)));
when CONST_SI_HI =>
return ('0', (others => '0'), std_ulogic_vector(resize(signed(insn_si(insn_in)) & x"0000", 64)));
when CONST_UI_HI =>
return ('0', (others => '0'), std_ulogic_vector(resize(unsigned(insn_si(insn_in)) & x"0000", 64)));
when CONST_LI =>
return ('0', (others => '0'), std_ulogic_vector(resize(signed(insn_li(insn_in)) & "00", 64)));
when CONST_BD =>
return ('0', (others => '0'), std_ulogic_vector(resize(signed(insn_bd(insn_in)) & "00", 64)));
when CONST_DS =>
return ('0', (others => '0'), std_ulogic_vector(resize(signed(insn_ds(insn_in)) & "00", 64)));
when NONE =>
return ('0', (others => '0'), (others => '0'));
end case;
end;

function decode_input_reg_c (t : input_reg_c_t; insn_in : std_ulogic_vector(31 downto 0);
reg_data : std_ulogic_vector(63 downto 0)) return decode_input_reg_t is
begin
case t is
when RS =>
return ('1', insn_rs(insn_in), reg_data);
when NONE =>
return ('0', (others => '0'), (others => '0'));
end case;
end;

function decode_output_reg (t : output_reg_a_t; insn_in : std_ulogic_vector(31 downto 0)) return std_ulogic_vector is
begin
case t is
when RT =>
return insn_rt(insn_in);
when RA =>
return insn_ra(insn_in);
when NONE =>
return "00000";
end case;
end;

function decode_const_a (t : constant_a_t; insn_in : std_ulogic_vector(31 downto 0)) return std_ulogic_vector is
begin
case t is
when SH =>
return "00" & insn_sh(insn_in);
when SH32 =>
return "000" & insn_sh32(insn_in);
when FXM =>
return insn_fxm(insn_in);
when BO =>
return "000" & insn_bo(insn_in);
when BF =>
return "00000" & insn_bf(insn_in);
when TOO =>
return "000" & insn_to(insn_in);
when BC =>
return "000" & insn_bc(insn_in);
when NONE =>
return "00000000";
end case;
end;

function decode_const_b (t : constant_b_t; insn_in : std_ulogic_vector(31 downto 0)) return std_ulogic_vector is
begin
case t is
when MB =>
return insn_mb(insn_in);
when ME =>
return insn_me(insn_in);
when MB32 =>
return "0" & insn_mb32(insn_in);
when BI =>
return "0" & insn_bi(insn_in);
when L =>
return "00000" & insn_l(insn_in);
when NONE =>
return "000000";
end case;
end;

function decode_const_c (t : constant_c_t; insn_in : std_ulogic_vector(31 downto 0)) return std_ulogic_vector is
begin
case t is
when ME32 =>
return insn_me32(insn_in);
when BH =>
return "000" & insn_bh(insn_in);
when NONE =>
return "00000";
end case;
end;

function decode_rc (t : rc_t; insn_in : std_ulogic_vector(31 downto 0)) return std_ulogic is
begin
case t is
when RC =>
return insn_rc(insn_in);
when ONE =>
return '1';
when NONE =>
return '0';
end case;
end;
begin begin
insn_sh <= d.insn(1) & d.insn(15 downto 11);
insn_me <= d.insn(5) & d.insn(10 downto 6);
insn_mb <= d.insn(5) & d.insn(10 downto 6);


decode2_0: process(clk) decode2_0: process(clk)
begin begin
@ -68,21 +172,24 @@ begin
end if; end if;
end process; end process;


r_out.read1_reg <= insn_ra when (d.decode.input_reg_a = RA) else r_out.read1_reg <= insn_ra(d.insn) when (d.decode.input_reg_a = RA) else
insn_ra when d.decode.input_reg_a = RA_OR_ZERO else insn_ra(d.insn) when d.decode.input_reg_a = RA_OR_ZERO else
insn_rs when d.decode.input_reg_a = RS else insn_rs(d.insn) when d.decode.input_reg_a = RS else
(others => '0'); (others => '0');


r_out.read2_reg <= insn_rb when d.decode.input_reg_b = RB else r_out.read2_reg <= insn_rb(d.insn) when d.decode.input_reg_b = RB else
insn_rs when d.decode.input_reg_b = RS else insn_rs(d.insn) when d.decode.input_reg_b = RS else
(others => '0'); (others => '0');


r_out.read3_reg <= insn_rs when d.decode.input_reg_c = RS else r_out.read3_reg <= insn_rs(d.insn) when d.decode.input_reg_c = RS else
(others => '0'); (others => '0');


decode2_1: process(all) decode2_1: process(all)
variable mul_a : std_ulogic_vector(63 downto 0); variable mul_a : std_ulogic_vector(63 downto 0);
variable mul_b : std_ulogic_vector(63 downto 0); variable mul_b : std_ulogic_vector(63 downto 0);
variable decoded_reg_a : decode_input_reg_t;
variable decoded_reg_b : decode_input_reg_t;
variable decoded_reg_c : decode_input_reg_t;
begin begin
e_out <= Decode2ToExecute1Init; e_out <= Decode2ToExecute1Init;
l_out <= Decode2ToLoadStore1Init; l_out <= Decode2ToLoadStore1Init;
@ -91,122 +198,52 @@ begin
mul_a := (others => '0'); mul_a := (others => '0');
mul_b := (others => '0'); mul_b := (others => '0');


e_out.nia <= d.nia;
l_out.nia <= d.nia;
m_out.nia <= d.nia;

--e_out.input_cr <= d.decode.input_cr; --e_out.input_cr <= d.decode.input_cr;
--m_out.input_cr <= d.decode.input_cr; --m_out.input_cr <= d.decode.input_cr;
--e_out.output_cr <= d.decode.output_cr; --e_out.output_cr <= d.decode.output_cr;


e_out.cr <= c_in.read_cr_data; decoded_reg_a := decode_input_reg_a (d.decode.input_reg_a, d.insn, r_in.read1_data);

decoded_reg_b := decode_input_reg_b (d.decode.input_reg_b, d.insn, r_in.read2_data);
e_out.input_carry <= d.decode.input_carry; decoded_reg_c := decode_input_reg_c (d.decode.input_reg_c, d.insn, r_in.read3_data);
e_out.output_carry <= d.decode.output_carry;

if d.decode.lr then
e_out.lr <= insn_lk;
end if;

-- XXX This is getting too complicated. Use variables and assign to each unit later


case d.decode.unit is case d.decode.unit is
when ALU => when ALU =>
e_out.insn_type <= d.decode.insn_type;
e_out.valid <= d.valid; e_out.valid <= d.valid;
when LDST => when LDST =>
l_out.valid <= d.valid; l_out.valid <= d.valid;
when MUL => when MUL =>
m_out.insn_type <= d.decode.insn_type;
m_out.valid <= d.valid; m_out.valid <= d.valid;
when NONE => when NONE =>
e_out.insn_type <= OP_ILLEGAL;
e_out.valid <= d.valid; e_out.valid <= d.valid;
e_out.insn_type <= OP_ILLEGAL;
end case; end case;


-- required for bypassing -- execute unit
case d.decode.input_reg_a is e_out.nia <= d.nia;
when RA => e_out.insn_type <= d.decode.insn_type;
e_out.read_reg1 <= insn_ra; e_out.read_reg1 <= decoded_reg_a.reg;
l_out.update_reg <= insn_ra; e_out.read_data1 <= decoded_reg_a.data;
when RA_OR_ZERO => e_out.read_reg2 <= decoded_reg_b.reg;
e_out.read_reg1 <= insn_ra; e_out.read_data2 <= decoded_reg_b.data;
l_out.update_reg <= insn_ra; e_out.write_reg <= decode_output_reg(d.decode.output_reg_a, d.insn);
when RS => e_out.rc <= decode_rc(d.decode.rc, d.insn);
e_out.read_reg1 <= insn_rs; e_out.cr <= c_in.read_cr_data;
when NONE => e_out.input_carry <= d.decode.input_carry;
e_out.read_reg1 <= (others => '0'); e_out.output_carry <= d.decode.output_carry;
l_out.update_reg <= (others => '0'); if d.decode.lr then
end case; e_out.lr <= insn_lk(d.insn);

end if;
-- required for bypassing e_out.const1 <= decode_const_a(d.decode.const_a, d.insn);
case d.decode.input_reg_b is e_out.const2 <= decode_const_b(d.decode.const_b, d.insn);
when RB => e_out.const3 <= decode_const_c(d.decode.const_c, d.insn);
e_out.read_reg2 <= insn_rb;
when RS =>
e_out.read_reg2 <= insn_rs;
when others =>
e_out.read_reg2 <= (others => '0');
end case;

-- required for bypassing
--case d.decode.input_reg_c is
--when RS =>
--e_out.read_reg3 <= insn_rs;
--when NONE =>
--e_out.read_reg3 <= (others => '0');
--end case;

case d.decode.input_reg_a is
when RA =>
e_out.read_data1 <= r_in.read1_data;
mul_a := r_in.read1_data;
l_out.addr1 <= r_in.read1_data;
when RA_OR_ZERO =>
e_out.read_data1 <= ra_or_zero(r_in.read1_data, insn_ra);
l_out.addr1 <= ra_or_zero(r_in.read1_data, insn_ra);
when RS =>
e_out.read_data1 <= r_in.read1_data;
when NONE =>
e_out.read_data1 <= (others => '0');
mul_a := (others => '0');
end case;

case d.decode.input_reg_b is
when RB =>
e_out.read_data2 <= r_in.read2_data;
mul_b := r_in.read2_data;
l_out.addr2 <= r_in.read2_data;
when RS =>
e_out.read_data2 <= r_in.read2_data;
when CONST_UI =>
e_out.read_data2 <= std_ulogic_vector(resize(unsigned(insn_ui), 64));
when CONST_SI =>
e_out.read_data2 <= std_ulogic_vector(resize(signed(insn_si), 64));
l_out.addr2 <= std_ulogic_vector(resize(signed(insn_si), 64));
mul_b := std_ulogic_vector(resize(signed(insn_si), 64));
when CONST_SI_HI =>
e_out.read_data2 <= std_ulogic_vector(resize(signed(insn_si) & x"0000", 64));
when CONST_UI_HI =>
e_out.read_data2 <= std_ulogic_vector(resize(unsigned(insn_si) & x"0000", 64));
when CONST_LI =>
e_out.read_data2 <= std_ulogic_vector(resize(signed(insn_li) & "00", 64));
when CONST_BD =>
e_out.read_data2 <= std_ulogic_vector(resize(signed(insn_bd) & "00", 64));
when CONST_DS =>
l_out.addr2 <= std_ulogic_vector(resize(signed(insn_ds) & "00", 64));
when NONE =>
e_out.read_data2 <= (others => '0');
l_out.addr2 <= (others => '0');
mul_b := (others => '0');
end case;


case d.decode.input_reg_c is -- multiply unit
when RS => m_out.nia <= d.nia;
l_out.data <= r_in.read3_data; m_out.insn_type <= d.decode.insn_type;
when NONE => mul_a := decoded_reg_a.data;
l_out.data <= (others => '0'); mul_b := decoded_reg_b.data;
end case; m_out.write_reg <= decode_output_reg(d.decode.output_reg_a, d.insn);
m_out.rc <= decode_rc(d.decode.rc, d.insn);


if d.decode.mul_32bit = '1' then if d.decode.mul_32bit = '1' then
if d.decode.mul_signed = '1' then if d.decode.mul_signed = '1' then
@ -228,76 +265,14 @@ begin
end if; end if;
end if; end if;


case d.decode.const_a is -- load/store unit
when SH => l_out.nia <= d.nia;
e_out.const1(insn_sh'range) <= insn_sh; l_out.update_reg <= decoded_reg_a.reg;
when SH32 => l_out.addr1 <= decoded_reg_a.data;
e_out.const1(insn_sh32'range) <= insn_sh32; l_out.addr2 <= decoded_reg_b.data;
when FXM => l_out.data <= decoded_reg_c.data;
e_out.const1(insn_fxm'range) <= insn_fxm; l_out.write_reg <= decode_output_reg(d.decode.output_reg_a, d.insn);
when BO =>
e_out.const1(insn_bo'range)<= insn_bo;
when BF =>
e_out.const1(insn_bf'range)<= insn_bf;
when TOO =>
e_out.const1(insn_to'range)<= insn_to;
when BC =>
e_out.const1(insn_bc'range)<= insn_bc;
when NONE =>
e_out.const1 <= (others => '0');
end case;

case d.decode.const_b is
when MB =>
e_out.const2(insn_mb'range) <= insn_mb;
when ME =>
e_out.const2(insn_me'range) <= insn_me;
when MB32 =>
e_out.const2(insn_mb32'range) <= insn_mb32;
when BI =>
e_out.const2(insn_bi'range) <= insn_bi;
when L =>
e_out.const2(0) <= insn_l;
when NONE =>
e_out.const2 <= (others => '0');
end case;

case d.decode.const_c is
when ME32 =>
e_out.const3(insn_me32'range) <= insn_me32;
when BH =>
e_out.const3(insn_bh'range) <= insn_bh;
when NONE =>
e_out.const3 <= (others => '0');
end case;

case d.decode.output_reg_a is
when RT =>
e_out.write_reg <= insn_rt;
l_out.write_reg <= insn_rt;
m_out.write_reg <= insn_rt;
when RA =>
e_out.write_reg <= insn_ra;
l_out.write_reg <= insn_ra;
when NONE =>
e_out.write_reg <= (others => '0');
l_out.write_reg <= (others => '0');
m_out.write_reg <= (others => '0');
end case;

case d.decode.rc is
when RC =>
e_out.rc <= insn_rc;
m_out.rc <= insn_rc;
when ONE =>
e_out.rc <= '1';
m_out.rc <= '1';
when NONE =>
e_out.rc <= '0';
m_out.rc <= '0';
end case;


-- load/store specific signals
if d.decode.insn_type = OP_LOAD then if d.decode.insn_type = OP_LOAD then
l_out.load <= '1'; l_out.load <= '1';
else else

@ -0,0 +1,163 @@
library ieee;
use ieee.std_logic_1164.all;

package insn_helpers is
function insn_rs (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_rt (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_ra (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_rb (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_si (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_ui (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_l (insn_in : std_ulogic_vector) return std_ulogic;
function insn_sh32 (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_mb32 (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_me32 (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_li (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_lk (insn_in : std_ulogic_vector) return std_ulogic;
function insn_rc (insn_in : std_ulogic_vector) return std_ulogic;
function insn_bd (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_bf (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_fxm (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_bo (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_bi (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_bh (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_d (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_ds (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_to (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_bc (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_sh (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_me (insn_in : std_ulogic_vector) return std_ulogic_vector;
function insn_mb (insn_in : std_ulogic_vector) return std_ulogic_vector;
end package insn_helpers;

package body insn_helpers is
function insn_rs (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(25 downto 21);
end;

function insn_rt (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(25 downto 21);
end;

function insn_ra (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(20 downto 16);
end;

function insn_rb (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 11);
end;

function insn_si (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 0);
end;

function insn_ui (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 0);
end;

function insn_l (insn_in : std_ulogic_vector) return std_ulogic is
begin
return insn_in(21);
end;

function insn_sh32 (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 11);
end;

function insn_mb32 (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(10 downto 6);
end;

function insn_me32 (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(5 downto 1);
end;

function insn_li (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(25 downto 2);
end;

function insn_lk (insn_in : std_ulogic_vector) return std_ulogic is
begin
return insn_in(0);
end;

function insn_rc (insn_in : std_ulogic_vector) return std_ulogic is
begin
return insn_in(0);
end;

function insn_bd (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 2);
end;

function insn_bf (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(25 downto 23);
end;

function insn_fxm (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(19 downto 12);
end;

function insn_bo (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(25 downto 21);
end;

function insn_bi (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(20 downto 16);
end;

function insn_bh (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(12 downto 11);
end;

function insn_d (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 0);
end;

function insn_ds (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(15 downto 2);
end;

function insn_to (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(25 downto 21);
end;

function insn_bc (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(10 downto 6);
end;

function insn_sh (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(1) & insn_in(15 downto 11);
end;

function insn_me (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(5) & insn_in(10 downto 6);
end;

function insn_mb (insn_in : std_ulogic_vector) return std_ulogic_vector is
begin
return insn_in(5) & insn_in(10 downto 6);
end;
end package body insn_helpers;

@ -25,6 +25,7 @@ filesets:
- multiply.vhdl - multiply.vhdl
- writeback.vhdl - writeback.vhdl
- wishbone_arbiter.vhdl - wishbone_arbiter.vhdl
- insn_helpers.vhdl
- core.vhdl - core.vhdl
file_type : vhdlSource-2008 file_type : vhdlSource-2008



Loading…
Cancel
Save