| 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 |
290 |
jshamlet |
constant Rotate_Ignores_Carry : boolean := TRUE;
|
| 32 |
266 |
jshamlet |
constant Default_Int_Mask : DATA_TYPE := x"00";
|
| 33 |
227 |
jshamlet |
|
| 34 |
266 |
jshamlet |
-- System Memory Map
|
| 35 |
|
|
constant RAM_Address : ADDRESS_TYPE := x"0000"; -- System RAM
|
| 36 |
|
|
constant WPR_Address : ADDRESS_TYPE := x"1000"; -- Write Protect Mask
|
| 37 |
|
|
constant WQL_Address : ADDRESS_TYPE := x"1100"; -- Write Qual Register
|
| 38 |
|
|
constant INT_Address : ADDRESS_TYPE := x"1200"; -- Interrupt Manager
|
| 39 |
|
|
constant ROM_Address : ADDRESS_TYPE := x"8000"; -- Application ROM
|
| 40 |
|
|
constant ISR_Start_Addr : ADDRESS_TYPE := x"FFF0"; -- ISR vector table
|
| 41 |
227 |
jshamlet |
|
| 42 |
266 |
jshamlet |
-- RAM size is used to calculate the initial stack pointer, which is set at
|
| 43 |
|
|
-- the top of the RAM region.
|
| 44 |
|
|
constant RAM_Size : integer := 4096;
|
| 45 |
227 |
jshamlet |
|
| 46 |
266 |
jshamlet |
constant RAM_Write_Protect : boolean := TRUE;
|
| 47 |
|
|
|
| 48 |
|
|
-- CPU Interrupt assignments - Note that interrupt 0 is the NMI (non-maskable)
|
| 49 |
|
|
-- also, because these are handled by the CPU, they are in priority order
|
| 50 |
|
|
-- from 0 (highest) to 7 (lowest).
|
| 51 |
|
|
constant CPU_INT_RAM : integer range 0 to OPEN8_DATA_WIDTH - 1 := 0;
|
| 52 |
|
|
constant CPU_INT_PIT : integer range 0 to OPEN8_DATA_WIDTH - 1 := 1;
|
| 53 |
|
|
constant CPU_INT_EXT : integer range 0 to OPEN8_DATA_WIDTH - 1 := 2;
|
| 54 |
240 |
jshamlet |
|
| 55 |
266 |
jshamlet |
-- I/O Interrupt assignments (Not technically required, as software will overwrite
|
| 56 |
|
|
-- this during initialization)
|
| 57 |
|
|
constant Default_IO_Int_Mask : ADDRESS_TYPE := x"0000";
|
| 58 |
|
|
|
| 59 |
|
|
-- Set this to the number of readable modules in the design, as it sets the
|
| 60 |
|
|
-- number of ports on the read aggregator function.
|
| 61 |
|
|
constant NUM_READ_BUSES : integer := 4;
|
| 62 |
227 |
jshamlet |
|
| 63 |
266 |
jshamlet |
-- Read Data Bus aggregator and bus assignments.
|
| 64 |
|
|
-- Note that the ordering isn't important, only that each device has a
|
| 65 |
|
|
-- unique number less than NUM_READ_BUSES.
|
| 66 |
|
|
constant RDB_RAM : integer range 0 to NUM_READ_BUSES - 1 := 0;
|
| 67 |
|
|
constant RDB_WQL : integer range 0 to NUM_READ_BUSES - 1 := 1;
|
| 68 |
|
|
constant RDB_INT : integer range 0 to NUM_READ_BUSES - 1 := 2;
|
| 69 |
|
|
constant RDB_ROM : integer range 0 to NUM_READ_BUSES - 1 := 3;
|
| 70 |
240 |
jshamlet |
|
| 71 |
266 |
jshamlet |
-- System configuration calculations - no adjustable parameters below this point
|
| 72 |
|
|
type OPEN8_BUS_ARRAY is array(0 to NUM_READ_BUSES - 1) of DATA_TYPE;
|
| 73 |
227 |
jshamlet |
|
| 74 |
266 |
jshamlet |
constant INIT_READ_BUS : OPEN8_BUS_ARRAY := (others => OPEN8_NULLBUS);
|
| 75 |
227 |
jshamlet |
|
| 76 |
266 |
jshamlet |
function merge_buses (x : in OPEN8_BUS_ARRAY) return DATA_TYPE;
|
| 77 |
227 |
jshamlet |
|
| 78 |
266 |
jshamlet |
-- Compute the stack start address based on the RAM size
|
| 79 |
|
|
constant RAM_Vector_Size : integer := ceil_log2(RAM_Size - 1);
|
| 80 |
|
|
constant RAM_End_Addr : std_logic_vector(RAM_Vector_Size - 1 downto 0)
|
| 81 |
|
|
:= (others => '1');
|
| 82 |
227 |
jshamlet |
|
| 83 |
266 |
jshamlet |
constant Stack_Start_Addr : ADDRESS_TYPE := RAM_Address + RAM_End_Addr;
|
| 84 |
227 |
jshamlet |
|
| 85 |
266 |
jshamlet |
end package;
|
| 86 |
227 |
jshamlet |
|
| 87 |
266 |
jshamlet |
package body open8_cfg is
|
| 88 |
227 |
jshamlet |
|
| 89 |
266 |
jshamlet |
function merge_buses (x : in OPEN8_BUS_ARRAY) return DATA_TYPE is
|
| 90 |
|
|
variable i : integer := 0;
|
| 91 |
|
|
variable retval : DATA_TYPE := x"00";
|
| 92 |
227 |
jshamlet |
begin
|
| 93 |
266 |
jshamlet |
retval := x"00";
|
| 94 |
|
|
for i in 0 to NUM_READ_BUSES - 1 loop
|
| 95 |
|
|
retval := retval or x(i);
|
| 96 |
|
|
end loop;
|
| 97 |
|
|
return retval;
|
| 98 |
|
|
end function;
|
| 99 |
227 |
jshamlet |
|
| 100 |
266 |
jshamlet |
end package body;
|