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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_package.vhd] - Diff between revs 64 and 65

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

Rev 64 Rev 65
Line 62... Line 62...
  constant jtag_tap_idcode_manid_c   : std_ulogic_vector(10 downto 0) := "00000000000"; -- manufacturer id
  constant jtag_tap_idcode_manid_c   : std_ulogic_vector(10 downto 0) := "00000000000"; -- manufacturer id
 
 
  -- Architecture Constants (do not modify!) ------------------------------------------------
  -- Architecture Constants (do not modify!) ------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  constant data_width_c : natural := 32; -- native data path width - do not change!
  constant data_width_c : natural := 32; -- native data path width - do not change!
  constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01060100"; -- no touchy!
  constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01060202"; -- no touchy!
  constant archid_c     : natural := 19; -- official NEORV32 architecture ID - hands off!
  constant archid_c     : natural := 19; -- official NEORV32 architecture ID - hands off!
 
 
  -- External Interface Types ---------------------------------------------------------------
  -- External Interface Types ---------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  type sdata_8x32_t  is array (0 to 7)  of std_ulogic_vector(31 downto 0);
  type sdata_8x32_t  is array (0 to 7)  of std_ulogic_vector(31 downto 0);
Line 947... Line 947...
      XIRQ_TRIGGER_POLARITY        : std_ulogic_vector(31 downto 0) := x"FFFFFFFF"; -- trigger polarity: 0=low-level/falling-edge, 1=high-level/rising-edge
      XIRQ_TRIGGER_POLARITY        : std_ulogic_vector(31 downto 0) := x"FFFFFFFF"; -- trigger polarity: 0=low-level/falling-edge, 1=high-level/rising-edge
      -- Processor peripherals --
      -- Processor peripherals --
      IO_GPIO_EN                   : boolean := false;  -- implement general purpose input/output port unit (GPIO)?
      IO_GPIO_EN                   : boolean := false;  -- implement general purpose input/output port unit (GPIO)?
      IO_MTIME_EN                  : boolean := false;  -- implement machine system timer (MTIME)?
      IO_MTIME_EN                  : boolean := false;  -- implement machine system timer (MTIME)?
      IO_UART0_EN                  : boolean := false;  -- implement primary universal asynchronous receiver/transmitter (UART0)?
      IO_UART0_EN                  : boolean := false;  -- implement primary universal asynchronous receiver/transmitter (UART0)?
 
      IO_UART0_RX_FIFO             : natural := 1;      -- RX fifo depth, has to be a power of two, min 1
 
      IO_UART0_TX_FIFO             : natural := 1;      -- TX fifo depth, has to be a power of two, min 1
      IO_UART1_EN                  : boolean := false;  -- implement secondary universal asynchronous receiver/transmitter (UART1)?
      IO_UART1_EN                  : boolean := false;  -- implement secondary universal asynchronous receiver/transmitter (UART1)?
 
      IO_UART1_RX_FIFO             : natural := 1;      -- RX fifo depth, has to be a power of two, min 1
 
      IO_UART1_TX_FIFO             : natural := 1;      -- TX fifo depth, has to be a power of two, min 1
      IO_SPI_EN                    : boolean := false;  -- implement serial peripheral interface (SPI)?
      IO_SPI_EN                    : boolean := false;  -- implement serial peripheral interface (SPI)?
      IO_TWI_EN                    : boolean := false;  -- implement two-wire interface (TWI)?
      IO_TWI_EN                    : boolean := false;  -- implement two-wire interface (TWI)?
      IO_PWM_NUM_CH                : natural := 0;      -- number of PWM channels to implement (0..60); 0 = disabled
      IO_PWM_NUM_CH                : natural := 0;      -- number of PWM channels to implement (0..60); 0 = disabled
      IO_WDT_EN                    : boolean := false;  -- implement watch dog timer (WDT)?
      IO_WDT_EN                    : boolean := false;  -- implement watch dog timer (WDT)?
      IO_TRNG_EN                   : boolean := false;  -- implement true random number generator (TRNG)?
      IO_TRNG_EN                   : boolean := false;  -- implement true random number generator (TRNG)?
