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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [Open8_cfg.vhd] - Blame information for rev 273

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 266 jshamlet
-- VHDL Units :  Open8_cfg
2 267 jshamlet
-- Description:  Contains an example Open8_cfg file
3 227 jshamlet
--
4
-- Revision History
5
-- Author          Date     Change
6
------------------ -------- ---------------------------------------------------
7 267 jshamlet
-- Seth Henry      10/21/20 Design Start
8 227 jshamlet
 
9
library ieee;
10
  use ieee.std_logic_1164.all;
11 266 jshamlet
  use ieee.std_logic_unsigned.all;
12
  use ieee.std_logic_arith.all;
13 227 jshamlet
 
14
library work;
15
  use work.open8_pkg.all;
16
 
17 266 jshamlet
package open8_cfg is
18 227 jshamlet
 
19 266 jshamlet
  -- Internal Clock Frequency
20
  constant Clock_Frequency          : real      := 120000000.0;
21
 
22
    -- Open8 CPU Options
23
  constant Allow_Stack_Address_Move : boolean   := TRUE;
24
  constant Enable_Auto_Increment    : boolean   := TRUE;
25
  constant BRK_Implements_WAI       : boolean   := TRUE;
26
  constant Enable_NMI               : boolean   := TRUE;
27
  constant Sequential_Interrupts    : boolean   := TRUE;
28
  constant RTI_Ignores_GP_Flags     : boolean   := TRUE;
29
  constant Supervisor_Mode          : boolean   := TRUE;
30
  constant Unsigned_Index_Offsets   : boolean   := TRUE;
31
  constant Default_Int_Mask         : DATA_TYPE := x"00";
32 227 jshamlet
 
33 266 jshamlet
  -- System Memory Map
34
  constant RAM_Address              : ADDRESS_TYPE := x"0000";  -- System RAM
35
  constant WPR_Address              : ADDRESS_TYPE := x"1000";  -- Write Protect Mask
36
  constant WQL_Address              : ADDRESS_TYPE := x"1100";  -- Write Qual Register
37
  constant INT_Address              : ADDRESS_TYPE := x"1200";  -- Interrupt Manager
38
  constant ROM_Address              : ADDRESS_TYPE := x"8000";  -- Application ROM
39
  constant ISR_Start_Addr           : ADDRESS_TYPE := x"FFF0";  -- ISR vector table
40 227 jshamlet
 
41 266 jshamlet
  -- RAM size is used to calculate the initial stack pointer, which is set at
42
  --  the top of the RAM region.
43
  constant RAM_Size                 : integer   := 4096;
44 227 jshamlet
 
45 266 jshamlet
  constant RAM_Write_Protect        : boolean   := TRUE;
46
 
47
  -- CPU Interrupt assignments - Note that interrupt 0 is the NMI (non-maskable)
48
  --  also, because these are handled by the CPU, they are in priority order
49
  --  from 0 (highest) to 7 (lowest).
50
  constant CPU_INT_RAM              : integer range 0 to OPEN8_DATA_WIDTH - 1 := 0;
51
  constant CPU_INT_PIT              : integer range 0 to OPEN8_DATA_WIDTH - 1 := 1;
52
  constant CPU_INT_EXT              : integer range 0 to OPEN8_DATA_WIDTH - 1 := 2;
53 240 jshamlet
 
54 266 jshamlet
  -- I/O Interrupt assignments (Not technically required, as software will overwrite
55
  --  this during initialization)
56
  constant Default_IO_Int_Mask      : ADDRESS_TYPE := x"0000";
57
 
58
  -- Set this to the number of readable modules in the design, as it sets the
59
  --  number of ports on the read aggregator function.
60
  constant NUM_READ_BUSES           : integer := 4;
61 227 jshamlet
 
62 266 jshamlet
  -- Read Data Bus aggregator and bus assignments.
63
  --  Note that the ordering isn't important, only that each device has a
64
  --   unique number less than NUM_READ_BUSES.
65
  constant RDB_RAM                  : integer range 0 to NUM_READ_BUSES - 1   :=  0;
66
  constant RDB_WQL                  : integer range 0 to NUM_READ_BUSES - 1   :=  1;
67
  constant RDB_INT                  : integer range 0 to NUM_READ_BUSES - 1   :=  2;
68
  constant RDB_ROM                  : integer range 0 to NUM_READ_BUSES - 1   :=  3;
69 240 jshamlet
 
70 266 jshamlet
  -- System configuration calculations - no adjustable parameters below this point
71
  type OPEN8_BUS_ARRAY is array(0 to NUM_READ_BUSES - 1) of DATA_TYPE;
72 227 jshamlet
 
73 266 jshamlet
  constant INIT_READ_BUS            : OPEN8_BUS_ARRAY := (others => OPEN8_NULLBUS);
74 227 jshamlet
 
75 266 jshamlet
  function merge_buses (x : in OPEN8_BUS_ARRAY) return DATA_TYPE;
76 227 jshamlet
 
77 266 jshamlet
  -- Compute the stack start address based on the RAM size
78
  constant RAM_Vector_Size          : integer := ceil_log2(RAM_Size - 1);
79
  constant RAM_End_Addr             : std_logic_vector(RAM_Vector_Size - 1 downto 0)
80
                                     := (others => '1');
81 227 jshamlet
 
82 266 jshamlet
  constant Stack_Start_Addr         : ADDRESS_TYPE := RAM_Address + RAM_End_Addr;
83 227 jshamlet
 
84 266 jshamlet
end package;
85 227 jshamlet
 
86 266 jshamlet
package body open8_cfg is
87 227 jshamlet
 
88 266 jshamlet
  function merge_buses (x : in OPEN8_BUS_ARRAY) return DATA_TYPE is
89
    variable i               : integer   := 0;
90
    variable retval          : DATA_TYPE := x"00";
91 227 jshamlet
  begin
92 266 jshamlet
    retval                   := x"00";
93
    for i in 0 to NUM_READ_BUSES - 1 loop
94
      retval                 := retval or x(i);
95
    end loop;
96
    return retval;
97
  end function;
98 227 jshamlet
 
99 266 jshamlet
end package body;

powered by: WebSVN 2.1.0

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