OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_package.vhd] - Diff between revs 3 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 4
Line 39... Line 39...
package neorv32_package is
package neorv32_package is
 
 
  -- Architecture Constants -----------------------------------------------------------------
  -- Architecture Constants -----------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  constant data_width_c : natural := 32; -- data width - FIXED!
  constant data_width_c : natural := 32; -- data width - FIXED!
  constant hw_version_c : std_ulogic_vector(31 downto 0) := x"00000204"; -- no touchy!
  constant hw_version_c : std_ulogic_vector(31 downto 0) := x"00000206"; -- no touchy!
 
 
  -- Internal Functions ---------------------------------------------------------------------
  -- Internal Functions ---------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  function index_size_f(input : natural) return natural;
  function index_size_f(input : natural) return natural;
  function cond_sel_natural_f(cond : boolean; val_t : natural; val_f : natural) return natural;
  function cond_sel_natural_f(cond : boolean; val_t : natural; val_f : natural) return natural;
Line 170... Line 170...
  -- bus interface --
  -- bus interface --
  constant ctrl_bus_size_lsb_c    : natural := 31; -- transfer size lsb (00=byte, 01=half-word)
  constant ctrl_bus_size_lsb_c    : natural := 31; -- transfer size lsb (00=byte, 01=half-word)
  constant ctrl_bus_size_msb_c    : natural := 32; -- transfer size msb (10=word, 11=?)
  constant ctrl_bus_size_msb_c    : natural := 32; -- transfer size msb (10=word, 11=?)
  constant ctrl_bus_rd_c          : natural := 33; -- read data request
  constant ctrl_bus_rd_c          : natural := 33; -- read data request
  constant ctrl_bus_wr_c          : natural := 34; -- write data request
  constant ctrl_bus_wr_c          : natural := 34; -- write data request
  constant ctrl_bus_if_c          : natural := 35; -- instruction fetch request (output PC, otherwise output MAR)
  constant ctrl_bus_if_c          : natural := 35; -- instruction fetch request (1: output PC, 0: output MAR)
  constant ctrl_bus_mar_we_c      : natural := 36; -- memory address register write enable
  constant ctrl_bus_mar_we_c      : natural := 36; -- memory address register write enable
  constant ctrl_bus_mdo_we_c      : natural := 37; -- memory data out register write enable
  constant ctrl_bus_mdo_we_c      : natural := 37; -- memory data out register write enable
  constant ctrl_bus_mdi_we_c      : natural := 38; -- memory data in register write enable
  constant ctrl_bus_mdi_we_c      : natural := 38; -- memory data in register write enable
  constant ctrl_bus_unsigned_c    : natural := 39; -- is unsigned load
  constant ctrl_bus_unsigned_c    : natural := 39; -- is unsigned load
  -- csr/system --
  -- csr/system --
Line 403... Line 403...
      ext_irq_i  : in  std_ulogic_vector(01 downto 0) := (others => '0'); -- external interrupt request
      ext_irq_i  : in  std_ulogic_vector(01 downto 0) := (others => '0'); -- external interrupt request
      ext_ack_o  : out std_ulogic_vector(01 downto 0)  -- external interrupt request acknowledge
      ext_ack_o  : out std_ulogic_vector(01 downto 0)  -- external interrupt request acknowledge
    );
    );
  end component;
  end component;
 
 
 
  -- Component: CPU Top Entity --------------------------------------------------------------
 
  -- -------------------------------------------------------------------------------------------
 
  component neorv32_cpu
 
    generic (
 
      -- General --
 
      CLOCK_FREQUENCY           : natural := 0; -- clock frequency of clk_i in Hz
 
      HART_ID                   : std_ulogic_vector(31 downto 0) := x"00000000"; -- custom hardware thread ID
 
      BOOTLOADER_USE            : boolean := true;   -- implement processor-internal bootloader?
 
      -- RISC-V CPU Extensions --
 
      CPU_EXTENSION_RISCV_C     : boolean := false;  -- implement compressed extension?
 
      CPU_EXTENSION_RISCV_E     : boolean := false;  -- implement embedded RF extension?
 
      CPU_EXTENSION_RISCV_M     : boolean := false;  -- implement muld/div extension?
 
      CPU_EXTENSION_RISCV_Zicsr : boolean := true;   -- implement CSR system?
 
      -- Memory configuration: Instruction memory --
 
      MEM_ISPACE_BASE           : std_ulogic_vector(31 downto 0) := x"00000000"; -- base address of instruction memory space
 
      MEM_ISPACE_SIZE           : natural := 8*1024; -- total size of instruction memory space in byte
 
      MEM_INT_IMEM_USE          : boolean := true;   -- implement processor-internal instruction memory
 
      MEM_INT_IMEM_SIZE         : natural := 8*1024; -- size of processor-internal instruction memory in bytes
 
      MEM_INT_IMEM_ROM          : boolean := false;  -- implement processor-internal instruction memory as ROM
 
      -- Memory configuration: Data memory --
 
      MEM_DSPACE_BASE           : std_ulogic_vector(31 downto 0) := x"80000000"; -- base address of data memory space
 
      MEM_DSPACE_SIZE           : natural := 4*1024; -- total size of data memory space in byte
 
      MEM_INT_DMEM_USE          : boolean := true;   -- implement processor-internal data memory
 
      MEM_INT_DMEM_SIZE         : natural := 4*1024; -- size of processor-internal data memory in bytes
 
      -- Memory configuration: External memory interface --
 
      MEM_EXT_USE               : boolean := false;  -- implement external memory bus interface?
 
      MEM_EXT_TIMEOUT           : natural := 15;     -- cycles after which a valid bus access will timeout
 
      -- Processor peripherals --
 
      IO_GPIO_USE               : boolean := true;   -- implement general purpose input/output port unit (GPIO)?
 
      IO_MTIME_USE              : boolean := true;   -- implement machine system timer (MTIME)?
 
      IO_UART_USE               : boolean := true;   -- implement universal asynchronous receiver/transmitter (UART)?
 
      IO_SPI_USE                : boolean := true;   -- implement serial peripheral interface (SPI)?
 
      IO_TWI_USE                : boolean := true;   -- implement two-wire interface (TWI)?
 
      IO_PWM_USE                : boolean := true;   -- implement pulse-width modulation unit (PWM)?
 
      IO_WDT_USE                : boolean := true;   -- implement watch dog timer (WDT)?
 
      IO_CLIC_USE               : boolean := true;   -- implement core local interrupt controller (CLIC)?
 
      IO_TRNG_USE               : boolean := true;   -- implement true random number generator (TRNG)?
 
      IO_DEVNULL_USE            : boolean := true    -- implement dummy device (DEVNULL)?
 
    );
 
    port (
 
      -- global control --
 
      clk_i       : in  std_ulogic; -- global clock, rising edge
 
      rstn_i      : in  std_ulogic; -- global reset, low-active, async
 
      -- bus interface --
 
      bus_addr_o  : out std_ulogic_vector(data_width_c-1 downto 0); -- bus access address
 
      bus_rdata_i : in  std_ulogic_vector(data_width_c-1 downto 0); -- bus read data
 
      bus_wdata_o : out std_ulogic_vector(data_width_c-1 downto 0); -- bus write data
 
      bus_ben_o   : out std_ulogic_vector(03 downto 0); -- byte enable
 
      bus_we_o    : out std_ulogic; -- write enable
 
      bus_re_o    : out std_ulogic; -- read enable
 
      bus_ack_i   : in  std_ulogic; -- bus transfer acknowledge
 
      bus_err_i   : in  std_ulogic; -- bus transfer error
 
      -- external interrupts --
 
      clic_irq_i  : in  std_ulogic; -- CLIC interrupt request
 
      mtime_irq_i : in  std_ulogic  -- machine timer interrupt
 
    );
 
  end component;
 
 
  -- Component: CPU Control -----------------------------------------------------------------
  -- Component: CPU Control -----------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  component neorv32_cpu_control
  component neorv32_cpu_control
    generic (
    generic (
      -- General --
      -- General --
Line 600... Line 658...
      ci_illegal_o : out std_ulogic; -- is an illegal compressed instruction
      ci_illegal_o : out std_ulogic; -- is an illegal compressed instruction
      ci_instr32_o : out std_ulogic_vector(31 downto 0)  -- 32-bit decompressed instruction
      ci_instr32_o : out std_ulogic_vector(31 downto 0)  -- 32-bit decompressed instruction
    );
    );
  end component;
  end component;
 
 
  -- Component: CPU Top Entity --------------------------------------------------------------
 
  -- -------------------------------------------------------------------------------------------
 
  component neorv32_cpu
 
    generic (
 
      -- General --
 
      CLOCK_FREQUENCY           : natural := 0; -- clock frequency of clk_i in Hz
 
      HART_ID                   : std_ulogic_vector(31 downto 0) := x"00000000"; -- custom hardware thread ID
 
      BOOTLOADER_USE            : boolean := true;   -- implement processor-internal bootloader?
 
      -- RISC-V CPU Extensions --
 
      CPU_EXTENSION_RISCV_C     : boolean := false;  -- implement compressed extension?
 
      CPU_EXTENSION_RISCV_E     : boolean := false;  -- implement embedded RF extension?
 
      CPU_EXTENSION_RISCV_M     : boolean := false;  -- implement muld/div extension?
 
      CPU_EXTENSION_RISCV_Zicsr : boolean := true;   -- implement CSR system?
 
      -- Memory configuration: Instruction memory --
 
      MEM_ISPACE_BASE           : std_ulogic_vector(31 downto 0) := x"00000000"; -- base address of instruction memory space
 
      MEM_ISPACE_SIZE           : natural := 8*1024; -- total size of instruction memory space in byte
 
      MEM_INT_IMEM_USE          : boolean := true;   -- implement processor-internal instruction memory
 
      MEM_INT_IMEM_SIZE         : natural := 8*1024; -- size of processor-internal instruction memory in bytes
 
      MEM_INT_IMEM_ROM          : boolean := false;  -- implement processor-internal instruction memory as ROM
 
      -- Memory configuration: Data memory --
 
      MEM_DSPACE_BASE           : std_ulogic_vector(31 downto 0) := x"80000000"; -- base address of data memory space
 
      MEM_DSPACE_SIZE           : natural := 4*1024; -- total size of data memory space in byte
 
      MEM_INT_DMEM_USE          : boolean := true;   -- implement processor-internal data memory
 
      MEM_INT_DMEM_SIZE         : natural := 4*1024; -- size of processor-internal data memory in bytes
 
      -- Memory configuration: External memory interface --
 
      MEM_EXT_USE               : boolean := false;  -- implement external memory bus interface?
 
      MEM_EXT_TIMEOUT           : natural := 15;     -- cycles after which a valid bus access will timeout
 
      -- Processor peripherals --
 
      IO_GPIO_USE               : boolean := true;   -- implement general purpose input/output port unit (GPIO)?
 
      IO_MTIME_USE              : boolean := true;   -- implement machine system timer (MTIME)?
 
      IO_UART_USE               : boolean := true;   -- implement universal asynchronous receiver/transmitter (UART)?
 
      IO_SPI_USE                : boolean := true;   -- implement serial peripheral interface (SPI)?
 
      IO_TWI_USE                : boolean := true;   -- implement two-wire interface (TWI)?
 
      IO_PWM_USE                : boolean := true;   -- implement pulse-width modulation unit (PWM)?
 
      IO_WDT_USE                : boolean := true;   -- implement watch dog timer (WDT)?
 
      IO_CLIC_USE               : boolean := true;   -- implement core local interrupt controller (CLIC)?
 
      IO_TRNG_USE               : boolean := true;   -- implement true random number generator (TRNG)?
 
      IO_DEVNULL_USE            : boolean := true    -- implement dummy device (DEVNULL)?
 
    );
 
    port (
 
      -- global control --
 
      clk_i       : in  std_ulogic; -- global clock, rising edge
 
      rstn_i      : in  std_ulogic; -- global reset, low-active, async
 
      -- bus interface --
 
      bus_addr_o  : out std_ulogic_vector(data_width_c-1 downto 0); -- bus access address
 
      bus_rdata_i : in  std_ulogic_vector(data_width_c-1 downto 0); -- bus read data
 
      bus_wdata_o : out std_ulogic_vector(data_width_c-1 downto 0); -- bus write data
 
      bus_ben_o   : out std_ulogic_vector(03 downto 0); -- byte enable
 
      bus_we_o    : out std_ulogic; -- write enable
 
      bus_re_o    : out std_ulogic; -- read enable
 
      bus_ack_i   : in  std_ulogic; -- bus transfer acknowledge
 
      bus_err_i   : in  std_ulogic; -- bus transfer error
 
      -- external interrupts --
 
      clic_irq_i  : in  std_ulogic; -- CLIC interrupt request
 
      mtime_irq_i : in  std_ulogic  -- machine timer interrupt
 
    );
 
  end component;
 
 
 
  -- Component: Processor-internal instruction memory (IMEM) --------------------------------
  -- Component: Processor-internal instruction memory (IMEM) --------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  component neorv32_imem
  component neorv32_imem
    generic (
    generic (
      IMEM_BASE      : std_ulogic_vector(31 downto 0) := x"00000000"; -- memory base address
      IMEM_BASE      : std_ulogic_vector(31 downto 0) := x"00000000"; -- memory base address
Line 717... Line 717...
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  component neorv32_mtime
  component neorv32_mtime
    port (
    port (
      -- host access --
      -- host access --
      clk_i     : in  std_ulogic; -- global clock line
      clk_i     : in  std_ulogic; -- global clock line
 
      rstn_i    : in  std_ulogic := '0'; -- global reset, low-active, async
      addr_i    : in  std_ulogic_vector(31 downto 0); -- address
      addr_i    : in  std_ulogic_vector(31 downto 0); -- address
      rden_i    : in  std_ulogic; -- read enable
      rden_i    : in  std_ulogic; -- read enable
      wren_i    : in  std_ulogic; -- write enable
      wren_i    : in  std_ulogic; -- write enable
      ben_i     : in  std_ulogic_vector(03 downto 0); -- byte write enable
      ben_i     : in  std_ulogic_vector(03 downto 0); -- byte write enable
      data_i    : in  std_ulogic_vector(31 downto 0); -- data in
      data_i    : in  std_ulogic_vector(31 downto 0); -- data in
Line 947... Line 948...
      wb_ack_i : in  std_ulogic; -- transfer acknowledge
      wb_ack_i : in  std_ulogic; -- transfer acknowledge
      wb_err_i : in  std_ulogic  -- transfer error
      wb_err_i : in  std_ulogic  -- transfer error
    );
    );
  end component;
  end component;
 
 
  -- Component: Dummy Device with SIM Output (DEVNULL) -------------------------------------
  ---- Component: Dummy Device with SIM Output (DEVNULL) -------------------------------------
  -- -------------------------------------------------------------------------------------------
  ---- -------------------------------------------------------------------------------------------
  component neorv32_devnull
  component neorv32_devnull
    port (
    port (
      -- host access --
      -- host access --
      clk_i  : in  std_ulogic; -- global clock line
      clk_i  : in  std_ulogic; -- global clock line
      addr_i : in  std_ulogic_vector(31 downto 0); -- address
      addr_i : in  std_ulogic_vector(31 downto 0); -- address

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.