📄 minimips.vhd
字号:
-------------------------------------------------------------------------------------- ---- Copyright (c) 2004, Hangouet Samuel ---- , Jan Sebastien ---- , Mouton Louis-Marie ---- , Schneider Olivier all rights reserved ---- ---- This file is part of miniMIPS. ---- ---- miniMIPS is free software; you can redistribute it and/or modify ---- it under the terms of the GNU General Public License as published by ---- the Free Software Foundation; either version 2 of the License, or ---- (at your option) any later version. ---- ---- miniMIPS is distributed in the hope that it will be useful, ---- but WITHOUT ANY WARRANTY; without even the implied warranty of ---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ---- GNU General Public License for more details. ---- ---- You should have received a copy of the GNU General Public License ---- along with miniMIPS; if not, write to the Free Software ---- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ---- ---------------------------------------------------------------------------------------- If you encountered any problem, please contact :---- lmouton@enserg.fr-- oschneid@enserg.fr-- shangoue@enserg.fr------------------------------------------------------------------------------ ---- ---- miniMIPS Processor : miniMIPS processor ---- ---- ---- ---- Authors : Hangouet Samuel ---- Jan S閎astien ---- Mouton Louis-Marie ---- Schneider Olivier ---- ---- june 2003 ----------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library work;use work.pack_mips.all;entity minimips isport ( clock : in std_logic; reset : in std_logic; -- Ram connexion ram_req : out std_logic; ram_adr : out bus32; ram_r_w : out std_logic; ram_data : inout bus32; ram_ack : in std_logic; -- Hardware interruption it_mat : in std_logic);end minimips;architecture rtl of minimips is -- General signals signal stop_all : std_logic; -- Lock the pipeline evolution signal it_mat_clk : std_logic; -- Synchronised hardware interruption signal stop_pf : std_logic; -- Lock the pc signal genop : std_logic; -- envoi de nops -- interface PF - EI signal PF_pc : bus32; -- PC value -- interface Controler - EI signal CTE_instr : bus32; -- Instruction from the memory signal ETC_adr : bus32; -- Address to read in memory -- interface EI - DI signal EI_instr : bus32; -- Read interface signal EI_adr : bus32; -- Address from the read instruction signal EI_it_ok : std_logic; -- Allow hardware interruptions -- DI output signal bra_detect : std_logic; -- Branch detection in the current instruction -- Asynchronous connexion with the bypass unit signal adr_reg1 : adr_reg_type; -- Operand 1 address signal adr_reg2 : adr_reg_type; -- Operand 2 address signal use1 : std_logic; -- Operand 1 utilisation signal use2 : std_logic; -- Operand 2 utilisation signal data1 : bus32; -- First register value signal data2 : bus32; -- Second register value signal alea : std_logic; -- Unresolved hazards detected -- interface DI - EX signal DI_bra : std_logic; -- Branch decoded signal DI_link : std_logic; -- A link for that instruction signal DI_op1 : bus32; -- operand 1 for alu signal DI_op2 : bus32; -- operand 2 for alu signal DI_code_ual : alu_ctrl_type; -- Alu operation signal DI_offset : bus32; -- Offset for the address calculation signal DI_adr_reg_dest : adr_reg_type; -- Address of the destination register of the result signal DI_ecr_reg : std_logic; -- Effective writing of the result signal DI_mode : std_logic; -- Address mode (relative to pc or indexed to a register) signal DI_op_mem : std_logic; -- Memory operation request signal DI_r_w : std_logic; -- Type of memory operation (reading or writing) signal DI_adr : bus32; -- Address of the decoded instruction signal DI_exc_cause : bus32; -- Potential exception detected signal DI_level : level_type; -- Availability of the result for the data bypass signal DI_it_ok : std_logic; -- Allow hardware interruptions -- interface EX - MEM signal EX_adr : bus32; -- Instruction address signal EX_bra_confirm : std_logic; -- Branch execution confirmation signal EX_data_ual : bus32; -- Ual result signal EX_adresse : bus32; -- Address calculation result signal EX_adr_reg_dest : adr_reg_type; -- Destination register for the result signal EX_ecr_reg : std_logic; -- Effective writing of the result signal EX_op_mem : std_logic; -- Memory operation needed signal EX_r_w : std_logic; -- Type of memory operation (read or write) signal EX_exc_cause : bus32; -- Potential cause exception signal EX_level : level_type; -- Availability stage of result for bypassing signal EX_it_ok : std_logic; -- Allow hardware interruptions -- interface Controler - MEM signal MTC_data : bus32; -- Data to write in memory signal MTC_adr : bus32; -- Address for memory signal MTC_r_w : std_logic; -- Read/Write in memory signal MTC_req : std_logic; -- Request access to memory signal CTM_data : bus32; -- Data from memory -- interface MEM - REG signal MEM_adr : bus32; -- Instruction address signal MEM_adr_reg_dest : adr_reg_type; -- Destination register address signal MEM_ecr_reg : std_logic; -- Writing of the destination register signal MEM_data_ecr : bus32; -- Data to write (from alu or memory) signal MEM_exc_cause : bus32; -- Potential exception cause signal MEM_level : level_type; -- Availability stage for the result for bypassing signal MEM_it_ok : std_logic; -- Allow hardware interruptions -- connexion to the register banks -- Writing commands in the register banks signal write_data : bus32; -- Data to write signal write_adr : bus5; -- Address of the register to write signal write_GPR : std_logic; -- Selection in the internal registers signal write_SCP : std_logic; -- Selection in the coprocessor system registers -- Reading commands for Reading in the registers signal read_adr1 : bus5; -- Address of the first register to read signal read_adr2 : bus5; -- Address of the second register to read signal read_data1_GPR : bus32; -- Value of operand 1 from the internal registers signal read_data1_SCP : bus32; -- Value of operand 2 from the internal registers signal read_data2_GPR : bus32; -- Value of operand 1 from the coprocessor system registers signal read_data2_SCP : bus32; -- Value of operand 2 from the coprocessor system registers -- Interruption controls signal interrupt : std_logic; -- Interruption to take into account signal vecteur_it : bus32; -- Interruption vector begin stop_pf <= DI_bra or bra_detect or alea; genop <= bra_detect or EX_bra_confirm or DI_bra; -- Take into account the hardware interruption on rising edge process (clock) begin if clock='1' and clock'event then it_mat_clk <= it_mat; end if; end process; U1_pf : pps_pf port map ( clock => clock, reset => reset, stop_all => stop_all, -- Unconditionnal locking of the pipeline stage -- entrees asynchrones bra_adr => EX_adresse, -- Branch bra_cmd => EX_bra_confirm, -- Address to load when an effective branch exch_adr => vecteur_it, -- Exception branch exch_cmd => interrupt, -- Exception vector -- Lock the stage stop_pf => stop_pf, -- Synchronous output to EI stage PF_pc => PF_pc -- PC value ); U2_ei : pps_ei port map ( clock => clock, reset => reset, clear => interrupt, -- Clear the pipeline stage stop_all => stop_all, -- Evolution locking signal -- Asynchronous inputs stop_ei => alea, -- Lock the EI_adr and Ei_instr registers genop => genop, -- Send nops -- interface Controler - EI CTE_instr => CTE_instr, -- Instruction from the memory ETC_adr => ETC_adr, -- Address to read in memory -- Synchronous inputs from PF stage PF_pc => PF_pc, -- Current value of the pc -- Synchronous outputs to DI stage EI_instr => EI_instr, -- Read interface EI_adr => EI_adr, -- Address from the read instruction EI_it_ok => EI_it_ok -- Allow hardware interruptions ); U3_di : pps_di port map ( clock => clock, reset => reset, stop_all => stop_all, -- Unconditionnal locking of the outputs clear => interrupt, -- Clear the pipeline stage (nop in the outputs) -- Asynchronous outputs bra_detect => bra_detect, -- Branch detection in the current instruction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -