Line 65... |
Line 65... |
-- 002c a2820000 sb $v0,0($s4)
|
-- 002c a2820000 sb $v0,0($s4)
|
-- 0030 340a0041 li $t2,0x41
|
-- 0030 340a0041 li $t2,0x41
|
-- 0034 340b0042 li $t3,0x42
|
-- 0034 340b0042 li $t3,0x42
|
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
library ieee;
|
library ieee;
|
|
use work.mlite_pack.all;
|
|
--library ieee, mlite_lib;
|
|
--use mlite_lib.mlite_pack.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use work.mlite_pack.all;
|
|
|
|
entity mlite_cpu is
|
entity mlite_cpu is
|
generic(memory_type : string := "ALTERA";
|
generic(memory_type : string := "DUAL_PORT_XILINX_XC4000XLA";
|
|
adder_type : string := "GENERIC";
|
|
mult_type : string := "AREA_OPTIMIZED";
|
|
shifter_type : string := "GENERIC";
|
|
alu_type : string := "GENERIC";
|
pipeline_stages : natural := 3;
|
pipeline_stages : natural := 3;
|
accurate_timing : boolean := true);
|
accurate_timing : boolean := true);
|
port(clk : in std_logic;
|
port(clk : in std_logic;
|
reset_in : in std_logic;
|
reset_in : in std_logic;
|
intr_in : in std_logic;
|
intr_in : in std_logic;
|
Line 153... |
Line 159... |
reset_reg <= "0000";
|
reset_reg <= "0000";
|
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
if reset_reg /= "1111" then
|
if reset_reg /= "1111" then
|
reset_reg <= reset_reg + 1;
|
reset_reg <= reset_reg + 1;
|
end if;
|
end if;
|
end if;
|
|
if rising_edge(clk) then
|
|
--don't try to interrupt a multi-cycle instruction
|
--don't try to interrupt a multi-cycle instruction
|
if intr_in = '1' and intr_enable = '1' and
|
if intr_in = '1' and intr_enable = '1' and
|
pc_source = from_inc4 and pc(2) = '0' and
|
pc_source = from_inc4 and pc(2) = '0' and
|
pause_any = '0' then
|
pause_any = '0' then
|
--the epc will be backed up one opcode (pc-4)
|
--the epc will be backed up one opcode (pc-4)
|
Line 252... |
Line 256... |
|
|
branch_func => branch_func,
|
branch_func => branch_func,
|
take_branch => take_branch);
|
take_branch => take_branch);
|
|
|
u6_alu: alu
|
u6_alu: alu
|
generic map (adder_type => memory_type)
|
generic map (adder_type => adder_type,
|
|
alu_type => alu_type)
|
port map (
|
port map (
|
a_in => a_busD,
|
a_in => a_busD,
|
b_in => b_busD,
|
b_in => b_busD,
|
alu_function => alu_funcD,
|
alu_function => alu_funcD,
|
c_alu => c_alu);
|
c_alu => c_alu);
|
|
|
u7_shifter: shifter port map (
|
u7_shifter: shifter
|
|
generic map (shifter_type => shifter_type)
|
|
port map (
|
value => b_busD,
|
value => b_busD,
|
shift_amount => a_busD(4 downto 0),
|
shift_amount => a_busD(4 downto 0),
|
shift_func => shift_funcD,
|
shift_func => shift_funcD,
|
c_shift => c_shift);
|
c_shift => c_shift);
|
|
|
u8_mult: mult
|
u8_mult: mult
|
generic map (adder_type => memory_type)
|
generic map (adder_type => adder_type,
|
|
mult_type => mult_type)
|
port map (
|
port map (
|
clk => clk,
|
clk => clk,
|
a => a_busD,
|
a => a_busD,
|
b => b_busD,
|
b => b_busD,
|
mult_func => mult_funcD,
|
mult_func => mult_funcD,
|