Line 1198... Line 1202...
      -- data input --
      -- data input --
      mem_i  : in  std_ulogic_vector(data_width_c-1 downto 0); -- memory read data
      mem_i  : in  std_ulogic_vector(data_width_c-1 downto 0); -- memory read data
      alu_i  : in  std_ulogic_vector(data_width_c-1 downto 0); -- ALU result
      alu_i  : in  std_ulogic_vector(data_width_c-1 downto 0); -- ALU result
      -- data output --
      -- data output --
      rs1_o  : out std_ulogic_vector(data_width_c-1 downto 0); -- operand 1
      rs1_o  : out std_ulogic_vector(data_width_c-1 downto 0); -- operand 1
      rs2_o  : out std_ulogic_vector(data_width_c-1 downto 0); -- operand 2
      rs2_o  : out std_ulogic_vector(data_width_c-1 downto 0)  -- operand 2
      cmp_o  : out std_ulogic_vector(1 downto 0) -- comparator status
 
    );
    );
  end component;
  end component;
 
 
  -- Component: CPU ALU ---------------------------------------------------------------------
  -- Component: CPU ALU ---------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
Line 1227... Line 1230...
      rs1_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- rf source 1
      rs1_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- rf source 1
      rs2_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- rf source 2
      rs2_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- rf source 2
      pc2_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- delayed PC
      pc2_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- delayed PC
      imm_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- immediate
      imm_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- immediate
      csr_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- CSR read data
      csr_i       : in  std_ulogic_vector(data_width_c-1 downto 0); -- CSR read data
      cmp_i       : in  std_ulogic_vector(1 downto 0); -- comparator status
 
      -- data output --
      -- data output --
 
      cmp_o       : out std_ulogic_vector(1 downto 0); -- comparator status
      res_o       : out std_ulogic_vector(data_width_c-1 downto 0); -- ALU result
      res_o       : out std_ulogic_vector(data_width_c-1 downto 0); -- ALU result
      add_o       : out std_ulogic_vector(data_width_c-1 downto 0); -- address computation result
      add_o       : out std_ulogic_vector(data_width_c-1 downto 0); -- address computation result
      fpu_flags_o : out std_ulogic_vector(4 downto 0); -- FPU exception flags
      fpu_flags_o : out std_ulogic_vector(4 downto 0); -- FPU exception flags
      -- status --
      -- status --
      idone_o     : out std_ulogic -- iterative processing units done?
      idone_o     : out std_ulogic -- iterative processing units done?
Line 1619... Line 1622...
 
 
  -- Component: Universal Asynchronous Receiver and Transmitter (UART) ----------------------
  -- Component: Universal Asynchronous Receiver and Transmitter (UART) ----------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  component neorv32_uart
  component neorv32_uart
    generic (
    generic (
      UART_PRIMARY : boolean -- true = primary UART (UART0), false = secondary UART (UART1)
      UART_PRIMARY : boolean; -- true = primary UART (UART0), false = secondary UART (UART1)
 
      UART_RX_FIFO : natural; -- RX fifo depth, has to be a power of two, min 1
 
      UART_TX_FIFO : natural  -- TX fifo depth, has to be a power of two, min 1
    );
    );
    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
Line 1799... Line 1804...
      data_o      : out std_ulogic_vector(31 downto 0); -- data out
      data_o      : out std_ulogic_vector(31 downto 0); -- data out
      ack_o       : out std_ulogic; -- transfer acknowledge
      ack_o       : out std_ulogic; -- transfer acknowledge
      -- clock generator --
      -- clock generator --
      clkgen_en_o : out std_ulogic; -- enable clock generator
      clkgen_en_o : out std_ulogic; -- enable clock generator
      clkgen_i    : in  std_ulogic_vector(07 downto 0); -- "clock" inputs
      clkgen_i    : in  std_ulogic_vector(07 downto 0); -- "clock" inputs
      -- CPU state --
 
      sleep_i     : in  std_ulogic; -- set if cpu is in sleep mode
 
      -- interrupt --
      -- interrupt --
      irq_o       : out std_ulogic; -- interrupt request
      irq_o       : out std_ulogic; -- interrupt request
      -- custom io (conduit) --
      -- custom io (conduit) --
      cfs_in_i    : in  std_ulogic_vector(CFS_IN_SIZE-1 downto 0); -- custom inputs
      cfs_in_i    : in  std_ulogic_vector(CFS_IN_SIZE-1 downto 0); -- custom inputs
      cfs_out_o   : out std_ulogic_vector(CFS_OUT_SIZE-1 downto 0) -- custom outputs
      cfs_out_o   : out std_ulogic_vector(CFS_OUT_SIZE-1 downto 0) -- custom outputs
