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 257

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

Line No. Rev Author Line
1 227 jshamlet
-- Copyright (c)2020 Jeremy Seth Henry
2
-- All rights reserved.
3
--
4
-- Redistribution and use in source and binary forms, with or without
5
-- modification, are permitted provided that the following conditions are met:
6
--     * Redistributions of source code must retain the above copyright
7
--       notice, this list of conditions and the following disclaimer.
8
--     * Redistributions in binary form must reproduce the above copyright
9
--       notice, this list of conditions and the following disclaimer in the
10
--       documentation and/or other materials provided with the distribution,
11
--       where applicable (as part of a user interface, debugging port, etc.)
12
--
13
-- THIS SOFTWARE IS PROVIDED BY JEREMY SETH HENRY ``AS IS'' AND ANY
14
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
17
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 
24
-- VHDL Units :  open8_cfg
25
-- Description:  Contains project specific constants to configure an Open8
26 240 jshamlet
--                system
27 227 jshamlet
--
28
-- Revision History
29
-- Author          Date     Change
30
------------------ -------- ---------------------------------------------------
31
-- Seth Henry      04/16/20 Design Start
32
 
33
library ieee;
34
  use ieee.std_logic_1164.all;
35
  use ieee.std_logic_unsigned.all;
36
  use ieee.std_logic_arith.all;
37
 
38
library work;
39
  use work.open8_pkg.all;
40
 
41
package open8_cfg is
42
 
43
  -- Internal signals & constants
44 240 jshamlet
  constant Clock_Frequency          : real      := 100000000.0;
45 227 jshamlet
 
46
  -- Peripheral Options
47
 
48
  -- SDLC Configuration
49 240 jshamlet
  constant Master_Mode              : boolean   := true;
50
  constant BitClock_Freq            : real      := 20000000.0;
51
  constant Clock_Offset             : integer   := 3;
52 227 jshamlet
 
53 240 jshamlet
  -- FM Serial Configuration
54
  constant SERIAL_58_125K           : real      := 58125.0;
55
  constant PARITY_ENABLE            : boolean   := true;
56
  constant PARITY_ODD_EVENn         : std_logic := '1';
57
 
58 227 jshamlet
  -- MAX7221 Driver Configuration
59 240 jshamlet
  constant MAX7221_BITRATE          : real      := 5000000.0;
60 227 jshamlet
 
61 240 jshamlet
  -- Test Vector Receiver Configuration
62
  constant VECTOR_BITRATE           : real      := 10000000.0;
63
  constant VECTOR_PARITY            : boolean   := TRUE;
64
  constant VECTOR_ODD_EVENn         : std_logic := '0';
65
 
66 227 jshamlet
  -- Open8 CPU Options
67 240 jshamlet
  constant Allow_Stack_Address_Move : boolean   := true;
68
  constant Stack_Xfer_Flag          : integer   := PSR_GP4;
69
  constant Enable_Auto_Increment    : boolean   := true;
70
  constant BRK_Implements_WAI       : boolean   := true;
71
  constant Enable_NMI               : boolean   := true;
72
  constant Sequential_Interrupts    : boolean   := true;
73
  constant RTI_Ignores_GP_Flags     : boolean   := true;
74 227 jshamlet
  constant Default_Int_Mask         : DATA_TYPE := x"00";
75
 
76 240 jshamlet
  -- System Memory Map
77
  constant RAM_Address              : ADDRESS_TYPE := x"0000";  -- System RAM
78
  constant ALU_Address              : ADDRESS_TYPE := x"1000";  -- ALU16 coprocessor
79
  constant RTC_Address              : ADDRESS_TYPE := x"1100";  -- System Timer / RT Clock
80
  constant ETC_Address              : ADDRESS_TYPE := x"1200";  -- Epoch Timer/Alarm Clock
81
  constant TMR_Address              : ADDRESS_TYPE := x"1400";  -- PIT timer
82
  constant SDLC_Address             : ADDRESS_TYPE := x"1800";  -- LCD serial interface
83
  constant LED_Address              : ADDRESS_TYPE := x"2000";  -- LED Display
84
  constant DSW_Address              : ADDRESS_TYPE := x"2100";  -- Dip Switches
85
  constant BTN_Address              : ADDRESS_TYPE := x"2200";  -- Push Buttons
86
  constant SER_Address              : ADDRESS_TYPE := x"2400";  -- UART interface
87
  constant MAX_Address              : ADDRESS_TYPE := x"2800";  -- Max 7221 base address
88
  constant VEC_Address              : ADDRESS_TYPE := x"3000";  -- Vector RX base address
89
  constant CHR_Address              : ADDRESS_TYPE := x"3100";  -- Elapsed Time / Chronometer
90
  constant ROM_Address              : ADDRESS_TYPE := x"8000";  -- Application ROM
91
  constant ISR_Start_Addr           : ADDRESS_TYPE := x"FFF0";  -- ISR Vector Table
92 227 jshamlet
 
93 240 jshamlet
  -- RAM size is used to calculate the initial stack pointer, which is set at
94
  --  the top of the RAM region.
95
  constant RAM_Size                 : integer   := 4096;
96 227 jshamlet
 
97
  -- Interrupt assignments
98
  -- These are assigned in order priority from 0 (highest) to 7 (lowest)
99 240 jshamlet
  constant INT_PIT                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 0;
100
  constant INT_ETC                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 1;
101
  constant INT_TMR                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 2;
102
  constant INT_ALU                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 3;
103
  constant INT_RTC                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 4;
104
  constant INT_SDLC                 : integer range 0 to OPEN8_DATA_WIDTH - 1 := 5;
105
  constant INT_BTN                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 6;
106
  constant INT_VEC                  : integer range 0 to OPEN8_DATA_WIDTH - 1 := 7;
107 227 jshamlet
 
108 240 jshamlet
  -- Set this to the number of readable modules (entities wth a Rd_Data port) in the design,
109
  --  as it sets the number of ports on the read aggregator function.
110
  constant NUM_READ_BUSES         : integer := 13;
111 227 jshamlet
 
112
  -- Read Data Bus aggregator and bus assignments.
113
  --  Note that the ordering isn't important, only that each device has a
114
  --   unique number less than READ_BUS_COUNT.
115 240 jshamlet
  constant RDB_RAM                  : integer range 0 to NUM_READ_BUSES - 1 := 0;
116
  constant RDB_ALU                  : integer range 0 to NUM_READ_BUSES - 1 := 1;
117
  constant RDB_RTC                  : integer range 0 to NUM_READ_BUSES - 1 := 2;
118
  constant RDB_TMR                  : integer range 0 to NUM_READ_BUSES - 1 := 3;
119
  constant RDB_ETC                  : integer range 0 to NUM_READ_BUSES - 1 := 4;
120
  constant RDB_LED                  : integer range 0 to NUM_READ_BUSES - 1 := 5;
121
  constant RDB_DSW                  : integer range 0 to NUM_READ_BUSES - 1 := 6;
122
  constant RDB_BTN                  : integer range 0 to NUM_READ_BUSES - 1 := 7;
123
  constant RDB_SDLC                 : integer range 0 to NUM_READ_BUSES - 1 := 8;
124
  constant RDB_SER                  : integer range 0 to NUM_READ_BUSES - 1 := 9;
125
  constant RDB_VEC                  : integer range 0 to NUM_READ_BUSES - 1 := 10;
126
  constant RDB_CHR                  : integer range 0 to NUM_READ_BUSES - 1 := 11;
127
  constant RDB_ROM                  : integer range 0 to NUM_READ_BUSES - 1 := 12;
128 227 jshamlet
 
129
  -- System configuration calculations - no adjustable parameters below this point
130 240 jshamlet
  type OPEN8_BUS_ARRAY is array(0 to NUM_READ_BUSES - 1) of DATA_TYPE;
131 227 jshamlet
 
132 240 jshamlet
  constant INIT_READ_BUS            : OPEN8_BUS_ARRAY := (others => OPEN8_NULLBUS);
133 227 jshamlet
 
134
  function merge_buses (x : in OPEN8_BUS_ARRAY) return DATA_TYPE;
135
 
136
  -- Compute the stack start address based on the RAM size
137 240 jshamlet
  constant RAM_Vector_Size          : integer := ceil_log2(RAM_Size - 1);
138
  constant RAM_End_Addr             : std_logic_vector(RAM_Vector_Size - 1 downto 0)
139
                                     := (others => '1');
140 227 jshamlet
 
141 240 jshamlet
  constant Stack_Start_Addr         : ADDRESS_TYPE := RAM_Address + RAM_End_Addr;
142 227 jshamlet
 
143
end package;
144
 
145
package body open8_cfg is
146
 
147
  function merge_buses (x : in OPEN8_BUS_ARRAY) return DATA_TYPE is
148
    variable i               : integer   := 0;
149
    variable retval          : DATA_TYPE := x"00";
150
  begin
151
    retval                   := x"00";
152 240 jshamlet
    for i in 0 to NUM_READ_BUSES - 1 loop
153 227 jshamlet
      retval                 := retval or x(i);
154
    end loop;
155
    return retval;
156
  end function;
157
 
158
end package body;

powered by: WebSVN 2.1.0

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