Line 1968... Line 1971...
      -- control --
      -- control --
      clk_i   : in  std_ulogic; -- clock, rising edge
      clk_i   : in  std_ulogic; -- clock, rising edge
      rstn_i  : in  std_ulogic; -- async reset, low-active
      rstn_i  : in  std_ulogic; -- async reset, low-active
      clear_i : in  std_ulogic; -- sync reset, high-active
      clear_i : in  std_ulogic; -- sync reset, high-active
      level_o : out std_ulogic_vector(index_size_f(FIFO_DEPTH) downto 0); -- fill level
      level_o : out std_ulogic_vector(index_size_f(FIFO_DEPTH) downto 0); -- fill level
 
      half_o  : out std_ulogic; -- FIFO is at least half full
      -- write port --
      -- write port --
      wdata_i : in  std_ulogic_vector(FIFO_WIDTH-1 downto 0); -- write data
      wdata_i : in  std_ulogic_vector(FIFO_WIDTH-1 downto 0); -- write data
      we_i    : in  std_ulogic; -- write enable
      we_i    : in  std_ulogic; -- write enable
      free_o  : out std_ulogic; -- at least one entry is free when set
      free_o  : out std_ulogic; -- at least one entry is free when set
      -- read port --
      -- read port --
Line 2130... Line 2134...
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  function or_reduce_f(a : std_ulogic_vector) return std_ulogic is
  function or_reduce_f(a : std_ulogic_vector) return std_ulogic is
    variable tmp_v : std_ulogic;
    variable tmp_v : std_ulogic;
  begin
  begin
    tmp_v := '0';
    tmp_v := '0';
    if (a'low < a'high) then -- not null range?
    for i in a'range loop
      for i in a'low to a'high loop
 
        tmp_v := tmp_v or a(i);
        tmp_v := tmp_v or a(i);
      end loop; -- i
      end loop; -- i
    end if;
 
    return tmp_v;
    return tmp_v;
  end function or_reduce_f;
  end function or_reduce_f;
 
 
  -- Function: AND-reduce all bits ----------------------------------------------------------
  -- Function: AND-reduce all bits ----------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  function and_reduce_f(a : std_ulogic_vector) return std_ulogic is
  function and_reduce_f(a : std_ulogic_vector) return std_ulogic is
    variable tmp_v : std_ulogic;
    variable tmp_v : std_ulogic;
  begin
  begin
    tmp_v := '1';
    tmp_v := '1';
    if (a'low < a'high) then -- not null range?
    for i in a'range loop
      for i in a'low to a'high loop
 
        tmp_v := tmp_v and a(i);
        tmp_v := tmp_v and a(i);
      end loop; -- i
      end loop; -- i
    end if;
 
    return tmp_v;
    return tmp_v;
  end function and_reduce_f;
  end function and_reduce_f;
 
 
  -- Function: XOR-reduce all bits ----------------------------------------------------------
  -- Function: XOR-reduce all bits ----------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  function xor_reduce_f(a : std_ulogic_vector) return std_ulogic is
  function xor_reduce_f(a : std_ulogic_vector) return std_ulogic is
    variable tmp_v : std_ulogic;
    variable tmp_v : std_ulogic;
  begin
  begin
    tmp_v := '0';
    tmp_v := '0';
    if (a'low < a'high) then -- not null range?
    for i in a'range loop
      for i in a'low to a'high loop
 
        tmp_v := tmp_v xor a(i);
        tmp_v := tmp_v xor a(i);
      end loop; -- i
      end loop; -- i
    end if;
 
    return tmp_v;
    return tmp_v;
  end function xor_reduce_f;
  end function xor_reduce_f;
 
 
  -- Function: Convert std_ulogic_vector to hex char ----------------------------------------
  -- Function: Convert std_ulogic_vector to hex char ----------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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