1
0
mirror of https://github.com/Gehstock/Mist_FPGA.git synced 2026-04-16 15:57:57 +00:00

New Core, Berzerk

This commit is contained in:
Gehstock
2018-07-08 07:33:45 +02:00
parent 8adcc0909c
commit da7744ce8c
36 changed files with 9728 additions and 3 deletions

View File

@@ -0,0 +1,30 @@
# -------------------------------------------------------------------------- #
#
# Copyright (C) 1991-2013 Altera Corporation
# Your use of Altera Corporation's design tools, logic functions
# and other software and tools, and its AMPP partner logic
# functions, and any output files from any of the foregoing
# (including device programming or simulation files), and any
# associated documentation or information are expressly subject
# to the terms and conditions of the Altera Program License
# Subscription Agreement, Altera MegaCore Function License
# Agreement, or other applicable license agreement, including,
# without limitation, that your use is for the sole purpose of
# programming logic devices manufactured by Altera and sold by
# Altera or its authorized distributors. Please refer to the
# applicable agreement for further details.
#
# -------------------------------------------------------------------------- #
#
# Quartus II 64-Bit
# Version 13.1.0 Build 162 10/23/2013 SJ Web Edition
# Date created = 23:59:05 March 16, 2017
#
# -------------------------------------------------------------------------- #
QUARTUS_VERSION = "13.1"
DATE = "23:59:05 March 16, 2017"
# Revisions
PROJECT_REVISION = "Berzerk_MiST"

View File

@@ -0,0 +1,226 @@
# -------------------------------------------------------------------------- #
#
# Copyright (C) 1991-2013 Altera Corporation
# Your use of Altera Corporation's design tools, logic functions
# and other software and tools, and its AMPP partner logic
# functions, and any output files from any of the foregoing
# (including device programming or simulation files), and any
# associated documentation or information are expressly subject
# to the terms and conditions of the Altera Program License
# Subscription Agreement, Altera MegaCore Function License
# Agreement, or other applicable license agreement, including,
# without limitation, that your use is for the sole purpose of
# programming logic devices manufactured by Altera and sold by
# Altera or its authorized distributors. Please refer to the
# applicable agreement for further details.
#
# -------------------------------------------------------------------------- #
#
# Quartus II 64-Bit
# Version 13.1.0 Build 162 10/23/2013 SJ Web Edition
# Date created = 18:40:37 November 24, 2017
#
# -------------------------------------------------------------------------- #
#
# Notes:
#
# 1) The default values for assignments are stored in the file:
# ace_assignment_defaults.qdf
# If this file doesn't exist, see file:
# assignment_defaults.qdf
#
# 2) Altera recommends that you do not modify this file. This
# file is updated automatically by the Quartus II software
# and any changes you make may be lost or overwritten.
#
# -------------------------------------------------------------------------- #
# Project-Wide Assignments
# ========================
set_global_assignment -name ORIGINAL_QUARTUS_VERSION 13.1
set_global_assignment -name PROJECT_CREATION_TIME_DATE "23:59:05 MARCH 16, 2017"
set_global_assignment -name LAST_QUARTUS_VERSION "13.0 SP1"
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY Output
set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:rtl/build_id.tcl"
# Pin & Location Assignments
# ==========================
set_location_assignment PIN_54 -to CLOCK_27
set_location_assignment PIN_7 -to LED
set_location_assignment PIN_144 -to VGA_R[5]
set_location_assignment PIN_143 -to VGA_R[4]
set_location_assignment PIN_142 -to VGA_R[3]
set_location_assignment PIN_141 -to VGA_R[2]
set_location_assignment PIN_137 -to VGA_R[1]
set_location_assignment PIN_135 -to VGA_R[0]
set_location_assignment PIN_133 -to VGA_B[5]
set_location_assignment PIN_132 -to VGA_B[4]
set_location_assignment PIN_125 -to VGA_B[3]
set_location_assignment PIN_121 -to VGA_B[2]
set_location_assignment PIN_120 -to VGA_B[1]
set_location_assignment PIN_115 -to VGA_B[0]
set_location_assignment PIN_114 -to VGA_G[5]
set_location_assignment PIN_113 -to VGA_G[4]
set_location_assignment PIN_112 -to VGA_G[3]
set_location_assignment PIN_111 -to VGA_G[2]
set_location_assignment PIN_110 -to VGA_G[1]
set_location_assignment PIN_106 -to VGA_G[0]
set_location_assignment PIN_136 -to VGA_VS
set_location_assignment PIN_119 -to VGA_HS
set_location_assignment PIN_65 -to AUDIO_L
set_location_assignment PIN_80 -to AUDIO_R
set_location_assignment PIN_105 -to SPI_DO
set_location_assignment PIN_88 -to SPI_DI
set_location_assignment PIN_126 -to SPI_SCK
set_location_assignment PIN_127 -to SPI_SS2
set_location_assignment PIN_91 -to SPI_SS3
set_location_assignment PIN_90 -to SPI_SS4
set_location_assignment PIN_13 -to CONF_DATA0
set_location_assignment PIN_49 -to SDRAM_A[0]
set_location_assignment PIN_44 -to SDRAM_A[1]
set_location_assignment PIN_42 -to SDRAM_A[2]
set_location_assignment PIN_39 -to SDRAM_A[3]
set_location_assignment PIN_4 -to SDRAM_A[4]
set_location_assignment PIN_6 -to SDRAM_A[5]
set_location_assignment PIN_8 -to SDRAM_A[6]
set_location_assignment PIN_10 -to SDRAM_A[7]
set_location_assignment PIN_11 -to SDRAM_A[8]
set_location_assignment PIN_28 -to SDRAM_A[9]
set_location_assignment PIN_50 -to SDRAM_A[10]
set_location_assignment PIN_30 -to SDRAM_A[11]
set_location_assignment PIN_32 -to SDRAM_A[12]
set_location_assignment PIN_83 -to SDRAM_DQ[0]
set_location_assignment PIN_79 -to SDRAM_DQ[1]
set_location_assignment PIN_77 -to SDRAM_DQ[2]
set_location_assignment PIN_76 -to SDRAM_DQ[3]
set_location_assignment PIN_72 -to SDRAM_DQ[4]
set_location_assignment PIN_71 -to SDRAM_DQ[5]
set_location_assignment PIN_69 -to SDRAM_DQ[6]
set_location_assignment PIN_68 -to SDRAM_DQ[7]
set_location_assignment PIN_86 -to SDRAM_DQ[8]
set_location_assignment PIN_87 -to SDRAM_DQ[9]
set_location_assignment PIN_98 -to SDRAM_DQ[10]
set_location_assignment PIN_99 -to SDRAM_DQ[11]
set_location_assignment PIN_100 -to SDRAM_DQ[12]
set_location_assignment PIN_101 -to SDRAM_DQ[13]
set_location_assignment PIN_103 -to SDRAM_DQ[14]
set_location_assignment PIN_104 -to SDRAM_DQ[15]
set_location_assignment PIN_58 -to SDRAM_BA[0]
set_location_assignment PIN_51 -to SDRAM_BA[1]
set_location_assignment PIN_85 -to SDRAM_DQMH
set_location_assignment PIN_67 -to SDRAM_DQML
set_location_assignment PIN_60 -to SDRAM_nRAS
set_location_assignment PIN_64 -to SDRAM_nCAS
set_location_assignment PIN_66 -to SDRAM_nWE
set_location_assignment PIN_59 -to SDRAM_nCS
set_location_assignment PIN_33 -to SDRAM_CKE
set_location_assignment PIN_43 -to SDRAM_CLK
set_location_assignment PIN_31 -to UART_RX
set_location_assignment PIN_46 -to UART_TX
# Classic Timing Assignments
# ==========================
set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0
set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85
# Analysis & Synthesis Assignments
# ================================
set_global_assignment -name FAMILY "Cyclone III"
set_global_assignment -name TOP_LEVEL_ENTITY berzerk_mist
# Fitter Assignments
# ==================
set_global_assignment -name DEVICE EP3C25E144C8
set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 1
set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVTTL"
# set_global_assignment -name ENABLE_CONFIGURATION_PINS OFF
# set_global_assignment -name ENABLE_NCE_PIN OFF
# set_global_assignment -name ENABLE_BOOT_SEL_PIN OFF
set_global_assignment -name CYCLONEIII_CONFIGURATION_SCHEME "PASSIVE SERIAL"
set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF
set_global_assignment -name FORCE_CONFIGURATION_VCCIO ON
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_DATA0_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_DATA1_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "USE AS REGULAR IO"
set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "USE AS REGULAR IO"
# EDA Netlist Writer Assignments
# ==============================
set_global_assignment -name EDA_SIMULATION_TOOL "ModelSim-Altera (VHDL)"
# Assembler Assignments
# =====================
set_global_assignment -name USE_CONFIGURATION_DEVICE OFF
set_global_assignment -name GENERATE_RBF_FILE ON
# Power Estimation Assignments
# ============================
set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW"
set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)"
# Advanced I/O Timing Assignments
# ===============================
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall
# start EDA_TOOL_SETTINGS(eda_simulation)
# ---------------------------------------
# EDA Netlist Writer Assignments
# ==============================
set_global_assignment -name EDA_OUTPUT_DATA_FORMAT VHDL -section_id eda_simulation
# end EDA_TOOL_SETTINGS(eda_simulation)
# -------------------------------------
# ----------------------
# start ENTITY(ace_mist)
# start DESIGN_PARTITION(Top)
# ---------------------------
# Incremental Compilation Assignments
# ===================================
# end DESIGN_PARTITION(Top)
# -------------------------
# end ENTITY(ace_mist)
# --------------------
set_global_assignment -name DEVICE_FILTER_PACKAGE TQFP
set_global_assignment -name DEVICE_FILTER_PIN_COUNT 144
set_global_assignment -name DEVICE_FILTER_SPEED_GRADE 8
set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005
set_global_assignment -name VERILOG_SHOW_LMF_MAPPING_MESSAGES OFF
set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
set_global_assignment -name SYSTEMVERILOG_FILE rtl/berzerk_mist.sv
set_global_assignment -name VHDL_FILE rtl/berzerk.vhd
set_global_assignment -name VHDL_FILE rtl/berzerk_speech.vhd
set_global_assignment -name VHDL_FILE rtl/berzerk_sound_fx.vhd
set_global_assignment -name VHDL_FILE rtl/berzerk_program2.vhd
set_global_assignment -name VHDL_FILE rtl/berzerk_program1.vhd
set_global_assignment -name VHDL_FILE rtl/line_doubler.vhd
set_global_assignment -name SYSTEMVERILOG_FILE rtl/video_mixer.sv
set_global_assignment -name VHDL_FILE rtl/video_gen.vhd
set_global_assignment -name VERILOG_FILE rtl/scandoubler.v
set_global_assignment -name VERILOG_FILE rtl/pll.v
set_global_assignment -name VERILOG_FILE rtl/osd.v
set_global_assignment -name VERILOG_FILE rtl/mist_io.v
set_global_assignment -name VERILOG_FILE rtl/keyboard.v
set_global_assignment -name SYSTEMVERILOG_FILE rtl/hq2x.sv
set_global_assignment -name VHDL_FILE rtl/gen_ram.vhd
set_global_assignment -name VHDL_FILE rtl/dac.vhd
set_global_assignment -name VHDL_FILE rtl/T80/T80se.vhd
set_global_assignment -name VHDL_FILE rtl/T80/T80_Reg.vhd
set_global_assignment -name VHDL_FILE rtl/T80/T80_Pack.vhd
set_global_assignment -name VHDL_FILE rtl/T80/T80_MCode.vhd
set_global_assignment -name VHDL_FILE rtl/T80/T80_ALU.vhd
set_global_assignment -name VHDL_FILE rtl/T80/T80.vhd
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

View File

@@ -0,0 +1,152 @@
Berzerk Port to MiST
Nothing is tested need Feedback
-------------------------------------------------
-- Berzerk FPGA by Dar - (darfpga@aol.fr)
-- http://darfpga.blogspot.fr
-------------------------------------------------
-- Berzerk releases
--
-- Release 0.0 - 07/07/2018 - Dar
-------------------------------------------------
Educational use only
Do not redistribute synthetized file with roms
Do not redistribute roms whatever the form
Use at your own risk
--------------------------------------------------------------------
make sure to use berzerk.zip roms
--------------------------------------------------------------------
--
-- Main features :
-- PS2 keyboard input @gpio pins 35/34 (beware voltage translation/protection)
-- Audio pwm output @gpio pins 1/3 (beware voltage translation/protection)
--
-- Uses 1 pll for 10MHz generation from 50MHz
--
-- Board key :
-- 0 : reset game
--
-- Board switch :
-- 1 : tv 15Khz mode / VGA 640x480 mode
--
-- Keyboard players inputs :
--
-- F3 : Add coin
-- F2 : Start 2 players
-- F1 : Start 1 player
-- SPACE : fire
-- RIGHT arrow : move right
-- LEFT arrow : move left
-- UP arrow : move up
-- DOWN arrow : move down
--
-- Sound effects : OK
-- Speech synthesis : todo
--
---------------
VHDL File list
---------------
max10_pll_10M.vhd Pll 10MHz from 50MHz altera mf
berzerk_de10_lite.vhd Top level for de10-lite board
berzerk.vhd Main logic
berzerk_sound_fx.vhd Music logic
berzerk_program1.vhd
berzerk_program2.vhd
video_gen.vhd Video scheduler, syncs (h,v and composite)
line_doubler.vhd Line doubler 15kHz -> 31kHz VGA
kbd_joystick.vhd Keyboard key to player/coin input
T80se.vhd T80 release 304
T80_Reg.vhd
T80_Pack.vhd
T80_MCode.vhd
T80_ALU.vhd
T80.vhd
io_ps2_keyboard.vhd Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com)
gen_ram.vhd
decodeur_7_seg.vhd for debug
----------------------
Quartus project files
----------------------
de10_lite/berzerk_de10_lite.qsf de10_lite settings (files,pins,...)
de10_lite/berzerk_de10_lite.qpf de10_lite project
de10_lite/berzerk_de10_lite.sdc timequest constraints
+----------------------------------------------------------------------------------+
; Fitter Summary ;
+------------------------------------+---------------------------------------------+
; Fitter Status ; Successful - Sat Jul 07 07:38:44 2018 ;
; Quartus Prime Version ; 16.1.0 Build 196 10/24/2016 SJ Lite Edition ;
; Revision Name ; berzerk_de10_lite ;
; Top-level Entity Name ; berzerk_de10_lite ;
; Family ; MAX 10 ;
; Device ; 10M50DAF484C6GES ;
; Timing Models ; Preliminary ;
; Total logic elements ; 3,277 / 49,760 ( 7 % ) ;
; Total combinational functions ; 3,043 / 49,760 ( 6 % ) ;
; Dedicated logic registers ; 886 / 49,760 ( 2 % ) ;
; Total registers ; 886 ;
; Total pins ; 121 / 360 ( 34 % ) ;
; Total virtual pins ; 0 ;
; Total memory bits ; 241,664 / 1,677,312 ( 14 % ) ;
; Embedded Multiplier 9-bit elements ; 0 / 288 ( 0 % ) ;
; Total PLLs ; 1 / 4 ( 25 % ) ;
; UFM blocks ; 0 / 1 ( 0 % ) ;
; ADC blocks ; 0 / 2 ( 0 % ) ;
+------------------------------------+---------------------------------------------+
-----------------------------
Required ROMs (Not included)
-----------------------------
You need the following 8 ROMs from berzerk.zip
berzerk_rc31_1c.rom0.1c CRC(ca566dbc) SHA1(fae2647f12f1cd82826db61b53b116a5e0c9f995)
berzerk_rc31_1d.rom1.1d CRC(7ba69fde) SHA1(69af170c4a39a3494dcd180737e5c87b455f9203)
berzerk_rc31_3d.rom2.3d CRC(a1d5248b) SHA1(a0b7842f6a5f86c16d80d78e7012c78b3ea11d1d)
berzerk_rc31_5d.rom3.5d CRC(fcaefa95) SHA1(07f849aa39f1e3db938187ffde4a46a588156ddc)
berzerk_rc31_6d.rom4.6d CRC(1e35b9a0) SHA1(5a5e549ec0e4803ab2d1eac6b3e7171aedf28244)
berzerk_rc31_5c.rom5.5c CRC(c8c665e5) SHA1(e9eca4b119549e0061384abf52327c14b0d56624)
berzerk_r_vo_1c.1c CRC(2cfe825d) SHA1(f12fed8712f20fa8213f606c4049a8144bfea42e)
berzerk_r_vo_2c.2c CRC(d2b6324e) SHA1(20a6611ad6ec19409ac138bdae7bdfaeab6c47cf)
------
Tools
------
You need to build vhdl ROM image files from the binary file :
- Unzip the roms file in the tools/berzerk_unzip directory
- Double click (execute) the script tools/berzerk_unzip/make_berzerk_proms.bat to get the following files
berzerk_program1.vhd
berzerk_program2.vhd
*DO NOT REDISTRIBUTE THESE FILES*
The script make_berzerk_proms uses make_vhdl_prom and and duplicate_byte executables delivered both in linux and windows version. The script itself is delivered only in windows version (.bat) but should be easily ported to linux.
Source code of make_vhdl_prom.c and and duplicate_byte.c is also delivered.
---------------------------------
Compiling for de10_lite
---------------------------------
You can rebuild the project with ROM image embeded in the sof file. DO NOT REDISTRIBUTE THESE FILES.
4 steps
- put the VHDL rom files into the project directory
- rebuild berzerk_de10_lite
- program berzerk_de10_lite.sof into the fpga
------------------------
End of file
------------------------

View File

@@ -0,0 +1,37 @@
@echo off
del /s *.bak
del /s *.orig
del /s *.rej
del /s *~
rmdir /s /q db
rmdir /s /q incremental_db
rmdir /s /q output_files
rmdir /s /q simulation
rmdir /s /q greybox_tmp
rmdir /s /q hc_output
rmdir /s /q .qsys_edit
rmdir /s /q hps_isw_handoff
rmdir /s /q sys\.qsys_edit
rmdir /s /q sys\vip
cd sys
for /d %%i in (*_sim) do rmdir /s /q "%%~nxi"
cd ..
for /d %%i in (*_sim) do rmdir /s /q "%%~nxi"
del build_id.v
del c5_pin_model_dump.txt
del PLLJ_PLLSPE_INFO.txt
del /s *.qws
del /s *.ppf
del /s *.ddb
del /s *.csv
del /s *.cmp
del /s *.sip
del /s *.spd
del /s *.bsf
del /s *.f
del /s *.sopcinfo
del /s *.xml
del /s new_rtl_netlist
del /s old_rtl_netlist
pause

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,199 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T8080se.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- 8080 compatible microprocessor core, synchronous top level with clock enable
-- Different timing than the original 8080
-- Inputs needs to be synchronous and outputs may glitch
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t80/
--
-- Limitations :
-- STACK status output not supported
--
-- File history :
--
-- 0237 : First version
--
-- 0238 : Updated for T80 interface change
--
-- 0240 : Updated for T80 interface change
--
-- 0242 : Updated for T80 interface change
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use work.T80_Pack.all;
entity T8080se is
generic(
Mode : integer := 2; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
T2Write : integer := 1 -- 0 => WR_n active in T3, /=0 => WR_n active in T2
);
port(
RESET_n : in std_logic;
CLK : in std_logic;
CLKEN : in std_logic;
READY : in std_logic;
HOLD : in std_logic;
INT : in std_logic;
INTE : out std_logic;
DBIN : out std_logic;
SYNC : out std_logic;
VAIT : out std_logic;
HLDA : out std_logic;
RD_n : out std_logic;
WR_n : out std_logic;
A : out std_logic_vector(15 downto 0);
DI : in std_logic_vector(7 downto 0);
DO : out std_logic_vector(7 downto 0)
);
end T8080se;
architecture rtl of T8080se is
signal IntCycle_n : std_logic;
signal NoRead : std_logic;
signal Write : std_logic;
signal IORQ : std_logic;
signal INT_n : std_logic;
signal HALT_n : std_logic;
signal BUSRQ_n : std_logic;
signal BUSAK_n : std_logic;
signal DO_i : std_logic_vector(7 downto 0);
signal DI_Reg : std_logic_vector(7 downto 0);
signal MCycle : std_logic_vector(2 downto 0);
signal TState : std_logic_vector(2 downto 0);
signal One : std_logic;
begin
INT_n <= not INT;
BUSRQ_n <= HOLD;
HLDA <= not BUSAK_n;
SYNC <= '1' when TState = "001" else '0';
VAIT <= '1' when TState = "010" else '0';
One <= '1';
DO(0) <= not IntCycle_n when TState = "001" else DO_i(0); -- INTA
DO(1) <= Write when TState = "001" else DO_i(1); -- WO_n
DO(2) <= DO_i(2); -- STACK not supported !!!!!!!!!!
DO(3) <= not HALT_n when TState = "001" else DO_i(3); -- HLTA
DO(4) <= IORQ and Write when TState = "001" else DO_i(4); -- OUT
DO(5) <= DO_i(5) when TState /= "001" else '1' when MCycle = "001" else '0'; -- M1
DO(6) <= IORQ and not Write when TState = "001" else DO_i(6); -- INP
DO(7) <= not IORQ and not Write and IntCycle_n when TState = "001" else DO_i(7); -- MEMR
u0 : T80
generic map(
Mode => Mode,
IOWait => 0)
port map(
CEN => CLKEN,
M1_n => open,
IORQ => IORQ,
NoRead => NoRead,
Write => Write,
RFSH_n => open,
HALT_n => HALT_n,
WAIT_n => READY,
INT_n => INT_n,
NMI_n => One,
RESET_n => RESET_n,
BUSRQ_n => One,
BUSAK_n => BUSAK_n,
CLK_n => CLK,
A => A,
DInst => DI,
DI => DI_Reg,
DO => DO_i,
MC => MCycle,
TS => TState,
IntCycle_n => IntCycle_n,
IntE => INTE);
process (RESET_n, CLK)
begin
if RESET_n = '0' then
DBIN <= '0';
RD_n <= '0';
WR_n <= '1';
DI_Reg <= "00000000";
elsif CLK'event and CLK = '1' then
if CLKEN = '1' then
DBIN <= '0';
RD_n <= '0';
WR_n <= '1';
if MCycle = "001" then
if TState = "001" or (TState = "010" and READY = '0') then
DBIN <= IntCycle_n;
end if;
else
if (TState = "001" or (TState = "010" and READY = '0')) and NoRead = '0' and Write = '0' then
DBIN <= '1';
end if;
if T2Write = 0 then
if TState = "010" and Write = '1' then
WR_n <= '0';
RD_n <= '1';
end if;
else
if (TState = "001" or (TState = "010" and READY = '0')) and Write = '1' then
WR_n <= '0';
RD_n <= '1';
end if;
end if;
end if;
if TState = "010" and READY = '1' then
DI_Reg <= DI;
end if;
end if;
end if;
end process;
end;

View File

@@ -0,0 +1,371 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
-- Ver 301 parity flag is just parity for 8080, also overflow for Z80, by Sean Riddle
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T80_ALU.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- Z80 compatible microprocessor core
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t80/
--
-- Limitations :
--
-- File history :
--
-- 0214 : Fixed mostly flags, only the block instructions now fail the zex regression test
--
-- 0238 : Fixed zero flag for 16 bit SBC and ADC
--
-- 0240 : Added GB operations
--
-- 0242 : Cleanup
--
-- 0247 : Cleanup
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity T80_ALU is
generic(
Mode : integer := 0;
Flag_C : integer := 0;
Flag_N : integer := 1;
Flag_P : integer := 2;
Flag_X : integer := 3;
Flag_H : integer := 4;
Flag_Y : integer := 5;
Flag_Z : integer := 6;
Flag_S : integer := 7
);
port(
Arith16 : in std_logic;
Z16 : in std_logic;
ALU_Op : in std_logic_vector(3 downto 0);
IR : in std_logic_vector(5 downto 0);
ISet : in std_logic_vector(1 downto 0);
BusA : in std_logic_vector(7 downto 0);
BusB : in std_logic_vector(7 downto 0);
F_In : in std_logic_vector(7 downto 0);
Q : out std_logic_vector(7 downto 0);
F_Out : out std_logic_vector(7 downto 0)
);
end T80_ALU;
architecture rtl of T80_ALU is
procedure AddSub(A : std_logic_vector;
B : std_logic_vector;
Sub : std_logic;
Carry_In : std_logic;
signal Res : out std_logic_vector;
signal Carry : out std_logic) is
variable B_i : unsigned(A'length - 1 downto 0);
variable Res_i : unsigned(A'length + 1 downto 0);
begin
if Sub = '1' then
B_i := not unsigned(B);
else
B_i := unsigned(B);
end if;
Res_i := unsigned("0" & A & Carry_In) + unsigned("0" & B_i & "1");
Carry <= Res_i(A'length + 1);
Res <= std_logic_vector(Res_i(A'length downto 1));
end;
-- AddSub variables (temporary signals)
signal UseCarry : std_logic;
signal Carry7_v : std_logic;
signal Overflow_v : std_logic;
signal HalfCarry_v : std_logic;
signal Carry_v : std_logic;
signal Q_v : std_logic_vector(7 downto 0);
signal BitMask : std_logic_vector(7 downto 0);
begin
with IR(5 downto 3) select BitMask <= "00000001" when "000",
"00000010" when "001",
"00000100" when "010",
"00001000" when "011",
"00010000" when "100",
"00100000" when "101",
"01000000" when "110",
"10000000" when others;
UseCarry <= not ALU_Op(2) and ALU_Op(0);
AddSub(BusA(3 downto 0), BusB(3 downto 0), ALU_Op(1), ALU_Op(1) xor (UseCarry and F_In(Flag_C)), Q_v(3 downto 0), HalfCarry_v);
AddSub(BusA(6 downto 4), BusB(6 downto 4), ALU_Op(1), HalfCarry_v, Q_v(6 downto 4), Carry7_v);
AddSub(BusA(7 downto 7), BusB(7 downto 7), ALU_Op(1), Carry7_v, Q_v(7 downto 7), Carry_v);
-- bug fix - parity flag is just parity for 8080, also overflow for Z80
process (Carry_v, Carry7_v, Q_v)
begin
if(Mode=2) then
OverFlow_v <= not (Q_v(0) xor Q_v(1) xor Q_v(2) xor Q_v(3) xor
Q_v(4) xor Q_v(5) xor Q_v(6) xor Q_v(7)); else
OverFlow_v <= Carry_v xor Carry7_v;
end if;
end process;
process (Arith16, ALU_OP, F_In, BusA, BusB, IR, Q_v, Carry_v, HalfCarry_v, OverFlow_v, BitMask, ISet, Z16)
variable Q_t : std_logic_vector(7 downto 0);
variable DAA_Q : unsigned(8 downto 0);
begin
Q_t := "--------";
F_Out <= F_In;
DAA_Q := "---------";
case ALU_Op is
when "0000" | "0001" | "0010" | "0011" | "0100" | "0101" | "0110" | "0111" =>
F_Out(Flag_N) <= '0';
F_Out(Flag_C) <= '0';
case ALU_OP(2 downto 0) is
when "000" | "001" => -- ADD, ADC
Q_t := Q_v;
F_Out(Flag_C) <= Carry_v;
F_Out(Flag_H) <= HalfCarry_v;
F_Out(Flag_P) <= OverFlow_v;
when "010" | "011" | "111" => -- SUB, SBC, CP
Q_t := Q_v;
F_Out(Flag_N) <= '1';
F_Out(Flag_C) <= not Carry_v;
F_Out(Flag_H) <= not HalfCarry_v;
F_Out(Flag_P) <= OverFlow_v;
when "100" => -- AND
Q_t(7 downto 0) := BusA and BusB;
F_Out(Flag_H) <= '1';
when "101" => -- XOR
Q_t(7 downto 0) := BusA xor BusB;
F_Out(Flag_H) <= '0';
when others => -- OR "110"
Q_t(7 downto 0) := BusA or BusB;
F_Out(Flag_H) <= '0';
end case;
if ALU_Op(2 downto 0) = "111" then -- CP
F_Out(Flag_X) <= BusB(3);
F_Out(Flag_Y) <= BusB(5);
else
F_Out(Flag_X) <= Q_t(3);
F_Out(Flag_Y) <= Q_t(5);
end if;
if Q_t(7 downto 0) = "00000000" then
F_Out(Flag_Z) <= '1';
if Z16 = '1' then
F_Out(Flag_Z) <= F_In(Flag_Z); -- 16 bit ADC,SBC
end if;
else
F_Out(Flag_Z) <= '0';
end if;
F_Out(Flag_S) <= Q_t(7);
case ALU_Op(2 downto 0) is
when "000" | "001" | "010" | "011" | "111" => -- ADD, ADC, SUB, SBC, CP
when others =>
F_Out(Flag_P) <= not (Q_t(0) xor Q_t(1) xor Q_t(2) xor Q_t(3) xor
Q_t(4) xor Q_t(5) xor Q_t(6) xor Q_t(7));
end case;
if Arith16 = '1' then
F_Out(Flag_S) <= F_In(Flag_S);
F_Out(Flag_Z) <= F_In(Flag_Z);
F_Out(Flag_P) <= F_In(Flag_P);
end if;
when "1100" =>
-- DAA
F_Out(Flag_H) <= F_In(Flag_H);
F_Out(Flag_C) <= F_In(Flag_C);
DAA_Q(7 downto 0) := unsigned(BusA);
DAA_Q(8) := '0';
if F_In(Flag_N) = '0' then
-- After addition
-- Alow > 9 or H = 1
if DAA_Q(3 downto 0) > 9 or F_In(Flag_H) = '1' then
if (DAA_Q(3 downto 0) > 9) then
F_Out(Flag_H) <= '1';
else
F_Out(Flag_H) <= '0';
end if;
DAA_Q := DAA_Q + 6;
end if;
-- new Ahigh > 9 or C = 1
if DAA_Q(8 downto 4) > 9 or F_In(Flag_C) = '1' then
DAA_Q := DAA_Q + 96; -- 0x60
end if;
else
-- After subtraction
if DAA_Q(3 downto 0) > 9 or F_In(Flag_H) = '1' then
if DAA_Q(3 downto 0) > 5 then
F_Out(Flag_H) <= '0';
end if;
DAA_Q(7 downto 0) := DAA_Q(7 downto 0) - 6;
end if;
if unsigned(BusA) > 153 or F_In(Flag_C) = '1' then
DAA_Q := DAA_Q - 352; -- 0x160
end if;
end if;
F_Out(Flag_X) <= DAA_Q(3);
F_Out(Flag_Y) <= DAA_Q(5);
F_Out(Flag_C) <= F_In(Flag_C) or DAA_Q(8);
Q_t := std_logic_vector(DAA_Q(7 downto 0));
if DAA_Q(7 downto 0) = "00000000" then
F_Out(Flag_Z) <= '1';
else
F_Out(Flag_Z) <= '0';
end if;
F_Out(Flag_S) <= DAA_Q(7);
F_Out(Flag_P) <= not (DAA_Q(0) xor DAA_Q(1) xor DAA_Q(2) xor DAA_Q(3) xor
DAA_Q(4) xor DAA_Q(5) xor DAA_Q(6) xor DAA_Q(7));
when "1101" | "1110" =>
-- RLD, RRD
Q_t(7 downto 4) := BusA(7 downto 4);
if ALU_Op(0) = '1' then
Q_t(3 downto 0) := BusB(7 downto 4);
else
Q_t(3 downto 0) := BusB(3 downto 0);
end if;
F_Out(Flag_H) <= '0';
F_Out(Flag_N) <= '0';
F_Out(Flag_X) <= Q_t(3);
F_Out(Flag_Y) <= Q_t(5);
if Q_t(7 downto 0) = "00000000" then
F_Out(Flag_Z) <= '1';
else
F_Out(Flag_Z) <= '0';
end if;
F_Out(Flag_S) <= Q_t(7);
F_Out(Flag_P) <= not (Q_t(0) xor Q_t(1) xor Q_t(2) xor Q_t(3) xor
Q_t(4) xor Q_t(5) xor Q_t(6) xor Q_t(7));
when "1001" =>
-- BIT
Q_t(7 downto 0) := BusB and BitMask;
F_Out(Flag_S) <= Q_t(7);
if Q_t(7 downto 0) = "00000000" then
F_Out(Flag_Z) <= '1';
F_Out(Flag_P) <= '1';
else
F_Out(Flag_Z) <= '0';
F_Out(Flag_P) <= '0';
end if;
F_Out(Flag_H) <= '1';
F_Out(Flag_N) <= '0';
F_Out(Flag_X) <= '0';
F_Out(Flag_Y) <= '0';
if IR(2 downto 0) /= "110" then
F_Out(Flag_X) <= BusB(3);
F_Out(Flag_Y) <= BusB(5);
end if;
when "1010" =>
-- SET
Q_t(7 downto 0) := BusB or BitMask;
when "1011" =>
-- RES
Q_t(7 downto 0) := BusB and not BitMask;
when "1000" =>
-- ROT
case IR(5 downto 3) is
when "000" => -- RLC
Q_t(7 downto 1) := BusA(6 downto 0);
Q_t(0) := BusA(7);
F_Out(Flag_C) <= BusA(7);
when "010" => -- RL
Q_t(7 downto 1) := BusA(6 downto 0);
Q_t(0) := F_In(Flag_C);
F_Out(Flag_C) <= BusA(7);
when "001" => -- RRC
Q_t(6 downto 0) := BusA(7 downto 1);
Q_t(7) := BusA(0);
F_Out(Flag_C) <= BusA(0);
when "011" => -- RR
Q_t(6 downto 0) := BusA(7 downto 1);
Q_t(7) := F_In(Flag_C);
F_Out(Flag_C) <= BusA(0);
when "100" => -- SLA
Q_t(7 downto 1) := BusA(6 downto 0);
Q_t(0) := '0';
F_Out(Flag_C) <= BusA(7);
when "110" => -- SLL (Undocumented) / SWAP
if Mode = 3 then
Q_t(7 downto 4) := BusA(3 downto 0);
Q_t(3 downto 0) := BusA(7 downto 4);
F_Out(Flag_C) <= '0';
else
Q_t(7 downto 1) := BusA(6 downto 0);
Q_t(0) := '1';
F_Out(Flag_C) <= BusA(7);
end if;
when "101" => -- SRA
Q_t(6 downto 0) := BusA(7 downto 1);
Q_t(7) := BusA(7);
F_Out(Flag_C) <= BusA(0);
when others => -- SRL
Q_t(6 downto 0) := BusA(7 downto 1);
Q_t(7) := '0';
F_Out(Flag_C) <= BusA(0);
end case;
F_Out(Flag_H) <= '0';
F_Out(Flag_N) <= '0';
F_Out(Flag_X) <= Q_t(3);
F_Out(Flag_Y) <= Q_t(5);
F_Out(Flag_S) <= Q_t(7);
if Q_t(7 downto 0) = "00000000" then
F_Out(Flag_Z) <= '1';
else
F_Out(Flag_Z) <= '0';
end if;
F_Out(Flag_P) <= not (Q_t(0) xor Q_t(1) xor Q_t(2) xor Q_t(3) xor
Q_t(4) xor Q_t(5) xor Q_t(6) xor Q_t(7));
if ISet = "00" then
F_Out(Flag_P) <= F_In(Flag_P);
F_Out(Flag_S) <= F_In(Flag_S);
F_Out(Flag_Z) <= F_In(Flag_Z);
end if;
when others =>
null;
end case;
Q <= Q_t;
end process;
end;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,220 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
-- Ver 303 add undocumented DDCB and FDCB opcodes by TobiFlex 20.04.2010
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T80_Pack.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- Z80 compatible microprocessor core
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t80/
--
-- Limitations :
--
-- File history :
--
library IEEE;
use IEEE.std_logic_1164.all;
package T80_Pack is
component T80
generic(
Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
IOWait : integer := 0; -- 1 => Single cycle I/O, 1 => Std I/O cycle
Flag_C : integer := 0;
Flag_N : integer := 1;
Flag_P : integer := 2;
Flag_X : integer := 3;
Flag_H : integer := 4;
Flag_Y : integer := 5;
Flag_Z : integer := 6;
Flag_S : integer := 7
);
port(
RESET_n : in std_logic;
CLK_n : in std_logic;
CEN : in std_logic;
WAIT_n : in std_logic;
INT_n : in std_logic;
NMI_n : in std_logic;
BUSRQ_n : in std_logic;
M1_n : out std_logic;
IORQ : out std_logic;
NoRead : out std_logic;
Write : out std_logic;
RFSH_n : out std_logic;
HALT_n : out std_logic;
BUSAK_n : out std_logic;
A : out std_logic_vector(15 downto 0);
DInst : in std_logic_vector(7 downto 0);
DI : in std_logic_vector(7 downto 0);
DO : out std_logic_vector(7 downto 0);
MC : out std_logic_vector(2 downto 0);
TS : out std_logic_vector(2 downto 0);
IntCycle_n : out std_logic;
IntE : out std_logic;
Stop : out std_logic
);
end component;
component T80_Reg
port(
Clk : in std_logic;
CEN : in std_logic;
WEH : in std_logic;
WEL : in std_logic;
AddrA : in std_logic_vector(2 downto 0);
AddrB : in std_logic_vector(2 downto 0);
AddrC : in std_logic_vector(2 downto 0);
DIH : in std_logic_vector(7 downto 0);
DIL : in std_logic_vector(7 downto 0);
DOAH : out std_logic_vector(7 downto 0);
DOAL : out std_logic_vector(7 downto 0);
DOBH : out std_logic_vector(7 downto 0);
DOBL : out std_logic_vector(7 downto 0);
DOCH : out std_logic_vector(7 downto 0);
DOCL : out std_logic_vector(7 downto 0)
);
end component;
component T80_MCode
generic(
Mode : integer := 0;
Flag_C : integer := 0;
Flag_N : integer := 1;
Flag_P : integer := 2;
Flag_X : integer := 3;
Flag_H : integer := 4;
Flag_Y : integer := 5;
Flag_Z : integer := 6;
Flag_S : integer := 7
);
port(
IR : in std_logic_vector(7 downto 0);
ISet : in std_logic_vector(1 downto 0);
MCycle : in std_logic_vector(2 downto 0);
F : in std_logic_vector(7 downto 0);
NMICycle : in std_logic;
IntCycle : in std_logic;
XY_State : in std_logic_vector(1 downto 0);
MCycles : out std_logic_vector(2 downto 0);
TStates : out std_logic_vector(2 downto 0);
Prefix : out std_logic_vector(1 downto 0); -- None,BC,ED,DD/FD
Inc_PC : out std_logic;
Inc_WZ : out std_logic;
IncDec_16 : out std_logic_vector(3 downto 0); -- BC,DE,HL,SP 0 is inc
Read_To_Reg : out std_logic;
Read_To_Acc : out std_logic;
Set_BusA_To : out std_logic_vector(3 downto 0); -- B,C,D,E,H,L,DI/DB,A,SP(L),SP(M),0,F
Set_BusB_To : out std_logic_vector(3 downto 0); -- B,C,D,E,H,L,DI,A,SP(L),SP(M),1,F,PC(L),PC(M),0
ALU_Op : out std_logic_vector(3 downto 0);
-- ADD, ADC, SUB, SBC, AND, XOR, OR, CP, ROT, BIT, SET, RES, DAA, RLD, RRD, None
Save_ALU : out std_logic;
PreserveC : out std_logic;
Arith16 : out std_logic;
Set_Addr_To : out std_logic_vector(2 downto 0); -- aNone,aXY,aIOA,aSP,aBC,aDE,aZI
IORQ : out std_logic;
Jump : out std_logic;
JumpE : out std_logic;
JumpXY : out std_logic;
Call : out std_logic;
RstP : out std_logic;
LDZ : out std_logic;
LDW : out std_logic;
LDSPHL : out std_logic;
Special_LD : out std_logic_vector(2 downto 0); -- A,I;A,R;I,A;R,A;None
ExchangeDH : out std_logic;
ExchangeRp : out std_logic;
ExchangeAF : out std_logic;
ExchangeRS : out std_logic;
I_DJNZ : out std_logic;
I_CPL : out std_logic;
I_CCF : out std_logic;
I_SCF : out std_logic;
I_RETN : out std_logic;
I_BT : out std_logic;
I_BC : out std_logic;
I_BTR : out std_logic;
I_RLD : out std_logic;
I_RRD : out std_logic;
I_INRC : out std_logic;
SetDI : out std_logic;
SetEI : out std_logic;
IMode : out std_logic_vector(1 downto 0);
Halt : out std_logic;
NoRead : out std_logic;
Write : out std_logic;
XYbit_undoc : out std_logic
);
end component;
component T80_ALU
generic(
Mode : integer := 0;
Flag_C : integer := 0;
Flag_N : integer := 1;
Flag_P : integer := 2;
Flag_X : integer := 3;
Flag_H : integer := 4;
Flag_Y : integer := 5;
Flag_Z : integer := 6;
Flag_S : integer := 7
);
port(
Arith16 : in std_logic;
Z16 : in std_logic;
ALU_Op : in std_logic_vector(3 downto 0);
IR : in std_logic_vector(5 downto 0);
ISet : in std_logic_vector(1 downto 0);
BusA : in std_logic_vector(7 downto 0);
BusB : in std_logic_vector(7 downto 0);
F_In : in std_logic_vector(7 downto 0);
Q : out std_logic_vector(7 downto 0);
F_Out : out std_logic_vector(7 downto 0)
);
end component;
end;

View File

@@ -0,0 +1,116 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
-- Ver 304 init values of registers on first startup (better simulation)
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T80_Reg.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- T80 Registers, technology independent
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
-- Wolfgang Scherr 2011-2015 (email: WoS <at> pin4 <dot> at)
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t51/
--
-- Limitations :
--
-- File history :
--
-- 0242 : Initial release
--
-- 0244 : Changed to single register file
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity T80_Reg is
port(
Clk : in std_logic;
CEN : in std_logic;
WEH : in std_logic;
WEL : in std_logic;
AddrA : in std_logic_vector(2 downto 0);
AddrB : in std_logic_vector(2 downto 0);
AddrC : in std_logic_vector(2 downto 0);
DIH : in std_logic_vector(7 downto 0);
DIL : in std_logic_vector(7 downto 0);
DOAH : out std_logic_vector(7 downto 0);
DOAL : out std_logic_vector(7 downto 0);
DOBH : out std_logic_vector(7 downto 0);
DOBL : out std_logic_vector(7 downto 0);
DOCH : out std_logic_vector(7 downto 0);
DOCL : out std_logic_vector(7 downto 0)
);
end T80_Reg;
architecture rtl of T80_Reg is
type Register_Image is array (natural range <>) of std_logic_vector(7 downto 0);
signal RegsH : Register_Image(0 to 7) := (others => (others => '0'));
signal RegsL : Register_Image(0 to 7) := (others => (others => '0'));
begin
process (Clk)
begin
if Clk'event and Clk = '1' then
if CEN = '1' then
if WEH = '1' then
RegsH(to_integer(unsigned(AddrA))) <= DIH;
end if;
if WEL = '1' then
RegsL(to_integer(unsigned(AddrA))) <= DIL;
end if;
end if;
end if;
end process;
DOAH <= RegsH(to_integer(unsigned(AddrA)));
DOAL <= RegsL(to_integer(unsigned(AddrA)));
DOBH <= RegsH(to_integer(unsigned(AddrB)));
DOBL <= RegsL(to_integer(unsigned(AddrB)));
DOCH <= RegsH(to_integer(unsigned(AddrC)));
DOCL <= RegsL(to_integer(unsigned(AddrC)));
end;

View File

@@ -0,0 +1,262 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T80a.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- Z80 compatible microprocessor core, asynchronous top level
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t80/
--
-- Limitations :
--
-- File history :
--
-- 0208 : First complete release
--
-- 0211 : Fixed interrupt cycle
--
-- 0235 : Updated for T80 interface change
--
-- 0238 : Updated for T80 interface change
--
-- 0240 : Updated for T80 interface change
--
-- 0242 : Updated for T80 interface change
--
-- 0247 : Fixed bus req/ack cycle
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use work.T80_Pack.all;
entity T80a is
generic(
Mode : integer := 0 -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
);
port(
RESET_n : in std_logic;
CLK_n : in std_logic;
WAIT_n : in std_logic;
INT_n : in std_logic;
NMI_n : in std_logic;
BUSRQ_n : in std_logic;
M1_n : out std_logic;
MREQ_n : out std_logic;
IORQ_n : out std_logic;
RD_n : out std_logic;
WR_n : out std_logic;
RFSH_n : out std_logic;
HALT_n : out std_logic;
BUSAK_n : out std_logic;
A : out std_logic_vector(15 downto 0);
D : inout std_logic_vector(7 downto 0)
);
end T80a;
architecture rtl of T80a is
signal CEN : std_logic;
signal Reset_s : std_logic;
signal IntCycle_n : std_logic;
signal IORQ : std_logic;
signal NoRead : std_logic;
signal Write : std_logic;
signal MREQ : std_logic;
signal MReq_Inhibit : std_logic;
signal Req_Inhibit : std_logic;
signal RD : std_logic;
signal MREQ_n_i : std_logic;
signal IORQ_n_i : std_logic;
signal RD_n_i : std_logic;
signal WR_n_i : std_logic;
signal RFSH_n_i : std_logic;
signal BUSAK_n_i : std_logic;
signal A_i : std_logic_vector(15 downto 0);
signal DO : std_logic_vector(7 downto 0);
signal DI_Reg : std_logic_vector (7 downto 0); -- Input synchroniser
signal Wait_s : std_logic;
signal MCycle : std_logic_vector(2 downto 0);
signal TState : std_logic_vector(2 downto 0);
begin
CEN <= '1';
BUSAK_n <= BUSAK_n_i;
MREQ_n_i <= not MREQ or (Req_Inhibit and MReq_Inhibit);
RD_n_i <= not RD or Req_Inhibit;
MREQ_n <= MREQ_n_i when BUSAK_n_i = '1' else 'Z';
IORQ_n <= IORQ_n_i when BUSAK_n_i = '1' else 'Z';
RD_n <= RD_n_i when BUSAK_n_i = '1' else 'Z';
WR_n <= WR_n_i when BUSAK_n_i = '1' else 'Z';
RFSH_n <= RFSH_n_i when BUSAK_n_i = '1' else 'Z';
A <= A_i when BUSAK_n_i = '1' else (others => 'Z');
D <= DO when Write = '1' and BUSAK_n_i = '1' else (others => 'Z');
process (RESET_n, CLK_n)
begin
if RESET_n = '0' then
Reset_s <= '0';
elsif CLK_n'event and CLK_n = '1' then
Reset_s <= '1';
end if;
end process;
u0 : T80
generic map(
Mode => Mode,
IOWait => 1)
port map(
CEN => CEN,
M1_n => M1_n,
IORQ => IORQ,
NoRead => NoRead,
Write => Write,
RFSH_n => RFSH_n_i,
HALT_n => HALT_n,
WAIT_n => Wait_s,
INT_n => INT_n,
NMI_n => NMI_n,
RESET_n => Reset_s,
BUSRQ_n => BUSRQ_n,
BUSAK_n => BUSAK_n_i,
CLK_n => CLK_n,
A => A_i,
DInst => D,
DI => DI_Reg,
DO => DO,
MC => MCycle,
TS => TState,
IntCycle_n => IntCycle_n);
process (CLK_n)
begin
if CLK_n'event and CLK_n = '0' then
Wait_s <= WAIT_n;
if TState = "011" and BUSAK_n_i = '1' then
DI_Reg <= to_x01(D);
end if;
end if;
end process;
process (Reset_s,CLK_n)
begin
if Reset_s = '0' then
WR_n_i <= '1';
elsif CLK_n'event and CLK_n = '1' then
WR_n_i <= '1';
if TState = "001" then -- To short for IO writes !!!!!!!!!!!!!!!!!!!
WR_n_i <= not Write;
end if;
end if;
end process;
process (Reset_s,CLK_n)
begin
if Reset_s = '0' then
Req_Inhibit <= '0';
elsif CLK_n'event and CLK_n = '1' then
if MCycle = "001" and TState = "010" then
Req_Inhibit <= '1';
else
Req_Inhibit <= '0';
end if;
end if;
end process;
process (Reset_s,CLK_n)
begin
if Reset_s = '0' then
MReq_Inhibit <= '0';
elsif CLK_n'event and CLK_n = '0' then
if MCycle = "001" and TState = "010" then
MReq_Inhibit <= '1';
else
MReq_Inhibit <= '0';
end if;
end if;
end process;
process(Reset_s,CLK_n)
begin
if Reset_s = '0' then
RD <= '0';
IORQ_n_i <= '1';
MREQ <= '0';
elsif CLK_n'event and CLK_n = '0' then
if MCycle = "001" then
if TState = "001" then
RD <= IntCycle_n;
MREQ <= IntCycle_n;
IORQ_n_i <= IntCycle_n;
end if;
if TState = "011" then
RD <= '0';
IORQ_n_i <= '1';
MREQ <= '1';
end if;
if TState = "100" then
MREQ <= '0';
end if;
else
if TState = "001" and NoRead = '0' then
RD <= not Write;
IORQ_n_i <= not IORQ;
MREQ <= not IORQ;
end if;
if TState = "011" then
RD <= '0';
IORQ_n_i <= '1';
MREQ <= '0';
end if;
end if;
end if;
end process;
end;

View File

@@ -0,0 +1,193 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
--
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T80se.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- Z80 compatible microprocessor core, synchronous top level with clock enable
-- Different timing than the original z80
-- Inputs needs to be synchronous and outputs may glitch
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t80/
--
-- Limitations :
--
-- File history :
--
-- 0235 : First release
--
-- 0236 : Added T2Write generic
--
-- 0237 : Fixed T2Write with wait state
--
-- 0238 : Updated for T80 interface change
--
-- 0240 : Updated for T80 interface change
--
-- 0242 : Updated for T80 interface change
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use work.T80_Pack.all;
entity T80se is
generic(
Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
T2Write : integer := 0; -- 0 => WR_n active in T3, /=0 => WR_n active in T2
IOWait : integer := 1 -- 0 => Single cycle I/O, 1 => Std I/O cycle
);
port(
RESET_n : in std_logic;
CLK_n : in std_logic;
CLKEN : in std_logic;
WAIT_n : in std_logic;
INT_n : in std_logic;
NMI_n : in std_logic;
BUSRQ_n : in std_logic;
M1_n : out std_logic;
MREQ_n : out std_logic;
IORQ_n : out std_logic;
RD_n : out std_logic;
WR_n : out std_logic;
RFSH_n : out std_logic;
HALT_n : out std_logic;
BUSAK_n : out std_logic;
A : out std_logic_vector(15 downto 0);
DI : in std_logic_vector(7 downto 0);
DO : out std_logic_vector(7 downto 0)
);
end T80se;
architecture rtl of T80se is
signal IntCycle_n : std_logic;
signal NoRead : std_logic;
signal Write : std_logic;
signal IORQ : std_logic;
signal DI_Reg : std_logic_vector(7 downto 0);
signal MCycle : std_logic_vector(2 downto 0);
signal TState : std_logic_vector(2 downto 0);
begin
u0 : T80
generic map(
Mode => Mode,
IOWait => IOWait)
port map(
CEN => CLKEN,
M1_n => M1_n,
IORQ => IORQ,
NoRead => NoRead,
Write => Write,
RFSH_n => RFSH_n,
HALT_n => HALT_n,
WAIT_n => Wait_n,
INT_n => INT_n,
NMI_n => NMI_n,
RESET_n => RESET_n,
BUSRQ_n => BUSRQ_n,
BUSAK_n => BUSAK_n,
CLK_n => CLK_n,
A => A,
DInst => DI,
DI => DI_Reg,
DO => DO,
MC => MCycle,
TS => TState,
IntCycle_n => IntCycle_n);
process (RESET_n, CLK_n)
begin
if RESET_n = '0' then
RD_n <= '1';
WR_n <= '1';
IORQ_n <= '1';
MREQ_n <= '1';
DI_Reg <= "00000000";
elsif CLK_n'event and CLK_n = '1' then
if CLKEN = '1' then
RD_n <= '1';
WR_n <= '1';
IORQ_n <= '1';
MREQ_n <= '1';
if MCycle = "001" then
if TState = "001" or (TState = "010" and Wait_n = '0') then
RD_n <= not IntCycle_n;
MREQ_n <= not IntCycle_n;
IORQ_n <= IntCycle_n;
end if;
if TState = "011" then
MREQ_n <= '0';
end if;
else
if (TState = "001" or (TState = "010" and Wait_n = '0')) and NoRead = '0' and Write = '0' then
RD_n <= '0';
IORQ_n <= not IORQ;
MREQ_n <= IORQ;
end if;
if T2Write = 0 then
if TState = "010" and Write = '1' then
WR_n <= '0';
IORQ_n <= not IORQ;
MREQ_n <= IORQ;
end if;
else
if (TState = "001" or (TState = "010" and Wait_n = '0')) and Write = '1' then
WR_n <= '0';
IORQ_n <= not IORQ;
MREQ_n <= IORQ;
end if;
end if;
end if;
if TState = "010" and Wait_n = '1' then
DI_Reg <= DI;
end if;
end if;
end if;
end process;
end;

View File

@@ -0,0 +1,177 @@
-- ****
-- T80(b) core. In an effort to merge and maintain bug fixes ....
--
--
-- Ver 300 started tidyup
--
-- Latest version from www.fpgaarcade.com (original www.opencores.org)
--
-- $Id: T80sed.vhd 1330 2015-05-22 19:55:46Z wolfgang.scherr $
--
-- ****
--
-- ** CUSTOM 2 CLOCK MEMORY ACCESS FOR PACMAN, MIKEJ **
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- Please report bugs to the author, but before you do so, please
-- make sure that this is not a derivative work and that
-- you have the latest version of this file.
--
-- The latest version of this file can be found at:
-- http://www.opencores.org/cvsweb.shtml/t80/
--
-- Limitations :
--
-- File history :
--
-- 0235 : First release
--
-- 0236 : Added T2Write generic
--
-- 0237 : Fixed T2Write with wait state
--
-- 0238 : Updated for T80 interface change
--
-- 0242 : Updated for T80 interface change
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use work.T80_Pack.all;
entity T80sed is
port(
RESET_n : in std_logic;
CLK_n : in std_logic;
CLKEN : in std_logic;
WAIT_n : in std_logic;
INT_n : in std_logic;
NMI_n : in std_logic;
BUSRQ_n : in std_logic;
M1_n : out std_logic;
MREQ_n : out std_logic;
IORQ_n : out std_logic;
RD_n : out std_logic;
WR_n : out std_logic;
RFSH_n : out std_logic;
HALT_n : out std_logic;
BUSAK_n : out std_logic;
A : out std_logic_vector(15 downto 0);
DI : in std_logic_vector(7 downto 0);
DO : out std_logic_vector(7 downto 0)
);
end T80sed;
architecture rtl of T80sed is
signal IntCycle_n : std_logic;
signal NoRead : std_logic;
signal Write : std_logic;
signal IORQ : std_logic;
signal DI_Reg : std_logic_vector(7 downto 0);
signal MCycle : std_logic_vector(2 downto 0);
signal TState : std_logic_vector(2 downto 0);
begin
u0 : T80
generic map(
Mode => 0,
IOWait => 1)
port map(
CEN => CLKEN,
M1_n => M1_n,
IORQ => IORQ,
NoRead => NoRead,
Write => Write,
RFSH_n => RFSH_n,
HALT_n => HALT_n,
WAIT_n => Wait_n,
INT_n => INT_n,
NMI_n => NMI_n,
RESET_n => RESET_n,
BUSRQ_n => BUSRQ_n,
BUSAK_n => BUSAK_n,
CLK_n => CLK_n,
A => A,
DInst => DI,
DI => DI_Reg,
DO => DO,
MC => MCycle,
TS => TState,
IntCycle_n => IntCycle_n);
process (RESET_n, CLK_n)
begin
if RESET_n = '0' then
RD_n <= '1';
WR_n <= '1';
IORQ_n <= '1';
MREQ_n <= '1';
DI_Reg <= "00000000";
elsif CLK_n'event and CLK_n = '1' then
if CLKEN = '1' then
RD_n <= '1';
WR_n <= '1';
IORQ_n <= '1';
MREQ_n <= '1';
if MCycle = "001" then
if TState = "001" or (TState = "010" and Wait_n = '0') then
RD_n <= not IntCycle_n;
MREQ_n <= not IntCycle_n;
IORQ_n <= IntCycle_n;
end if;
if TState = "011" then
MREQ_n <= '0';
end if;
else
if (TState = "001" or TState = "010") and NoRead = '0' and Write = '0' then
RD_n <= '0';
IORQ_n <= not IORQ;
MREQ_n <= IORQ;
end if;
if ((TState = "001") or (TState = "010")) and Write = '1' then
WR_n <= '0';
IORQ_n <= not IORQ;
MREQ_n <= IORQ;
end if;
end if;
if TState = "010" and Wait_n = '1' then
DI_Reg <= DI;
end if;
end if;
end if;
end process;
end;

View File

@@ -0,0 +1,612 @@
----------------------------------------------------------------------------------
-- berzerk by Dar (darfpga@aol.fr) (June 2018)
-- http://darfpga.blogspot.fr
----------------------------------------------------------------------------------
-- Educational use only
-- Do not redistribute synthetized file with roms
-- Do not redistribute roms whatever the form
-- Use at your own risk
---------------------------------------------------------------------------------
-- T80/T80se - Version : 0304 /!\ (0247 has some interrupt vector problems)
-----------------------------
-- Z80 compatible microprocessor core
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- MikeJ March 2005
-- Wolfgang Scherr 2011-2015 (email: WoS <at> pin4 <dot> at)
---------------------------------------------------------------------------------
-- gen_ram.vhd & io_ps2_keyboard
--------------------------------
-- Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com)
-- http://www.syntiac.com/fpga64.html
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-- Use berzerk_de10_lite.sdc to compile (Timequest constraints)
-- /!\
-- Don't forget to set device configuration mode with memory initialization
-- (Assignments/Device/Pin options/Configuration mode)
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
--
-- Berzerk has not graphics tile nor sprite. Instead berzerk use a 1 pixel video
-- buffer and a color map buffer.
--
-- Video buffer is 256 pixels x 224 lines : 32 x 224 bytes
--
-- Video buffer can be written by cpu @4000-5fff (normal write : cpu_do => vram_di)
-- video buffer and working ram share the same ram.
--
-- Video buffer can be written by cpu @6000-7fff
-- in that case the written cpu data can be shifted and completed with previous written data
-- then the result can be bit reversed 0..7 => 7..0 (flopper)
-- then the result can be combined (alu) with the current video data at that address
-- shift/flop and alu function are controled by data written at I/O 0x4B
-- during such write flopper output is compared with current video data to detect
-- pixel colision (called intercept)
--
-- color buffer is @8000-87ff :32x64 area of 1 byte
-- one byte covers 2x4 pixels and 4 lines.
-- bits 7-4 => 4 pixels of color1
-- bits 3-0 => 4 pixels of color2
-- color 4bits : intensity/blue/green/red
--
-- Sound effects uses a ptm6840 timer (3 channel) + noise generator and volume control
--
-- TODO : speech synthesis.
--
-----------------------------------------------------------------------------------------------
-- Problème rencontré : cpu_int acquitée par iorq durant le cylce de capture du vecteur
-- d'interruption => mauvais vecteur lu => plantage un peu plus tard.
--
-- Solution : ajouter m1_n dans l'equation d'acquitement de int.
-----------------------------------------------------------------------------------------------
-- Mame command reminder
-- wpiset 40,1,w,1,{printf "a:%08x d:%02X",wpaddr,wpdata; g}
-- wpiset 40,1,w,(wpdata!=0) && (wpdata!=90) && (wpdata!=92),{printf "a:%08x d:%02X",wpaddr,wpdata; g}
-----------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity berzerk is
port(
clock_10 : in std_logic;
reset : in std_logic;
tv15Khz_mode : in std_logic;
video_r : out std_logic;
video_g : out std_logic;
video_b : out std_logic;
video_hi : out std_logic;
video_clk : out std_logic;
video_csync : out std_logic;
video_hs : out std_logic;
video_vs : out std_logic;
audio_out : out std_logic_vector(15 downto 0);
start2 : in std_logic;
start1 : in std_logic;
coin1 : in std_logic;
cocktail : in std_logic;
right1 : in std_logic;
left1 : in std_logic;
down1 : in std_logic;
up1 : in std_logic;
fire1 : in std_logic;
right2 : in std_logic;
left2 : in std_logic;
down2 : in std_logic;
up2 : in std_logic;
fire2 : in std_logic;
ledr : out std_logic_vector(9 downto 0);
dbg_cpu_di : out std_logic_vector( 7 downto 0);
dbg_cpu_addr : out std_logic_vector(15 downto 0);
dbg_cpu_addr_latch : out std_logic_vector(15 downto 0)
);
end berzerk;
architecture struct of berzerk is
-- clocks
signal clock_10n : std_logic;
signal reset_n : std_logic;
-- video syncs
signal hsync : std_logic;
signal vsync : std_logic;
signal csync : std_logic;
signal blank : std_logic;
-- global synchronisation
signal ena_pixel : std_logic := '0';
signal hcnt : std_logic_vector(8 downto 0);
signal vcnt : std_logic_vector(8 downto 0);
signal hcnt_r : std_logic_vector(8 downto 0);
signal vcnt_r : std_logic_vector(8 downto 0);
-- Z80 interface
signal cpu_clock : std_logic;
signal cpu_wr_n : std_logic;
signal cpu_addr : std_logic_vector(15 downto 0);
signal cpu_do : std_logic_vector(7 downto 0);
signal cpu_di : std_logic_vector(7 downto 0);
signal cpu_di_r : std_logic_vector(7 downto 0);
signal cpu_mreq_n : std_logic;
signal cpu_m1_n : std_logic;
signal cpu_int_n : std_logic := '1';
signal cpu_nmi_n : std_logic := '1';
signal cpu_iorq_n : std_logic;
signal cpu_di_mem : std_logic_vector(7 downto 0);
signal cpu_di_io : std_logic_vector(7 downto 0);
-- rom/ram addr/we/do
signal prog2_rom_addr : std_logic_vector(15 downto 0);
signal prog1_do : std_logic_vector(7 downto 0);
signal prog2_do : std_logic_vector(7 downto 0);
signal mosram_do : std_logic_vector(7 downto 0);
signal mosram_we : std_logic;
signal vram_addr : std_logic_vector(12 downto 0);
signal vram_di : std_logic_vector( 7 downto 0);
signal vram_do : std_logic_vector( 7 downto 0);
signal vram_we : std_logic;
signal cram_addr : std_logic_vector(10 downto 0);
signal cram_do : std_logic_vector(7 downto 0);
signal cram_we : std_logic;
-- I/O chip seclect
signal io1_cs : std_logic;
signal io2_cs : std_logic;
-- misc
signal int_enable : std_logic;
signal nmi_enable : std_logic;
signal inta : std_logic;
signal vcnt_int : std_logic;
signal vcnt_int_r : std_logic;
signal led_on : std_logic;
--signal intercept : std_logic;
signal intercept_latch : std_logic;
-- grapihcs computation
signal shifter_flopper_alu_cmd : std_logic_vector(7 downto 0);
signal last_data_written : std_logic_vector(6 downto 0);
signal shifter_do : std_logic_vector(7 downto 0);
signal flopper_do : std_logic_vector(7 downto 0);
signal alu_do : std_logic_vector(7 downto 0);
signal vram_do_latch : std_logic_vector(7 downto 0);
-- graphics data
signal graphx : std_logic_vector (7 downto 0);
signal colors : std_logic_vector (7 downto 0);
signal color : std_logic_vector (3 downto 0);
-- player I/O
signal player1 : std_logic_vector(7 downto 0);
signal player2 : std_logic_vector(7 downto 0);
signal system : std_logic_vector(7 downto 0);
-- line doubler I/O
signal video : std_logic_vector (3 downto 0);
signal video_i : std_logic_vector (3 downto 0);
signal video_o : std_logic_vector (3 downto 0);
signal video_s : std_logic_vector (3 downto 0);
signal hsync_o : std_logic;
signal vsync_o : std_logic;
begin
clock_10n <= not clock_10;
reset_n <= not reset;
ledr(0) <= led_on;
----------
-- debug
----------
dbg_cpu_addr <= cpu_addr;
process(cpu_clock, reset)
begin
if rising_edge(cpu_clock) then
if cpu_m1_n = '0' then
dbg_cpu_addr_latch <= cpu_addr;
end if;
end if;
end process;
-----------------------
-- Enable pixel counter
-- and cpu clock
-----------------------
process(clock_10, reset)
begin
if reset = '1' then
ena_pixel <= '0';
else
if rising_edge(clock_10) then
ena_pixel <= not ena_pixel;
end if;
end if;
end process;
cpu_clock <= hcnt(0);
------------------
-- video output
------------------
-- demux color nibbles
color <= colors(7 downto 4) when hcnt(2) = '0' else colors(3 downto 0);
-- serialize video byte
video <= color when graphx(to_integer(unsigned(not hcnt(2 downto 0)))) = '1' else "0000";
-- apply blanking
process(clock_10)
begin
if rising_edge(clock_10) then
if ena_pixel = '1' then
if blank = '0' then
video_i <= video;
else
video_i <= (others => '0');
end if;
end if;
end if;
end process;
-- output
video_s <= video_i;--video_o when tv15Khz_mode = '0' else video_i;
video_r <= video_s(0);
video_g <= video_s(1);
video_b <= video_s(2);
video_hi <= video_s(3);
video_clk <= clock_10;
video_csync <= csync;
video_hs <= hsync;--hsync_o;
video_vs <= vsync;--vsync_o;
------------------
-- player controls
------------------
player1 <= not( "000" & fire1 & down1 & up1 & right1 & left1);
player2 <= not(cocktail & "00" & fire2 & down2 & up2 & right2 & left2);
system <= not(coin1 & "00000" & start2 & start1 );
-----------------------
-- cpu write addressing
-- cpu I/O chips select
-----------------------
mosram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and cpu_addr(15 downto 10) = "000010" else '0'; -- 0800-0bff
vram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and cpu_addr(15 downto 14) = "01" and cpu_clock = '0' else '0'; -- 4000-5fff mirror 6000-7fff
cram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and cpu_addr(15 downto 11) = "10000" and cpu_clock = '0' else '0'; -- 8000-87ff
io1_cs <= '1' when cpu_iorq_n ='0' and cpu_m1_n = '1' and cpu_addr(7 downto 4) = "0100" else '0'; -- x40-x4f
io2_cs <= '1' when cpu_iorq_n ='0' and cpu_m1_n = '1' and cpu_addr(7 downto 5) = "011" else '0'; -- x60-x7f
---------------------------
-- enable/disable interrupt
-- latch/clear interrupt
-- led
---------------------------
vcnt_int <= (not(vcnt(6)) and vcnt(7)) or vcnt(8);
process (cpu_clock, reset)
begin
if reset = '1' then
nmi_enable <= '0';
int_enable <= '0';
led_on <= '0';
else
if rising_edge(cpu_clock) then
if io1_cs ='1' then
if cpu_addr(3 downto 0) = "1100" then nmi_enable <= '1'; end if; -- 4c
if cpu_addr(3 downto 0) = "1101" then nmi_enable <= '0'; end if; -- 4d
if cpu_addr(3 downto 0) = "1111" and cpu_wr_n = '0' then int_enable <= cpu_do(0); end if; -- 4f
end if;
if io2_cs ='1' then
if cpu_addr(2 downto 0) = "110" then led_on <= '0'; end if; -- 66
if cpu_addr(2 downto 0) = "111" then led_on <= '1'; end if; -- 67
end if;
end if;
end if;
end process;
process (clock_10, cpu_iorq_n, cpu_addr)
begin
if reset = '1' then
cpu_int_n <= '1';
cpu_nmi_n <= '1';
else
if rising_edge(clock_10) then
vcnt_r <= vcnt;
vcnt_int_r <= vcnt_int;
if nmi_enable = '1' then
if vcnt_r(4) = '0' and vcnt(4) = '1' then cpu_nmi_n <= '0';end if;
if hcnt_r(0) = '0' and hcnt(0) = '1' then cpu_nmi_n <= '1';end if;
else
cpu_nmi_n <= '1';
end if;
end if;
if rising_edge(clock_10) then
if cpu_iorq_n ='0' then
-- m1_n avoid clear interrupt during vector reading
if cpu_addr(7 downto 0) = X"4e" and cpu_m1_n = '1' then cpu_int_n <= '1'; end if;
end if;
if int_enable = '1' then
if vcnt_int_r = '0' and vcnt_int = '1' then cpu_int_n <= '0';end if;
end if;
end if;
end if;
end process;
------------------------------------
-- mux cpu data mem read and io read
------------------------------------
-- memory mux
with cpu_addr(15 downto 11) select
cpu_di_mem <=
prog1_do when "00000", -- 0000-07ff
mosram_do when "00001", -- 0800-0fff
prog2_do when "00010", -- 1000-17ff
prog2_do when "00011", -- 1800-1fff
prog2_do when "00100", -- 2000-27ff
prog2_do when "00101", -- 2800-2fff
prog2_do when "00110", -- 3000-37ff
-- prog2_do when "00111", -- 3800-3fff
vram_do when "01000", -- 4000-47ff
vram_do when "01001", -- 4800-4fff
vram_do when "01010", -- 5000-57ff
vram_do when "01011", -- 5800-5fff
vram_do when "01100", -- 6000-67ff
vram_do when "01101", -- 6800-6fff
vram_do when "01110", -- 7000-77ff
vram_do when "01111", -- 7800-7fff
cram_do when "10000", -- 8000-87ff
x"FF" when others;
-- I/O-2 mux
with cpu_addr(2 downto 0) select
cpu_di_io <=
X"BC" when "000", -- 60 (F3) (normal : BC, hatch test : BE, input test BD )
X"FC" when "001", -- 61 (F2) (normal : FC, signature analisys FF)
X"F0" when "010", -- 62 (F6)
X"F0" when "011", -- 63 (F5)
X"F0" when "100", -- 64 (F4)
X"00" when "101", -- 65 (SW2)
X"00" when "110", -- 66 (led on )
X"00" when "111", -- 67 (led off)
X"00" when others;
-- I/O-1 and final mux
-- pull up on ZPU board
cpu_di <= "111111" & cpu_int_n & '0' when cpu_iorq_n = '0' and cpu_m1_n = '0' -- interrupt vector
else player1 when io1_cs = '1' and cpu_addr(3 downto 0) = X"8" -- P1
else system when io1_cs = '1' and cpu_addr(3 downto 0) = X"9" -- sys
else player2 when io1_cs = '1' and cpu_addr(3 downto 0) = X"a" -- P2
else intercept_latch & "111111" & vcnt(8) when io1_cs = '1' and cpu_addr(3 downto 0) = X"e"
else cpu_di_io when io2_cs = '1'
else cpu_di_mem;
-- video memory computation
process(clock_10, reset)
begin
if reset = '1' then
shifter_flopper_alu_cmd <= (others => '0');
else
if rising_edge(clock_10) then
if cpu_clock = '0' and ena_pixel = '1' then
vram_do_latch <= vram_do;
end if;
if vram_we = '1' and cpu_addr(13) = '1' then
if ena_pixel = '1' then
last_data_written <= cpu_do(6 downto 0);
if (vram_do_latch and flopper_do) /= X"00" then
intercept_latch <= '1';
end if;
end if;
end if;
if io1_cs = '1' then
if cpu_addr(3 downto 0) = "1011" then -- 4b
shifter_flopper_alu_cmd <= cpu_do;
last_data_written <= (others => '0');
intercept_latch <= '0';
end if;
end if;
end if;
end if;
end process;
-- shifter - flopper
with shifter_flopper_alu_cmd(2 downto 0) select
shifter_do <= cpu_do(7 downto 0) when "000",
last_data_written( 0) & cpu_do(7 downto 1) when "001",
last_data_written(1 downto 0) & cpu_do(7 downto 2) when "010",
last_data_written(2 downto 0) & cpu_do(7 downto 3) when "011",
last_data_written(3 downto 0) & cpu_do(7 downto 4) when "100",
last_data_written(4 downto 0) & cpu_do(7 downto 5) when "101",
last_data_written(5 downto 0) & cpu_do(7 downto 6) when "110",
last_data_written(6 downto 0) & cpu_do(7 ) when others;
with shifter_flopper_alu_cmd(3) select
flopper_do <= shifter_do when '0',
shifter_do(0)&shifter_do(1)&shifter_do(2)&shifter_do(3)&
shifter_do(4)&shifter_do(5)&shifter_do(6)&shifter_do(7) when others;
-- 74181 - alu (logical computation only)
with not(shifter_flopper_alu_cmd(7 downto 4)) select
alu_do <= not flopper_do when "0000",
not(flopper_do or vram_do_latch) when "0001",
not(flopper_do) and vram_do_latch when "0010",
X"00" when "0011",
not(flopper_do and vram_do_latch) when "0100",
not(vram_do_latch) when "0101",
flopper_do xor vram_do_latch when "0110",
flopper_do and not(vram_do_latch) when "0111",
not(flopper_do) or vram_do_latch when "1000",
not(flopper_do xor vram_do_latch) when "1001",
vram_do_latch when "1010",
flopper_do and vram_do_latch when "1011",
X"FF" when "1100",
flopper_do or not(vram_do_latch) when "1101",
flopper_do or vram_do_latch when "1110",
flopper_do when others;
------------------------------------------------------
-- video & color ram address/data mux
------------------------------------------------------
with cpu_addr(13) select
vram_di <= cpu_do when '0',
alu_do when others;
vram_addr <= cpu_addr(12 downto 0) when cpu_clock = '0'
else vcnt(7 downto 0) & hcnt(7 downto 3);
cram_addr <= cpu_addr(10 downto 0) when cpu_clock = '0'
else vcnt(7 downto 2) & hcnt(7 downto 3);
-------------------------------------------------------
-- video & color ram read
-------------------------------------------------------
process(clock_10)
begin
if rising_edge(clock_10) then
if hcnt(2 downto 0) = "111" and ena_pixel = '1' then
graphx <= vram_do;
colors <= cram_do;
end if;
end if;
end process;
-- Sync and video counters
video_gen : entity work.video_gen
port map (
clock => clock_10,
reset => reset,
ena_pixel => ena_pixel,
hsync => hsync,
vsync => vsync,
csync => csync,
blank => blank,
hcnt_o => hcnt,
vcnt_o => vcnt
);
-- line doubler
line_doubler : entity work.line_doubler
port map(
clock => clock_10,
video_i => video_i,
hsync_i => hsync,
vsync_i => vsync,
video_o => video_o,
hsync_o => hsync_o,
vsync_o => vsync_o
);
-- Z80
Z80 : entity work.T80se
generic map(Mode => 0, T2Write => 1, IOWait => 1)
port map(
RESET_n => reset_n,
CLK_n => cpu_clock,
CLKEN => '1',
WAIT_n => '1',
INT_n => cpu_int_n,
NMI_n => cpu_nmi_n,
BUSRQ_n => '1',
M1_n => cpu_m1_n,
MREQ_n => cpu_mreq_n,
IORQ_n => cpu_iorq_n,
RD_n => open,
WR_n => cpu_wr_n,
RFSH_n => open,
HALT_n => open,
BUSAK_n => open,
A => cpu_addr,
DI => cpu_di,
DO => cpu_do
);
-- program roms
program1 : entity work.berzerk_program1
port map (
addr => cpu_addr(10 downto 0),
clk => clock_10n,
data => prog1_do
);
prog2_rom_addr <= cpu_addr-X"1000";
program2 : entity work.berzerk_program2
port map (
addr => prog2_rom_addr(13 downto 0),
clk => clock_10n,
data => prog2_do
);
-- working ram - 0800-0bff
mosram : entity work.gen_ram
generic map( dWidth => 8, aWidth => 10)
port map(
clk => clock_10n,
we => mosram_we,
addr => cpu_addr( 9 downto 0),
d => cpu_do,
q => mosram_do
);
-- video/working ram - 4000-5fff mirrored 6000-7fff
vram : entity work.gen_ram
generic map( dWidth => 8, aWidth => 13)
port map(
clk => clock_10n,
we => vram_we,
addr => vram_addr,
d => vram_di,
q => vram_do
);
-- color ram - 8000-87ff
cram : entity work.gen_ram
generic map( dWidth => 8, aWidth => 11)
port map(
clk => clock_10n,
we => cram_we,
addr => cram_addr,
d => cpu_do,
q => cram_do
);
-- sound effects
berzerk_sound_fx : entity work.berzerk_sound_fx
port map(
clock => cpu_clock,
reset => reset,
cs => io1_cs,
addr => cpu_addr(4 downto 0),
di => cpu_do,
sample => audio_out
);
------------------------------------------
end architecture;

View File

@@ -0,0 +1,168 @@
module berzerk_mist
(
output LED,
output [5:0] VGA_R,
output [5:0] VGA_G,
output [5:0] VGA_B,
output VGA_HS,
output VGA_VS,
output AUDIO_L,
output AUDIO_R,
input SPI_SCK,
output SPI_DO,
input SPI_DI,
input SPI_SS2,
input SPI_SS3,
input CONF_DATA0,
input CLOCK_27
);
`include "rtl\build_id.v"
localparam CONF_STR = {
"Berzerk;;",
// "O2,Joystick Control,Upright,Normal;",
"O34,Scandoubler Fx,None,HQ2x,CRT 25%,CRT 50%;",
"T6,Reset;",
"V,v1.00.",`BUILD_DATE
};
wire [31:0] status;
wire [1:0] buttons;
wire [1:0] switches;
wire [9:0] kbjoy;
wire [7:0] joystick_0;
wire [7:0] joystick_1;
wire scandoubler_disable;
wire ypbpr;
wire ps2_kbd_clk, ps2_kbd_data;
assign LED = 1;
wire clk_40, clk_10;
pll pll
(
.inclk0(CLOCK_27),
.areset(0),
.c0(clk_40),
.c1(clk_10)
);
wire m_up = status[2] ? kbjoy[6] | joystick_0[1] | joystick_1[1] : kbjoy[4] | joystick_0[3] | joystick_1[3];
wire m_down = status[2] ? kbjoy[7] | joystick_0[0] | joystick_1[0] : kbjoy[5] | joystick_0[2] | joystick_1[2];
wire m_left = status[2] ? kbjoy[5] | joystick_0[2] | joystick_1[2] : kbjoy[6] | joystick_0[1] | joystick_1[1];
wire m_right = status[2] ? kbjoy[4] | joystick_0[3] | joystick_1[3] : kbjoy[7] | joystick_0[0] | joystick_1[0];
wire m_fire = kbjoy[0] | joystick_0[4] | joystick_1[4];
wire m_start1 = kbjoy[1];
wire m_start2 = kbjoy[2];
wire m_coin = kbjoy[3];
berzerk berzerk(
.clock_10(clk_10),
.reset(status[0] | status[6] | buttons[1]),
.tv15Khz_mode(1'b1),
.video_r(r),
.video_g(g),
.video_b(b),
.video_hi(),
.video_clk(),
.video_csync(),
.video_hs(hs),
.video_vs(vs),
.audio_out(audio),
.start2(m_start2),
.start1(m_start1),
.coin1(m_coin),
.cocktail(1'b0),
.right1(m_right),
.left1(m_left),
.down1(m_down),
.up1(m_up),
.fire1(m_fire),
.right2(m_right),
.left2(m_left),
.down2(m_down),
.up2(m_up),
.fire2(m_fire),
.ledr(),
.dbg_cpu_di(),
.dbg_cpu_addr(),
.dbg_cpu_addr_latch()
);
wire [15:0] audio;
dac dac (
.clk_i(clk_40),
.res_n_i(1),
.dac_i(audio[15:4]),
.dac_o(AUDIO_L)
);
assign AUDIO_R = AUDIO_L;
wire hs, vs;
wire r, g, b;
video_mixer #(.LINE_LENGTH(480), .HALF_DEPTH(1)) video_mixer
(
.clk_sys(clk_40),
.ce_pix(clk_10),
.ce_pix_actual(clk_10),
.SPI_SCK(SPI_SCK),
.SPI_SS3(SPI_SS3),
.SPI_DI(SPI_DI),
.R({r,r,r,r,r,r}),
.G({g,g,g,g,g,g}),
.B({b,b,b,b,b,b}),
.HSync(hs),
.VSync(vs),
.VGA_R(VGA_R),
.VGA_G(VGA_G),
.VGA_B(VGA_B),
.VGA_VS(VGA_VS),
.VGA_HS(VGA_HS),
.scandoubler_disable(scandoubler_disable),
.scanlines(scandoubler_disable ? 2'b00 : {status[4:3] == 3, status[4:3] == 2}),
.hq2x(status[4:3]==1),
.ypbpr_full(1),
.line_start(0),
.mono(0)
);
mist_io #(.STRLEN(($size(CONF_STR)>>3))) mist_io
(
.clk_sys (clk_40 ),
.conf_str (CONF_STR ),
.SPI_SCK (SPI_SCK ),
.CONF_DATA0 (CONF_DATA0 ),
.SPI_SS2 (SPI_SS2 ),
.SPI_DO (SPI_DO ),
.SPI_DI (SPI_DI ),
.buttons (buttons ),
.switches (switches ),
.scandoubler_disable(scandoubler_disable),
.ypbpr (ypbpr ),
.ps2_kbd_clk (ps2_kbd_clk ),
.ps2_kbd_data (ps2_kbd_data ),
.joystick_0 (joystick_0 ),
.joystick_1 (joystick_1 ),
.status (status )
);
keyboard keyboard(
.clk(clk_40),
.reset(),
.ps2_kbd_clk(ps2_kbd_clk),
.ps2_kbd_data(ps2_kbd_data),
.joystick(kbjoy)
);
endmodule

View File

@@ -0,0 +1,150 @@
library ieee;
use ieee.std_logic_1164.all,ieee.numeric_std.all;
entity berzerk_program1 is
port (
clk : in std_logic;
addr : in std_logic_vector(10 downto 0);
data : out std_logic_vector(7 downto 0)
);
end entity;
architecture prom of berzerk_program1 is
type rom is array(0 to 2047) of std_logic_vector(7 downto 0);
signal rom_data: rom := (
X"00",X"F3",X"AF",X"D3",X"4D",X"ED",X"47",X"DB",X"61",X"CB",X"47",X"C2",X"00",X"02",X"DB",X"60",
X"CB",X"47",X"C2",X"31",X"05",X"DD",X"21",X"41",X"01",X"18",X"68",X"CD",X"7B",X"29",X"90",X"20",
X"08",X"43",X"6F",X"6E",X"67",X"72",X"61",X"74",X"75",X"6C",X"61",X"74",X"69",X"6F",X"6E",X"73",
X"20",X"50",X"6C",X"61",X"79",X"65",X"72",X"20",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"10",X"08",
X"46",X"65",X"6C",X"69",X"63",X"69",X"74",X"61",X"74",X"69",X"6F",X"6E",X"73",X"20",X"61",X"75",
X"20",X"6A",X"6F",X"75",X"65",X"75",X"72",X"20",X"00",X"C9",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"D3",X"4D",X"F5",X"3A",X"00",X"40",X"B7",X"C2",X"1D",X"05",
X"F1",X"C3",X"21",X"17",X"05",X"00",X"08",X"A3",X"00",X"01",X"00",X"00",X"0D",X"20",X"FD",X"10",
X"FB",X"DB",X"66",X"3E",X"01",X"01",X"41",X"01",X"11",X"47",X"82",X"ED",X"41",X"0D",X"ED",X"51",
X"0C",X"0C",X"ED",X"41",X"0C",X"ED",X"41",X"0C",X"0C",X"0C",X"ED",X"59",X"0E",X"51",X"3D",X"28",
X"EA",X"01",X"00",X"00",X"0D",X"20",X"FD",X"10",X"FB",X"DB",X"67",X"AF",X"D3",X"40",X"D3",X"50",
X"DD",X"E9",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"18",X"3B",X"01",X"C0",X"08",X"21",X"00",X"00",X"16",X"08",X"7E",X"09",X"AF",X"ED",X"4F",X"32",
X"00",X"10",X"15",X"20",X"F5",X"0E",X"7F",X"16",X"20",X"7B",X"E6",X"20",X"47",X"ED",X"78",X"CB",
X"0B",X"0D",X"15",X"20",X"F4",X"3E",X"80",X"01",X"57",X"80",X"ED",X"79",X"05",X"0D",X"CB",X"0F",
X"30",X"F8",X"0E",X"47",X"ED",X"79",X"0D",X"CB",X"0F",X"30",X"F9",X"18",X"C5",X"3E",X"01",X"ED",
X"47",X"1E",X"06",X"DD",X"21",X"00",X"10",X"01",X"00",X"08",X"26",X"00",X"2E",X"FF",X"DD",X"7E",
X"00",X"57",X"A5",X"6F",X"7A",X"84",X"67",X"DD",X"23",X"0D",X"20",X"F2",X"10",X"F0",X"3A",X"74",
X"00",X"FE",X"FF",X"28",X"25",X"83",X"D6",X"07",X"F2",X"6F",X"01",X"7D",X"3C",X"28",X"05",X"3E",
X"FF",X"BC",X"20",X"16",X"7B",X"CB",X"07",X"DA",X"92",X"01",X"1D",X"20",X"CA",X"ED",X"57",X"A7",
X"20",X"17",X"DD",X"21",X"00",X"00",X"1E",X"80",X"18",X"BD",X"ED",X"57",X"A7",X"C2",X"02",X"01",
X"18",X"FE",X"DD",X"21",X"99",X"01",X"C3",X"79",X"00",X"2A",X"75",X"00",X"ED",X"4B",X"77",X"00",
X"36",X"55",X"2B",X"ED",X"A1",X"E2",X"AB",X"01",X"23",X"18",X"F5",X"16",X"AA",X"31",X"FF",X"FF",
X"ED",X"4B",X"77",X"00",X"7A",X"2F",X"AE",X"20",X"16",X"72",X"2B",X"ED",X"A1",X"EA",X"CC",X"01",
X"7A",X"FE",X"55",X"28",X"25",X"31",X"01",X"00",X"16",X"55",X"18",X"E4",X"39",X"18",X"E5",X"57",
X"ED",X"57",X"CB",X"0F",X"38",X"01",X"76",X"1E",X"12",X"7A",X"E6",X"0F",X"CA",X"02",X"01",X"1D",
X"7A",X"E6",X"F0",X"CA",X"02",X"01",X"1D",X"C3",X"02",X"01",X"ED",X"57",X"CB",X"0F",X"1E",X"20",
X"D2",X"B1",X"02",X"C3",X"02",X"01",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"01",X"48",X"10",X"ED",X"78",X"0C",X"ED",X"78",X"0C",X"ED",X"78",X"0C",X"0C",X"ED",X"78",X"0C",
X"ED",X"78",X"0C",X"ED",X"78",X"0C",X"3E",X"01",X"ED",X"79",X"01",X"48",X"00",X"ED",X"78",X"0C",
X"ED",X"78",X"0C",X"ED",X"78",X"21",X"00",X"50",X"11",X"00",X"70",X"06",X"10",X"78",X"3D",X"D3",
X"4B",X"3E",X"80",X"77",X"12",X"4E",X"CB",X"0F",X"30",X"F9",X"AF",X"DB",X"4E",X"3E",X"08",X"32",
X"00",X"50",X"32",X"00",X"70",X"AF",X"DB",X"4E",X"23",X"13",X"10",X"E1",X"06",X"0D",X"11",X"00",
X"A0",X"21",X"FE",X"5F",X"3E",X"80",X"25",X"77",X"4E",X"24",X"37",X"CB",X"15",X"CB",X"14",X"19",
X"CB",X"0F",X"10",X"F2",X"21",X"11",X"11",X"11",X"11",X"11",X"31",X"00",X"88",X"0E",X"10",X"06",
X"10",X"E5",X"E5",X"E5",X"E5",X"10",X"FA",X"19",X"F1",X"3B",X"3B",X"0D",X"20",X"F1",X"DB",X"4C",
X"AF",X"DB",X"4E",X"AF",X"DB",X"61",X"E6",X"02",X"28",X"FE",X"21",X"00",X"50",X"11",X"00",X"70",
X"3E",X"F0",X"ED",X"47",X"01",X"4B",X"00",X"ED",X"57",X"ED",X"79",X"0E",X"00",X"79",X"70",X"12",
X"48",X"2F",X"46",X"47",X"B1",X"20",X"F6",X"ED",X"57",X"D6",X"10",X"ED",X"47",X"20",X"E5",X"18",
X"FE",X"DD",X"21",X"B8",X"02",X"C3",X"79",X"00",X"21",X"FF",X"5F",X"11",X"00",X"00",X"DD",X"21",
X"C5",X"02",X"C3",X"95",X"03",X"01",X"00",X"00",X"21",X"00",X"40",X"DD",X"21",X"D2",X"02",X"C3",
X"76",X"03",X"21",X"00",X"40",X"11",X"55",X"00",X"DD",X"21",X"DF",X"02",X"C3",X"95",X"03",X"21",
X"FF",X"5F",X"11",X"AA",X"55",X"DD",X"21",X"EC",X"02",X"C3",X"95",X"03",X"21",X"00",X"40",X"11",
X"FF",X"AA",X"DD",X"21",X"F9",X"02",X"C3",X"95",X"03",X"21",X"FF",X"5F",X"11",X"00",X"FF",X"DD",
X"21",X"06",X"03",X"C3",X"95",X"03",X"79",X"B0",X"C2",X"C1",X"03",X"DD",X"21",X"12",X"03",X"C3",
X"79",X"00",X"21",X"FF",X"87",X"11",X"00",X"00",X"DD",X"21",X"1F",X"03",X"C3",X"95",X"03",X"01",
X"00",X"00",X"21",X"00",X"80",X"DD",X"21",X"2C",X"03",X"C3",X"76",X"03",X"21",X"00",X"84",X"DD",
X"21",X"36",X"03",X"C3",X"76",X"03",X"21",X"00",X"80",X"11",X"55",X"00",X"DD",X"21",X"43",X"03",
X"C3",X"8F",X"03",X"21",X"FF",X"87",X"11",X"AA",X"55",X"DD",X"21",X"50",X"03",X"C3",X"8F",X"03",
X"21",X"00",X"80",X"11",X"FF",X"AA",X"DD",X"21",X"5D",X"03",X"C3",X"8F",X"03",X"21",X"FF",X"87",
X"11",X"00",X"FF",X"DD",X"21",X"6A",X"03",X"C3",X"8F",X"03",X"79",X"B0",X"C2",X"6C",X"03",X"DD",
X"21",X"42",X"04",X"C3",X"79",X"00",X"16",X"00",X"72",X"7E",X"AA",X"B0",X"47",X"23",X"72",X"7E",
X"AA",X"B1",X"4F",X"2B",X"15",X"C2",X"78",X"03",X"36",X"00",X"23",X"36",X"00",X"DD",X"E9",X"D9",
X"01",X"00",X"08",X"18",X"04",X"D9",X"01",X"00",X"20",X"D9",X"7E",X"AA",X"B0",X"47",X"73",X"7E",
X"AB",X"B0",X"47",X"CB",X"43",X"C2",X"AA",X"03",X"2B",X"3E",X"23",X"78",X"41",X"4F",X"D9",X"0D",
X"C2",X"B7",X"03",X"05",X"CA",X"BB",X"03",X"D9",X"C3",X"9A",X"03",X"D9",X"78",X"41",X"4F",X"DD",
X"E9",X"21",X"22",X"04",X"11",X"01",X"00",X"78",X"A2",X"C2",X"E8",X"03",X"79",X"A3",X"C3",X"E8",
X"03",X"EB",X"29",X"EB",X"D2",X"C7",X"03",X"11",X"00",X"40",X"1D",X"FD",X"7E",X"00",X"C2",X"DA",
X"03",X"15",X"C2",X"DA",X"03",X"C3",X"B8",X"02",X"08",X"7E",X"23",X"D9",X"6F",X"D9",X"7E",X"23",
X"D9",X"67",X"11",X"1F",X"00",X"06",X"03",X"08",X"B7",X"28",X"07",X"36",X"FC",X"23",X"36",X"3F",
X"18",X"05",X"36",X"84",X"23",X"36",X"21",X"19",X"10",X"EE",X"06",X"24",X"B7",X"28",X"07",X"36",
X"FF",X"23",X"36",X"FF",X"18",X"05",X"36",X"80",X"23",X"36",X"01",X"19",X"10",X"EE",X"D9",X"C3",
X"D1",X"03",X"8D",X"50",X"4D",X"4A",X"0D",X"44",X"CD",X"56",X"15",X"44",X"55",X"4A",X"95",X"50",
X"D5",X"56",X"89",X"50",X"49",X"4A",X"09",X"44",X"C9",X"56",X"11",X"44",X"51",X"4A",X"91",X"50",
X"D1",X"56",X"21",X"00",X"60",X"16",X"01",X"42",X"AF",X"4F",X"5F",X"ED",X"47",X"ED",X"57",X"D3",
X"4B",X"36",X"FF",X"72",X"36",X"00",X"7E",X"BB",X"20",X"FE",X"ED",X"57",X"3C",X"ED",X"47",X"FE",
X"10",X"20",X"0B",X"CB",X"12",X"30",X"E0",X"DD",X"21",X"87",X"04",X"C3",X"79",X"00",X"79",X"CB",
X"1F",X"CB",X"18",X"CB",X"19",X"59",X"ED",X"57",X"FE",X"08",X"38",X"D1",X"3E",X"08",X"CB",X"08",
X"CB",X"13",X"3D",X"20",X"F9",X"18",X"C6",X"1E",X"00",X"DD",X"21",X"CA",X"04",X"21",X"00",X"60",
X"01",X"01",X"01",X"7B",X"D3",X"4B",X"78",X"32",X"00",X"40",X"71",X"79",X"DD",X"E9",X"AE",X"20",
X"FE",X"77",X"78",X"A1",X"28",X"02",X"3E",X"80",X"57",X"DB",X"4E",X"AA",X"17",X"38",X"FE",X"CB",
X"00",X"30",X"E0",X"CB",X"01",X"30",X"DC",X"DD",X"23",X"DD",X"23",X"DD",X"23",X"3E",X"10",X"83",
X"5F",X"30",X"D0",X"DD",X"21",X"FA",X"04",X"C3",X"79",X"00",X"00",X"18",X"D1",X"B0",X"18",X"CE",
X"2F",X"18",X"18",X"AF",X"18",X"21",X"A0",X"18",X"C5",X"78",X"18",X"C2",X"A8",X"18",X"18",X"2F",
X"18",X"EB",X"2F",X"18",X"0F",X"A8",X"18",X"B6",X"78",X"18",X"0C",X"A0",X"18",X"09",X"AF",X"18",
X"AD",X"2F",X"18",X"E2",X"B0",X"18",X"00",X"2F",X"18",X"A4",X"ED",X"5E",X"3E",X"07",X"ED",X"47",
X"DD",X"21",X"02",X"16",X"3E",X"FF",X"D3",X"4F",X"47",X"31",X"FF",X"43",X"DB",X"4E",X"1F",X"CB",
X"10",X"78",X"EE",X"55",X"28",X"03",X"FB",X"18",X"FE",X"D3",X"4F",X"06",X"FF",X"31",X"FF",X"43",
X"DB",X"4D",X"DB",X"4E",X"1F",X"CB",X"10",X"78",X"EE",X"20",X"CA",X"79",X"00",X"DB",X"4C",X"18",
X"FE",X"31",X"00",X"44",X"CD",X"4E",X"1A",X"CD",X"F8",X"35",X"21",X"B9",X"05",X"11",X"20",X"00",
X"CD",X"91",X"05",X"11",X"20",X"80",X"CD",X"91",X"05",X"11",X"08",X"10",X"CD",X"91",X"05",X"11",
X"10",X"D0",X"CD",X"91",X"05",X"21",X"A0",X"47",X"CD",X"45",X"1A",X"21",X"A0",X"55",X"CD",X"45",
X"1A",X"11",X"08",X"20",X"DB",X"61",X"CD",X"97",X"05",X"DB",X"60",X"CD",X"97",X"05",X"DB",X"62",
X"CD",X"97",X"05",X"DB",X"63",X"CD",X"97",X"05",X"DB",X"64",X"CD",X"97",X"05",X"11",X"08",X"90",
X"DB",X"48",X"CD",X"96",X"05",X"DB",X"49",X"CD",X"96",X"05",X"DB",X"4A",X"CD",X"96",X"05",X"18",
X"D0",X"06",X"00",X"C3",X"B8",X"06",X"2F",X"0E",X"08",X"21",X"01",X"06",X"1F",X"38",X"03",X"21",
X"03",X"06",X"F5",X"D5",X"C5",X"CD",X"91",X"05",X"C1",X"D1",X"F1",X"21",X"20",X"00",X"19",X"EB",
X"0D",X"20",X"E6",X"21",X"00",X"0F",X"19",X"EB",X"C9",X"5A",X"50",X"55",X"20",X"44",X"49",X"50",
X"20",X"53",X"57",X"49",X"54",X"43",X"48",X"45",X"53",X"00",X"56",X"46",X"42",X"20",X"53",X"57",
X"49",X"54",X"43",X"48",X"45",X"53",X"00",X"31",X"20",X"20",X"20",X"32",X"20",X"20",X"20",X"33",
X"20",X"20",X"20",X"34",X"20",X"20",X"20",X"35",X"20",X"20",X"20",X"36",X"20",X"20",X"20",X"37",
X"20",X"20",X"20",X"38",X"00",X"30",X"3D",X"4F",X"46",X"46",X"20",X"20",X"7F",X"3D",X"4F",X"4E",
X"00",X"7F",X"00",X"30",X"00",X"AF",X"D3",X"4F",X"DB",X"4E",X"31",X"00",X"43",X"DB",X"65",X"CB",
X"7F",X"20",X"FA",X"CD",X"4E",X"1A",X"CD",X"3D",X"36",X"F3",X"21",X"CC",X"06",X"7E",X"B7",X"CA",
X"02",X"16",X"CD",X"9A",X"06",X"06",X"00",X"11",X"00",X"CF",X"CD",X"B8",X"06",X"CD",X"9A",X"06",
X"E5",X"5E",X"23",X"56",X"23",X"46",X"23",X"E5",X"21",X"00",X"00",X"E5",X"E5",X"E5",X"39",X"CD",
X"73",X"06",X"11",X"CF",X"00",X"CD",X"8D",X"06",X"E1",X"E1",X"E1",X"E1",X"E3",X"DB",X"65",X"CB",
X"7F",X"20",X"16",X"DB",X"48",X"CB",X"67",X"20",X"F4",X"E5",X"5E",X"23",X"56",X"23",X"46",X"AF",
X"12",X"13",X"10",X"FC",X"E1",X"D1",X"C3",X"30",X"06",X"E1",X"DB",X"65",X"CB",X"7F",X"20",X"FA",
X"C3",X"1D",X"06",X"E5",X"D5",X"C5",X"1A",X"13",X"E6",X"F0",X"4F",X"1A",X"13",X"07",X"07",X"07",
X"07",X"E6",X"0F",X"B1",X"77",X"23",X"05",X"10",X"ED",X"C1",X"D1",X"E1",X"C9",X"C5",X"D5",X"E5",
X"53",X"1E",X"00",X"CD",X"40",X"2A",X"E1",X"D1",X"C1",X"C9",X"C5",X"D5",X"E5",X"01",X"C0",X"19",
X"11",X"00",X"44",X"21",X"00",X"46",X"ED",X"B0",X"01",X"00",X"02",X"AF",X"12",X"13",X"0D",X"C2",
X"AC",X"06",X"10",X"F8",X"E1",X"D1",X"C1",X"C9",X"EB",X"CD",X"A3",X"29",X"EB",X"4E",X"CD",X"DB",
X"29",X"13",X"23",X"47",X"7E",X"B7",X"78",X"C2",X"BD",X"06",X"23",X"C9",X"43",X"72",X"65",X"64",
X"69",X"74",X"73",X"00",X"A4",X"08",X"02",X"43",X"68",X"75",X"74",X"65",X"20",X"31",X"00",X"A6",
X"08",X"08",X"43",X"68",X"75",X"74",X"65",X"20",X"32",X"00",X"AE",X"08",X"08",X"43",X"68",X"75",
X"74",X"65",X"20",X"33",X"00",X"B6",X"08",X"08",X"50",X"6C",X"61",X"79",X"73",X"00",X"BE",X"08",
X"06",X"54",X"6F",X"74",X"61",X"6C",X"20",X"53",X"63",X"6F",X"72",X"65",X"00",X"C4",X"08",X"0C",
X"54",X"6F",X"74",X"61",X"6C",X"20",X"53",X"65",X"63",X"6F",X"6E",X"64",X"73",X"20",X"6F",X"66",
X"20",X"50",X"6C",X"61",X"79",X"00",X"D0",X"08",X"0C",X"48",X"69",X"67",X"68",X"20",X"53",X"63",
X"6F",X"72",X"65",X"73",X"00",X"DC",X"08",X"06",X"00",X"F3",X"21",X"00",X"44",X"54",X"5D",X"36",
X"01",X"23",X"73",X"23",X"01",X"FD",X"1B",X"EB",X"ED",X"B0",X"21",X"00",X"45",X"54",X"5D",X"06",
X"20",X"36",X"FF",X"23",X"10",X"FB",X"01",X"80",X"02",X"09",X"EB",X"01",X"7F",X"18",X"ED",X"B0",
X"CD",X"F8",X"35",X"CD",X"86",X"07",X"21",X"00",X"44",X"11",X"01",X"44",X"01",X"FF",X"1B",X"36",
X"FF",X"ED",X"B0",X"21",X"00",X"81",X"11",X"01",X"81",X"01",X"FF",X"06",X"36",X"11",X"ED",X"B0",
X"CD",X"86",X"07",X"C3",X"3A",X"07",X"DB",X"48",X"CB",X"67",X"20",X"FA",X"DB",X"48",X"CB",X"67",
X"28",X"FA",X"C9",X"CD",X"7B",X"29",X"90",X"08",X"20",X"59",X"6F",X"75",X"20",X"68",X"61",X"76",
X"65",X"20",X"6A",X"6F",X"69",X"6E",X"65",X"64",X"20",X"74",X"68",X"65",X"20",X"69",X"6D",X"6D",
X"6F",X"72",X"74",X"61",X"6C",X"73",X"00",X"CD",X"7B",X"29",X"90",X"0C",X"30",X"69",X"6E",X"20",
X"74",X"68",X"65",X"20",X"42",X"45",X"52",X"5A",X"45",X"52",X"4B",X"20",X"68",X"61",X"6C",X"6C",
X"20",X"6F",X"66",X"20",X"66",X"61",X"6D",X"65",X"00",X"CD",X"7B",X"29",X"90",X"18",X"50",X"45",
X"6E",X"74",X"65",X"72",X"20",X"79",X"6F",X"75",X"72",X"20",X"69",X"6E",X"69",X"74",X"69",X"61",
X"6C",X"73",X"3A",X"00",X"C9",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"09",X"05",X"17",X"05");
begin
process(clk)
begin
if rising_edge(clk) then
data <= rom_data(to_integer(unsigned(addr)));
end if;
end process;
end architecture;

View File

@@ -0,0 +1,662 @@
library ieee;
use ieee.std_logic_1164.all,ieee.numeric_std.all;
entity berzerk_program2 is
port (
clk : in std_logic;
addr : in std_logic_vector(13 downto 0);
data : out std_logic_vector(7 downto 0)
);
end entity;
architecture prom of berzerk_program2 is
type rom is array(0 to 10239) of std_logic_vector(7 downto 0);
signal rom_data: rom := (
X"10",X"D1",X"10",X"DE",X"10",X"EB",X"10",X"F8",X"10",X"F8",X"10",X"F8",X"11",X"05",X"11",X"12",
X"00",X"00",X"10",X"11",X"2C",X"11",X"1F",X"11",X"1F",X"00",X"13",X"10",X"10",X"D1",X"11",X"39",
X"10",X"D1",X"11",X"47",X"00",X"1C",X"10",X"11",X"55",X"11",X"62",X"11",X"62",X"00",X"27",X"10",
X"11",X"6F",X"11",X"7C",X"11",X"6F",X"11",X"8A",X"00",X"30",X"10",X"11",X"98",X"11",X"BC",X"11",
X"E0",X"12",X"08",X"00",X"41",X"10",X"10",X"BF",X"00",X"46",X"10",X"10",X"AD",X"10",X"9B",X"10",
X"89",X"10",X"9B",X"00",X"4B",X"10",X"13",X"B5",X"13",X"A3",X"13",X"91",X"13",X"A3",X"00",X"56",
X"10",X"13",X"09",X"00",X"61",X"10",X"13",X"1A",X"00",X"66",X"10",X"13",X"2B",X"00",X"6B",X"10",
X"13",X"3C",X"00",X"70",X"10",X"13",X"4D",X"00",X"75",X"10",X"13",X"5E",X"00",X"7A",X"10",X"13",
X"6F",X"00",X"7F",X"10",X"13",X"80",X"00",X"84",X"10",X"01",X"10",X"18",X"18",X"00",X"3C",X"5A",
X"99",X"58",X"18",X"18",X"24",X"22",X"41",X"41",X"81",X"81",X"00",X"01",X"10",X"00",X"18",X"18",
X"00",X"3C",X"5C",X"5C",X"3E",X"18",X"18",X"14",X"12",X"F2",X"82",X"02",X"03",X"01",X"10",X"18",
X"18",X"00",X"3C",X"5C",X"5C",X"5A",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"1C",X"10",X"01",
X"10",X"18",X"18",X"00",X"3C",X"5A",X"5A",X"5A",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"1C",
X"10",X"01",X"0B",X"3C",X"66",X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"24",X"66",X"01",X"0B",
X"3C",X"4E",X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"24",X"66",X"01",X"0B",X"3C",X"1E",X"FF",
X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"24",X"66",X"01",X"0B",X"3C",X"7E",X"FF",X"BD",X"BD",X"BD",
X"3C",X"24",X"24",X"24",X"66",X"01",X"0B",X"3C",X"78",X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",
X"24",X"66",X"01",X"0B",X"3C",X"71",X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"24",X"66",X"01",
X"0B",X"3C",X"78",X"FF",X"BD",X"BD",X"BD",X"3C",X"18",X"18",X"18",X"1C",X"01",X"0B",X"3C",X"78",
X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"24",X"36",X"01",X"0C",X"3C",X"66",X"FF",X"BD",X"BD",
X"BD",X"3C",X"24",X"24",X"26",X"20",X"60",X"01",X"0C",X"3C",X"66",X"FF",X"BD",X"BD",X"BD",X"3C",
X"24",X"24",X"64",X"04",X"06",X"01",X"0B",X"3C",X"1E",X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",
X"24",X"6C",X"01",X"0B",X"3C",X"1E",X"FF",X"BD",X"BD",X"BD",X"3C",X"18",X"18",X"18",X"38",X"01",
X"0B",X"3C",X"7E",X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"24",X"66",X"01",X"0C",X"3C",X"7E",
X"FF",X"BD",X"BD",X"BD",X"3C",X"24",X"24",X"26",X"20",X"60",X"01",X"0C",X"3C",X"7E",X"FF",X"BD",
X"BD",X"BD",X"3C",X"24",X"24",X"64",X"04",X"06",X"02",X"11",X"00",X"00",X"00",X"00",X"00",X"00",
X"00",X"00",X"00",X"00",X"00",X"00",X"03",X"C0",X"07",X"E0",X"0F",X"F0",X"13",X"C8",X"22",X"C4",
X"03",X"40",X"03",X"C0",X"02",X"40",X"02",X"40",X"02",X"40",X"06",X"60",X"02",X"11",X"00",X"00",
X"00",X"00",X"00",X"00",X"00",X"00",X"03",X"C0",X"06",X"60",X"12",X"48",X"08",X"10",X"10",X"08",
X"22",X"44",X"44",X"42",X"02",X"10",X"03",X"C0",X"02",X"40",X"04",X"20",X"02",X"40",X"06",X"60",
X"02",X"13",X"00",X"00",X"02",X"00",X"00",X"40",X"00",X"08",X"10",X"00",X"03",X"00",X"00",X"12",
X"08",X"01",X"80",X"00",X"08",X"02",X"40",X"02",X"04",X"10",X"23",X"C0",X"40",X"04",X"20",X"02",
X"00",X"00",X"80",X"00",X"10",X"08",X"18",X"0C",X"01",X"01",X"00",X"12",X"2E",X"12",X"34",X"12",
X"3B",X"12",X"43",X"12",X"4C",X"12",X"56",X"12",X"A7",X"12",X"6D",X"12",X"79",X"12",X"85",X"12",
X"91",X"12",X"9D",X"12",X"91",X"12",X"85",X"12",X"79",X"12",X"6D",X"00",X"17",X"12",X"84",X"00",
X"01",X"02",X"18",X"18",X"84",X"00",X"01",X"03",X"10",X"38",X"10",X"84",X"00",X"01",X"04",X"18",
X"3C",X"3C",X"18",X"84",X"00",X"01",X"05",X"38",X"7C",X"7C",X"7C",X"38",X"84",X"00",X"01",X"06",
X"3C",X"7E",X"7E",X"7E",X"7E",X"3C",X"84",X"00",X"01",X"07",X"38",X"7C",X"FE",X"FE",X"FE",X"7C",
X"38",X"84",X"00",X"01",X"08",X"3C",X"7E",X"FF",X"FF",X"FF",X"FF",X"7E",X"3C",X"82",X"00",X"01",
X"08",X"3C",X"7E",X"DB",X"FF",X"FF",X"BD",X"42",X"3C",X"81",X"00",X"01",X"08",X"3C",X"7E",X"DB",
X"FF",X"FF",X"BD",X"42",X"3C",X"80",X"80",X"01",X"08",X"3C",X"7E",X"DB",X"FF",X"FF",X"BD",X"42",
X"3C",X"80",X"40",X"01",X"08",X"3C",X"7E",X"DB",X"FF",X"FF",X"BD",X"42",X"3C",X"01",X"08",X"3C",
X"7E",X"DB",X"FF",X"FF",X"BD",X"42",X"3C",X"84",X"00",X"01",X"08",X"00",X"00",X"00",X"3C",X"7E",
X"DB",X"FF",X"7E",X"12",X"D0",X"12",X"BE",X"12",X"E3",X"12",X"F6",X"00",X"B3",X"12",X"01",X"10",
X"00",X"18",X"18",X"00",X"3C",X"5A",X"5A",X"5A",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"3C",
X"01",X"11",X"18",X"24",X"24",X"42",X"81",X"81",X"81",X"81",X"81",X"42",X"24",X"24",X"24",X"24",
X"24",X"42",X"3C",X"01",X"11",X"3C",X"24",X"24",X"7E",X"C3",X"A5",X"A5",X"A5",X"E7",X"66",X"24",
X"24",X"24",X"24",X"66",X"42",X"7E",X"01",X"11",X"3C",X"3C",X"3C",X"7E",X"FF",X"FF",X"FF",X"FF",
X"FF",X"7E",X"3C",X"3C",X"3C",X"3C",X"7E",X"7E",X"7E",X"01",X"0F",X"18",X"19",X"04",X"1C",X"18",
X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"1C",X"01",X"0F",X"18",X"18",X"00",X"1F",
X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"1C",X"01",X"0F",X"18",X"18",X"00",
X"18",X"18",X"1C",X"1A",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"1C",X"01",X"0F",X"18",X"18",
X"00",X"3C",X"3C",X"3A",X"3A",X"3A",X"18",X"18",X"18",X"18",X"18",X"18",X"1C",X"01",X"0F",X"18",
X"18",X"00",X"3C",X"3C",X"5C",X"9C",X"1C",X"18",X"18",X"18",X"18",X"18",X"18",X"38",X"01",X"0F",
X"18",X"18",X"00",X"F8",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"38",X"01",
X"0F",X"98",X"58",X"20",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"38",
X"01",X"0F",X"18",X"18",X"00",X"1D",X"1B",X"19",X"18",X"18",X"18",X"18",X"18",X"18",X"18",X"18",
X"38",X"01",X"10",X"18",X"18",X"00",X"3C",X"5A",X"99",X"9A",X"18",X"18",X"24",X"44",X"42",X"42",
X"41",X"41",X"80",X"01",X"10",X"00",X"18",X"18",X"00",X"3C",X"3A",X"3A",X"7C",X"18",X"18",X"28",
X"48",X"4F",X"41",X"40",X"80",X"01",X"10",X"18",X"18",X"00",X"3C",X"3A",X"3A",X"7A",X"18",X"18",
X"18",X"18",X"18",X"18",X"18",X"18",X"38",X"72",X"20",X"62",X"6F",X"75",X"74",X"6F",X"6E",X"20",
X"73",X"74",X"61",X"72",X"74",X"20",X"31",X"20",X"6F",X"75",X"20",X"32",X"00",X"C9",X"CD",X"7B",
X"29",X"90",X"20",X"BE",X"53",X"74",X"61",X"72",X"74",X"6B",X"6E",X"6F",X"65",X"70",X"66",X"65",
X"20",X"64",X"72",X"75",X"65",X"63",X"6B",X"65",X"6E",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"44",
X"BE",X"50",X"75",X"6C",X"73",X"61",X"72",X"20",X"53",X"74",X"61",X"72",X"74",X"00",X"C9",X"CD",
X"7B",X"29",X"90",X"58",X"BE",X"49",X"6E",X"73",X"65",X"72",X"74",X"20",X"43",X"6F",X"69",X"6E",
X"00",X"C9",X"CD",X"7B",X"29",X"90",X"30",X"BE",X"49",X"6E",X"74",X"72",X"6F",X"64",X"75",X"69",
X"72",X"65",X"20",X"6C",X"61",X"20",X"6D",X"6F",X"6E",X"6E",X"61",X"69",X"65",X"00",X"C9",X"CD",
X"7B",X"29",X"90",X"48",X"BE",X"4D",X"75",X"6E",X"7A",X"65",X"20",X"65",X"69",X"6E",X"77",X"65",
X"72",X"66",X"65",X"6E",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"48",X"BE",X"50",X"6F",X"6E",X"67",
X"61",X"20",X"6C",X"61",X"20",X"6D",X"6F",X"6E",X"65",X"64",X"61",X"00",X"C9",X"00",X"C5",X"F5",
X"FD",X"2A",X"76",X"08",X"FD",X"66",X"07",X"FD",X"6E",X"09",X"CD",X"E7",X"1C",X"D5",X"DD",X"66",
X"07",X"DD",X"6E",X"09",X"2D",X"2D",X"2D",X"2D",X"25",X"25",X"25",X"25",X"CD",X"E7",X"1C",X"D9",
X"47",X"D9",X"C1",X"79",X"BB",X"20",X"03",X"F1",X"C1",X"C9",X"7C",X"E5",X"C6",X"10",X"67",X"CD",
X"E7",X"1C",X"D9",X"4F",X"D9",X"7D",X"C6",X"13",X"6F",X"CD",X"E7",X"1C",X"D9",X"57",X"D9",X"7D",
X"E1",X"6F",X"CD",X"E7",X"1C",X"D9",X"5F",X"F1",X"67",X"2E",X"00",X"CB",X"5C",X"28",X"06",X"78",
X"B1",X"E6",X"08",X"B5",X"6F",X"CB",X"54",X"28",X"06",X"7A",X"B3",X"E6",X"04",X"B5",X"6F",X"CB",
X"4C",X"28",X"06",X"78",X"B3",X"E6",X"02",X"B5",X"6F",X"CB",X"44",X"28",X"06",X"79",X"B2",X"E6",
X"01",X"B5",X"6F",X"2F",X"A4",X"C1",X"C9",X"7D",X"1E",X"00",X"FE",X"46",X"38",X"08",X"1E",X"05",
X"FE",X"8A",X"EA",X"06",X"02",X"CD",X"05",X"15",X"3A",X"7A",X"43",X"C6",X"02",X"E6",X"07",X"47",
X"CD",X"05",X"15",X"06",X"07",X"FD",X"21",X"7B",X"43",X"C5",X"FD",X"E5",X"CD",X"1A",X"15",X"FD",
X"E1",X"C1",X"11",X"08",X"00",X"FD",X"19",X"10",X"F0",X"C9",X"FD",X"7E",X"00",X"B7",X"28",X"0C",
X"FD",X"34",X"01",X"CD",X"53",X"15",X"DC",X"A0",X"15",X"CD",X"7E",X"15",X"01",X"04",X"00",X"FD",
X"09",X"FD",X"35",X"01",X"C0",X"FD",X"34",X"01",X"AF",X"FD",X"B6",X"FD",X"C8",X"AF",X"FD",X"B6",
X"00",X"CA",X"4A",X"15",X"CD",X"53",X"15",X"CD",X"7E",X"15",X"FD",X"35",X"FD",X"C0",X"FD",X"36",
X"00",X"00",X"C9",X"0F",X"D2",X"5A",X"15",X"FD",X"35",X"02",X"0F",X"D2",X"61",X"15",X"FD",X"34",
X"02",X"0F",X"D2",X"68",X"15",X"FD",X"35",X"03",X"0F",X"D2",X"6F",X"15",X"FD",X"34",X"03",X"FD",
X"66",X"03",X"FD",X"6E",X"02",X"CD",X"A1",X"29",X"36",X"80",X"DB",X"4E",X"07",X"C9",X"FD",X"7E",
X"02",X"FD",X"46",X"00",X"11",X"FF",X"03",X"CD",X"97",X"15",X"FD",X"7E",X"03",X"11",X"D0",X"0C",
X"CD",X"97",X"15",X"FD",X"70",X"00",X"C9",X"FE",X"00",X"28",X"02",X"BB",X"C0",X"06",X"00",X"C9",
X"FD",X"36",X"00",X"00",X"DD",X"2A",X"76",X"08",X"CD",X"CB",X"15",X"ED",X"4B",X"70",X"08",X"78",
X"B1",X"28",X"17",X"C5",X"DD",X"E1",X"CD",X"CB",X"15",X"DD",X"66",X"FF",X"DD",X"6E",X"FE",X"E5",
X"DD",X"E1",X"7D",X"B9",X"20",X"F0",X"7C",X"B8",X"20",X"EC",X"C9",X"DD",X"CB",X"00",X"56",X"C8",
X"DD",X"66",X"0B",X"DD",X"6E",X"0A",X"56",X"23",X"5E",X"EB",X"56",X"23",X"5E",X"1C",X"FD",X"7E",
X"03",X"DD",X"96",X"09",X"3C",X"F8",X"BB",X"D0",X"FD",X"7E",X"02",X"DD",X"96",X"07",X"F8",X"CB",
X"22",X"CB",X"22",X"CB",X"22",X"14",X"BA",X"D0",X"DD",X"CB",X"00",X"FE",X"DD",X"CB",X"FA",X"C6",
X"E1",X"C9",X"F3",X"31",X"00",X"43",X"DB",X"60",X"CB",X"4F",X"C2",X"3A",X"07",X"21",X"70",X"08",
X"06",X"34",X"36",X"00",X"23",X"10",X"FB",X"21",X"00",X"40",X"01",X"00",X"04",X"AF",X"77",X"23",
X"0D",X"20",X"FB",X"10",X"F9",X"CD",X"21",X"17",X"21",X"DC",X"08",X"11",X"02",X"43",X"06",X"1E",
X"7E",X"23",X"E6",X"F0",X"4F",X"7E",X"23",X"0F",X"0F",X"0F",X"0F",X"E6",X"0F",X"B1",X"12",X"13",
X"10",X"EE",X"DB",X"49",X"2F",X"21",X"9F",X"08",X"77",X"23",X"77",X"CD",X"66",X"16",X"CD",X"AC",
X"19",X"CD",X"8B",X"18",X"CD",X"98",X"1A",X"CD",X"8B",X"18",X"CD",X"85",X"16",X"CA",X"4B",X"16",
X"CD",X"66",X"16",X"CD",X"B2",X"18",X"F3",X"E1",X"22",X"00",X"44",X"32",X"02",X"44",X"31",X"00",
X"43",X"CD",X"22",X"1E",X"FD",X"2A",X"72",X"08",X"CD",X"F1",X"22",X"CD",X"AB",X"26",X"2A",X"00",
X"44",X"3A",X"02",X"44",X"E9",X"2A",X"3E",X"43",X"22",X"73",X"43",X"3A",X"40",X"43",X"32",X"75",
X"43",X"21",X"00",X"00",X"22",X"3E",X"43",X"22",X"3F",X"43",X"2A",X"5C",X"43",X"E5",X"21",X"D9",
X"16",X"22",X"6F",X"43",X"3E",X"FF",X"32",X"6E",X"43",X"01",X"0C",X"00",X"11",X"44",X"43",X"21",
X"CD",X"16",X"ED",X"B0",X"CD",X"9D",X"20",X"E1",X"F5",X"22",X"5C",X"43",X"CD",X"78",X"26",X"2A",
X"73",X"43",X"22",X"3E",X"43",X"2A",X"74",X"43",X"22",X"3F",X"43",X"F1",X"C9",X"01",X"02",X"02",
X"1E",X"64",X"01",X"70",X"00",X"01",X"1E",X"02",X"00",X"0A",X"8F",X"12",X"8F",X"14",X"8F",X"19",
X"8F",X"02",X"9F",X"19",X"8F",X"06",X"8F",X"18",X"8F",X"02",X"FF",X"00",X"FF",X"02",X"FF",X"BF",
X"08",X"AF",X"09",X"BF",X"01",X"BF",X"09",X"FF",X"09",X"C1",X"12",X"8F",X"00",X"FF",X"01",X"D4",
X"08",X"BF",X"18",X"BF",X"18",X"8F",X"08",X"FF",X"08",X"B6",X"02",X"C0",X"06",X"9C",X"12",X"8F",
X"08",X"BF",X"00",X"FF",X"14",X"8F",X"14",X"8F",X"14",X"8F",X"14",X"8F",X"14",X"8F",X"00",X"FF",
X"FF",X"ED",X"73",X"5E",X"08",X"31",X"5E",X"08",X"F5",X"C5",X"D5",X"E5",X"DD",X"E5",X"DB",X"65",
X"CB",X"7F",X"C2",X"05",X"06",X"3A",X"6E",X"43",X"B7",X"CC",X"12",X"1D",X"CD",X"76",X"17",X"3A",
X"6E",X"43",X"B7",X"20",X"1D",X"2A",X"98",X"08",X"7C",X"B5",X"28",X"19",X"DB",X"44",X"E6",X"C0",
X"FE",X"40",X"20",X"11",X"7E",X"CB",X"7F",X"20",X"09",X"23",X"D3",X"44",X"CB",X"77",X"28",X"05",
X"18",X"E6",X"21",X"00",X"00",X"22",X"98",X"08",X"DD",X"E1",X"E1",X"D1",X"C1",X"F1",X"ED",X"7B",
X"5E",X"08",X"D3",X"4C",X"ED",X"45",X"21",X"78",X"08",X"46",X"23",X"56",X"23",X"5E",X"23",X"0E",
X"41",X"CB",X"80",X"CB",X"C2",X"ED",X"51",X"0D",X"ED",X"41",X"0C",X"CB",X"82",X"ED",X"51",X"0D",
X"ED",X"59",X"0C",X"0C",X"06",X"03",X"79",X"0C",X"51",X"5E",X"23",X"4F",X"7E",X"23",X"ED",X"79",
X"79",X"4A",X"ED",X"59",X"14",X"14",X"10",X"F1",X"0D",X"3E",X"00",X"06",X"04",X"B6",X"23",X"ED",
X"79",X"E6",X"C0",X"C6",X"40",X"10",X"F6",X"C9",X"06",X"06",X"21",X"BE",X"08",X"CD",X"B3",X"2D",
X"3A",X"76",X"43",X"FE",X"02",X"CC",X"B3",X"2D",X"CD",X"51",X"18",X"01",X"0C",X"00",X"11",X"44",
X"43",X"21",X"7F",X"18",X"ED",X"B0",X"CD",X"78",X"26",X"2A",X"5C",X"43",X"22",X"45",X"43",X"AF",
X"32",X"6E",X"43",X"32",X"9A",X"08",X"3C",X"32",X"9B",X"08",X"CD",X"A7",X"33",X"21",X"44",X"43",
X"11",X"50",X"43",X"01",X"0C",X"00",X"ED",X"B0",X"3E",X"02",X"77",X"3A",X"76",X"43",X"FE",X"02",
X"28",X"04",X"AF",X"32",X"55",X"43",X"FB",X"21",X"1E",X"64",X"22",X"47",X"43",X"3A",X"44",X"43",
X"3D",X"28",X"0B",X"DB",X"4A",X"CB",X"7F",X"28",X"05",X"3E",X"E0",X"32",X"47",X"43",X"CD",X"9D",
X"20",X"CD",X"78",X"26",X"2A",X"5C",X"43",X"22",X"45",X"43",X"3E",X"5A",X"CD",X"6D",X"1E",X"CD",
X"F1",X"22",X"21",X"49",X"43",X"35",X"08",X"CD",X"6A",X"18",X"7E",X"B7",X"C2",X"06",X"18",X"08",
X"20",X"F5",X"CD",X"6A",X"18",X"CD",X"51",X"2C",X"CD",X"6A",X"18",X"CD",X"51",X"2C",X"C3",X"4B",
X"16",X"21",X"00",X"00",X"22",X"3E",X"43",X"22",X"40",X"43",X"22",X"42",X"43",X"22",X"A1",X"08",
X"22",X"A2",X"08",X"21",X"DB",X"1A",X"22",X"98",X"08",X"C9",X"E5",X"21",X"44",X"43",X"11",X"50",
X"43",X"06",X"0C",X"1A",X"4E",X"EB",X"12",X"71",X"EB",X"23",X"13",X"10",X"F6",X"E1",X"C9",X"01",
X"00",X"00",X"1E",X"64",X"03",X"60",X"00",X"05",X"5A",X"00",X"00",X"06",X"03",X"2A",X"72",X"08",
X"23",X"36",X"3C",X"2B",X"CB",X"CE",X"DB",X"65",X"CB",X"47",X"28",X"04",X"3E",X"01",X"18",X"21",
X"CD",X"7B",X"19",X"CD",X"97",X"19",X"20",X"0A",X"2A",X"72",X"08",X"CB",X"4E",X"20",X"E7",X"10",
X"DC",X"C9",X"6F",X"CD",X"F1",X"18",X"CB",X"4D",X"3E",X"01",X"28",X"05",X"CD",X"F1",X"18",X"3E",
X"02",X"32",X"76",X"43",X"2A",X"72",X"08",X"36",X"01",X"E1",X"C3",X"B8",X"17",X"E5",X"21",X"00",
X"00",X"39",X"CD",X"E0",X"18",X"77",X"06",X"02",X"11",X"78",X"D5",X"CD",X"40",X"2A",X"E1",X"C9",
X"3A",X"A5",X"08",X"0F",X"0F",X"0F",X"0F",X"E6",X"0F",X"4F",X"3A",X"A4",X"08",X"E6",X"F0",X"B1",
X"C9",X"CD",X"E0",X"18",X"C6",X"99",X"27",X"4F",X"E6",X"F0",X"32",X"A4",X"08",X"79",X"07",X"07",
X"07",X"07",X"E6",X"F0",X"32",X"A5",X"08",X"C9",X"7E",X"B7",X"C8",X"C5",X"E5",X"35",X"78",X"3D",
X"87",X"87",X"87",X"5F",X"16",X"00",X"21",X"A6",X"08",X"19",X"06",X"08",X"CD",X"B3",X"2D",X"E1",
X"E5",X"11",X"05",X"00",X"19",X"7E",X"57",X"3C",X"E6",X"03",X"77",X"ED",X"78",X"E6",X"0F",X"CB",
X"1A",X"17",X"4F",X"06",X"00",X"21",X"5B",X"19",X"09",X"7E",X"CB",X"42",X"28",X"04",X"07",X"07",
X"07",X"07",X"E6",X"0F",X"C6",X"00",X"27",X"57",X"CD",X"E0",X"18",X"FE",X"99",X"28",X"09",X"82",
X"27",X"30",X"02",X"3E",X"99",X"CD",X"F7",X"18",X"E1",X"C1",X"C9",X"11",X"11",X"22",X"22",X"33",
X"33",X"44",X"44",X"55",X"55",X"66",X"66",X"77",X"77",X"AA",X"AA",X"EE",X"EE",X"00",X"11",X"11",
X"22",X"00",X"55",X"00",X"77",X"00",X"21",X"11",X"21",X"11",X"32",X"C5",X"21",X"9C",X"08",X"CD",
X"E0",X"18",X"F5",X"01",X"62",X"03",X"CD",X"08",X"19",X"23",X"0C",X"10",X"F9",X"CD",X"E0",X"18",
X"C1",X"B8",X"C4",X"CD",X"18",X"C1",X"C9",X"CD",X"E0",X"18",X"2E",X"00",X"B7",X"28",X"08",X"FE",
X"01",X"2E",X"01",X"28",X"02",X"2E",X"03",X"DB",X"49",X"2F",X"A5",X"C9",X"CD",X"4E",X"1A",X"CD",
X"AF",X"35",X"CD",X"7B",X"29",X"90",X"0C",X"BE",X"1F",X"31",X"39",X"38",X"30",X"20",X"53",X"54",
X"45",X"52",X"4E",X"20",X"45",X"6C",X"65",X"63",X"74",X"72",X"6F",X"6E",X"69",X"63",X"73",X"2C",
X"20",X"49",X"6E",X"63",X"2E",X"00",X"CD",X"CD",X"18",X"CD",X"14",X"23",X"CD",X"ED",X"1A",X"04",
X"1B",X"2D",X"1B",X"17",X"1B",X"45",X"1B",X"21",X"02",X"43",X"3E",X"01",X"32",X"00",X"43",X"11",
X"38",X"18",X"D5",X"E5",X"7E",X"23",X"B6",X"23",X"B6",X"E1",X"E5",X"20",X"04",X"E1",X"D1",X"18",
X"35",X"21",X"00",X"43",X"06",X"02",X"CD",X"40",X"2A",X"13",X"E1",X"06",X"06",X"CD",X"4A",X"2A",
X"13",X"AF",X"4E",X"CD",X"DB",X"29",X"13",X"23",X"4E",X"CD",X"DB",X"29",X"13",X"23",X"4E",X"CD",
X"DB",X"29",X"23",X"D1",X"7A",X"C6",X"10",X"57",X"3A",X"00",X"43",X"C6",X"01",X"27",X"32",X"00",
X"43",X"FE",X"11",X"C2",X"F2",X"19",X"21",X"00",X"46",X"CD",X"45",X"1A",X"21",X"00",X"5B",X"CD",
X"45",X"1A",X"21",X"80",X"5D",X"3E",X"FF",X"06",X"40",X"77",X"23",X"10",X"FC",X"C9",X"21",X"00",
X"81",X"01",X"00",X"07",X"AF",X"77",X"23",X"0D",X"20",X"FB",X"10",X"F9",X"F3",X"ED",X"73",X"00",
X"43",X"31",X"00",X"60",X"06",X"E0",X"11",X"00",X"00",X"D5",X"D5",X"D5",X"D5",X"D5",X"D5",X"D5",
X"D5",X"D5",X"D5",X"D5",X"D5",X"D5",X"D5",X"D5",X"D5",X"10",X"EE",X"ED",X"7B",X"00",X"43",X"FB",
X"DB",X"4A",X"CB",X"7F",X"20",X"0D",X"3A",X"44",X"43",X"FE",X"02",X"20",X"06",X"3E",X"08",X"32",
X"79",X"43",X"C9",X"AF",X"32",X"79",X"43",X"C9",X"CD",X"DD",X"1A",X"CD",X"E0",X"18",X"28",X"21",
X"3D",X"28",X"0F",X"CD",X"13",X"36",X"CD",X"ED",X"1A",X"94",X"1B",X"DE",X"1B",X"BB",X"1B",X"FB",
X"1B",X"C9",X"CD",X"0A",X"36",X"CD",X"ED",X"1A",X"54",X"1B",X"DE",X"1B",X"76",X"1B",X"FB",X"1B",
X"C9",X"CD",X"01",X"36",X"CD",X"ED",X"1A",X"0F",X"1C",X"3F",X"1C",X"22",X"1C",X"56",X"1C",X"21",
X"D6",X"1A",X"22",X"98",X"08",X"C9",X"65",X"10",X"09",X"0B",X"11",X"45",X"FF",X"21",X"C0",X"5B",
X"01",X"C0",X"02",X"AF",X"77",X"23",X"0D",X"C2",X"E4",X"1A",X"10",X"F8",X"C9",X"E1",X"54",X"5D",
X"01",X"08",X"00",X"09",X"E5",X"EB",X"DB",X"60",X"E6",X"C0",X"07",X"07",X"07",X"4F",X"09",X"7E",
X"23",X"66",X"6F",X"E9",X"CD",X"7B",X"29",X"90",X"58",X"00",X"48",X"69",X"67",X"68",X"20",X"53",
X"63",X"6F",X"72",X"65",X"73",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"48",X"00",X"4D",X"65",X"69",
X"6C",X"6C",X"65",X"75",X"72",X"20",X"53",X"63",X"6F",X"72",X"65",X"00",X"C9",X"CD",X"7B",X"29",
X"90",X"40",X"00",X"48",X"6F",X"65",X"63",X"68",X"73",X"74",X"65",X"72",X"20",X"47",X"65",X"62",
X"6E",X"69",X"73",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"5C",X"00",X"52",X"65",X"63",X"6F",X"72",
X"64",X"73",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"14",X"BE",X"50",X"75",X"73",X"68",X"20",X"31",
X"20",X"50",X"6C",X"61",X"79",X"65",X"72",X"20",X"53",X"74",X"61",X"72",X"74",X"20",X"42",X"75",
X"74",X"74",X"6F",X"6E",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"24",X"BE",X"50",X"6F",X"75",X"73",
X"73",X"65",X"72",X"20",X"62",X"6F",X"75",X"74",X"6F",X"6E",X"20",X"73",X"74",X"61",X"72",X"74",
X"20",X"31",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"04",X"BE",X"50",X"75",X"73",X"68",X"20",X"31",
X"20",X"6F",X"72",X"20",X"32",X"20",X"50",X"6C",X"61",X"79",X"65",X"72",X"20",X"53",X"74",X"61",
X"72",X"74",X"20",X"42",X"75",X"74",X"74",X"6F",X"6E",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"10",
X"BE",X"50",X"6F",X"75",X"73",X"73",X"65",X"72",X"20",X"62",X"6F",X"75",X"74",X"6F",X"6E",X"20",
X"73",X"74",X"61",X"72",X"74",X"20",X"31",X"20",X"6F",X"75",X"20",X"32",X"00",X"C9",X"CD",X"7B",
X"29",X"90",X"20",X"BE",X"53",X"74",X"61",X"72",X"74",X"6B",X"6E",X"6F",X"65",X"70",X"66",X"65",
X"20",X"64",X"72",X"75",X"65",X"63",X"6B",X"65",X"6E",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"44",
X"BE",X"50",X"75",X"6C",X"73",X"61",X"72",X"20",X"53",X"74",X"61",X"72",X"74",X"00",X"C9",X"CD",
X"7B",X"29",X"90",X"58",X"BE",X"49",X"6E",X"73",X"65",X"72",X"74",X"20",X"43",X"6F",X"69",X"6E",
X"00",X"C9",X"CD",X"7B",X"29",X"90",X"30",X"BE",X"49",X"6E",X"74",X"72",X"6F",X"64",X"75",X"69",
X"72",X"65",X"20",X"6C",X"61",X"20",X"6D",X"6F",X"6E",X"6E",X"61",X"69",X"65",X"00",X"C9",X"CD",
X"7B",X"29",X"90",X"48",X"BE",X"4D",X"75",X"6E",X"7A",X"65",X"20",X"65",X"69",X"6E",X"77",X"65",
X"72",X"66",X"65",X"6E",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"48",X"BE",X"50",X"6F",X"6E",X"67",
X"61",X"20",X"6C",X"61",X"20",X"6D",X"6F",X"6E",X"65",X"64",X"61",X"00",X"C9",X"A3",X"C5",X"F5",
X"FD",X"2A",X"76",X"08",X"FD",X"66",X"07",X"FD",X"6E",X"09",X"CD",X"E7",X"1C",X"D5",X"DD",X"66",
X"07",X"DD",X"6E",X"09",X"2D",X"2D",X"2D",X"2D",X"25",X"25",X"25",X"25",X"CD",X"E7",X"1C",X"D9",
X"47",X"D9",X"C1",X"79",X"BB",X"20",X"03",X"F1",X"C1",X"C9",X"7C",X"E5",X"C6",X"10",X"67",X"CD",
X"E7",X"1C",X"D9",X"4F",X"D9",X"7D",X"C6",X"13",X"6F",X"CD",X"E7",X"1C",X"D9",X"57",X"D9",X"7D",
X"E1",X"6F",X"CD",X"E7",X"1C",X"D9",X"5F",X"F1",X"67",X"2E",X"00",X"CB",X"5C",X"28",X"06",X"78",
X"B1",X"E6",X"08",X"B5",X"6F",X"CB",X"54",X"28",X"06",X"7A",X"B3",X"E6",X"04",X"B5",X"6F",X"CB",
X"4C",X"28",X"06",X"78",X"B3",X"E6",X"02",X"B5",X"6F",X"CB",X"44",X"28",X"06",X"79",X"B2",X"E6",
X"01",X"B5",X"6F",X"2F",X"A4",X"C1",X"C9",X"7D",X"1E",X"00",X"FE",X"46",X"38",X"08",X"1E",X"05",
X"FE",X"8A",X"38",X"02",X"1E",X"0A",X"7C",X"06",X"05",X"0E",X"3A",X"16",X"30",X"B9",X"38",X"08",
X"1C",X"08",X"79",X"82",X"4F",X"08",X"10",X"F5",X"EB",X"01",X"5E",X"43",X"26",X"00",X"09",X"7E",
X"EB",X"C9",X"DD",X"21",X"22",X"1D",X"ED",X"4B",X"85",X"08",X"CD",X"22",X"1D",X"ED",X"43",X"85",
X"08",X"C9",X"0A",X"03",X"26",X"00",X"87",X"6F",X"11",X"31",X"1D",X"19",X"7E",X"23",X"66",X"6F",
X"E9",X"51",X"1D",X"5C",X"1D",X"5D",X"1D",X"68",X"1D",X"74",X"1D",X"7E",X"1D",X"8A",X"1D",X"96",
X"1D",X"A7",X"1D",X"B1",X"1D",X"BD",X"1D",X"CB",X"1D",X"E4",X"1D",X"F4",X"1D",X"09",X"1E",X"1C",
X"1E",X"0B",X"21",X"00",X"00",X"22",X"87",X"08",X"22",X"89",X"08",X"C9",X"C9",X"0A",X"03",X"6F",
X"87",X"9F",X"67",X"09",X"44",X"4D",X"DD",X"E9",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"35",X"20",
X"EC",X"03",X"DD",X"E9",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"5E",X"C3",X"8D",X"1D",X"0A",X"03",
X"6F",X"0A",X"03",X"67",X"5E",X"23",X"56",X"C3",X"9C",X"1D",X"0A",X"03",X"5F",X"0A",X"03",X"6F",
X"0A",X"03",X"67",X"73",X"DD",X"E9",X"0A",X"03",X"5F",X"0A",X"03",X"57",X"0A",X"03",X"6F",X"0A",
X"03",X"67",X"73",X"23",X"72",X"DD",X"E9",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"5E",X"C3",X"C0",
X"1D",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"5E",X"23",X"56",X"C3",X"D1",X"1D",X"0A",X"03",X"5F",
X"0A",X"03",X"6F",X"0A",X"03",X"67",X"7E",X"83",X"77",X"DD",X"E9",X"0A",X"03",X"5F",X"0A",X"03",
X"57",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"E5",X"7E",X"23",X"66",X"6F",X"19",X"EB",X"E1",X"73",
X"23",X"72",X"DD",X"E9",X"0A",X"03",X"5F",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"CB",X"2E",X"1D",
X"20",X"FB",X"DD",X"E9",X"0A",X"03",X"5F",X"0A",X"03",X"6F",X"0A",X"03",X"67",X"23",X"CB",X"2E",
X"2B",X"CB",X"1E",X"23",X"1D",X"20",X"F7",X"DD",X"E9",X"0A",X"03",X"5F",X"0A",X"03",X"6F",X"0A",
X"03",X"67",X"0A",X"77",X"23",X"03",X"1D",X"C2",X"12",X"1E",X"DD",X"E9",X"0A",X"03",X"87",X"C3",
X"0B",X"1E",X"E1",X"D9",X"21",X"01",X"00",X"E5",X"E5",X"21",X"00",X"00",X"39",X"3A",X"73",X"08",
X"B7",X"20",X"06",X"E5",X"22",X"72",X"08",X"18",X"1E",X"FD",X"E5",X"C1",X"FD",X"2A",X"72",X"08",
X"EB",X"FD",X"66",X"FF",X"FD",X"6E",X"FE",X"E5",X"F3",X"FD",X"72",X"FF",X"FD",X"73",X"FE",X"FB",
X"ED",X"53",X"72",X"08",X"C5",X"FD",X"E1",X"D9",X"E9",X"21",X"00",X"00",X"39",X"EB",X"21",X"E8",
X"FF",X"39",X"F9",X"2A",X"72",X"08",X"23",X"23",X"73",X"23",X"72",X"FD",X"E9",X"FD",X"2A",X"72",
X"08",X"FD",X"77",X"01",X"FD",X"36",X"00",X"82",X"FD",X"2A",X"72",X"08",X"21",X"00",X"00",X"39",
X"31",X"70",X"08",X"FD",X"75",X"02",X"FD",X"74",X"03",X"18",X"04",X"FD",X"2A",X"72",X"08",X"FD",
X"66",X"FF",X"FD",X"6E",X"FE",X"E5",X"FD",X"E1",X"CB",X"46",X"CA",X"8F",X"1E",X"FD",X"6E",X"02",
X"FD",X"66",X"03",X"FD",X"22",X"72",X"08",X"F9",X"C9",X"CD",X"D4",X"1F",X"DD",X"36",X"00",X"16",
X"CD",X"22",X"1E",X"C5",X"FD",X"21",X"8B",X"1E",X"CD",X"59",X"1E",X"C1",X"DD",X"2A",X"76",X"08",
X"DD",X"CB",X"00",X"7E",X"C2",X"A7",X"1F",X"3A",X"6E",X"43",X"B7",X"28",X"14",X"2A",X"6F",X"43",
X"7E",X"23",X"22",X"6F",X"43",X"CB",X"7F",X"28",X"16",X"CB",X"BF",X"C5",X"CD",X"6D",X"1E",X"18",
X"DA",X"3A",X"79",X"43",X"B7",X"28",X"04",X"DB",X"4A",X"18",X"02",X"DB",X"48",X"EE",X"1F",X"CB",
X"67",X"57",X"20",X"0D",X"E6",X"0F",X"B9",X"C4",X"91",X"1F",X"C5",X"CD",X"78",X"1E",X"C3",X"BB",
X"1E",X"FD",X"CB",X"00",X"4E",X"20",X"F3",X"AF",X"FD",X"21",X"7B",X"43",X"FD",X"B6",X"04",X"28",
X"0A",X"FD",X"21",X"83",X"43",X"AF",X"FD",X"B6",X"04",X"20",X"DF",X"7A",X"E6",X"0F",X"CA",X"FA",
X"1E",X"CD",X"BD",X"33",X"4F",X"21",X"42",X"20",X"06",X"00",X"50",X"09",X"5E",X"21",X"67",X"20",
X"19",X"19",X"19",X"DD",X"36",X"06",X"00",X"DD",X"36",X"08",X"00",X"7E",X"23",X"F3",X"DD",X"77",
X"0A",X"7E",X"23",X"DD",X"77",X"0B",X"FB",X"DD",X"36",X"0C",X"01",X"00",X"DD",X"7E",X"0C",X"FE",
X"02",X"20",X"F8",X"0E",X"FF",X"C5",X"46",X"23",X"4E",X"23",X"56",X"DD",X"7E",X"07",X"80",X"6F",
X"DD",X"7E",X"09",X"81",X"67",X"FD",X"75",X"02",X"FD",X"74",X"03",X"FD",X"75",X"06",X"FD",X"74",
X"07",X"F3",X"FD",X"72",X"00",X"FD",X"36",X"01",X"00",X"FD",X"72",X"04",X"FD",X"36",X"05",X"08",
X"FB",X"3E",X"08",X"CD",X"6D",X"1E",X"FD",X"CB",X"00",X"CE",X"FD",X"36",X"01",X"0C",X"C3",X"BB",
X"1E",X"4F",X"E6",X"0F",X"CD",X"3D",X"2B",X"21",X"53",X"20",X"19",X"7E",X"23",X"66",X"F3",X"DD",
X"77",X"0A",X"DD",X"74",X"0B",X"FB",X"C9",X"CD",X"39",X"34",X"3E",X"10",X"CD",X"94",X"1F",X"DD",
X"CB",X"00",X"EE",X"CD",X"1F",X"2C",X"3E",X"2D",X"CD",X"6D",X"1E",X"FD",X"7E",X"01",X"B7",X"28",
X"05",X"CD",X"78",X"1E",X"18",X"F5",X"2A",X"76",X"08",X"36",X"09",X"FD",X"CB",X"00",X"86",X"CD",
X"78",X"1E",X"18",X"FB",X"FD",X"E1",X"21",X"00",X"00",X"06",X"07",X"E5",X"10",X"FD",X"DD",X"21",
X"00",X"00",X"DD",X"39",X"E5",X"DD",X"22",X"76",X"08",X"3A",X"44",X"43",X"FE",X"01",X"3E",X"AA",
X"28",X"02",X"3E",X"DD",X"32",X"78",X"43",X"2A",X"47",X"43",X"DD",X"75",X"07",X"DD",X"74",X"09",
X"AF",X"CD",X"91",X"1F",X"DD",X"36",X"0D",X"02",X"DD",X"36",X"0C",X"01",X"FD",X"E9",X"E1",X"D9",
X"06",X"07",X"11",X"00",X"00",X"D5",X"10",X"FD",X"21",X"00",X"00",X"39",X"EB",X"3A",X"71",X"08",
X"B7",X"20",X"07",X"D5",X"ED",X"53",X"70",X"08",X"18",X"13",X"DD",X"2A",X"70",X"08",X"DD",X"66",
X"FF",X"DD",X"6E",X"FE",X"E5",X"F3",X"DD",X"72",X"FF",X"DD",X"73",X"FE",X"FB",X"D5",X"DD",X"E1",
X"D9",X"E9",X"00",X"0C",X"04",X"00",X"10",X"0E",X"02",X"10",X"08",X"0A",X"06",X"08",X"00",X"0C",
X"04",X"00",X"12",X"46",X"10",X"4B",X"10",X"4B",X"10",X"4B",X"10",X"4B",X"10",X"56",X"10",X"56",
X"10",X"56",X"10",X"4B",X"10",X"B3",X"12",X"46",X"10",X"00",X"00",X"00",X"00",X"61",X"10",X"07",
X"01",X"06",X"00",X"66",X"10",X"07",X"03",X"02",X"00",X"6B",X"10",X"06",X"06",X"0A",X"00",X"70",
X"10",X"06",X"07",X"08",X"00",X"75",X"10",X"00",X"06",X"09",X"00",X"7A",X"10",X"00",X"03",X"01",
X"00",X"7F",X"10",X"00",X"00",X"05",X"00",X"84",X"10",X"07",X"02",X"04",X"00",X"CD",X"4E",X"1A",
X"CD",X"40",X"25",X"3A",X"6E",X"43",X"B7",X"20",X"2E",X"CD",X"D4",X"1F",X"01",X"12",X"18",X"3A",
X"76",X"43",X"FE",X"02",X"28",X"02",X"06",X"08",X"DD",X"71",X"00",X"C5",X"DD",X"E5",X"3E",X"0A",
X"CD",X"6D",X"1E",X"DD",X"E1",X"C1",X"3E",X"1B",X"A9",X"4F",X"10",X"EC",X"21",X"00",X"00",X"22",
X"76",X"08",X"06",X"08",X"D1",X"10",X"FD",X"FB",X"3A",X"4A",X"43",X"C6",X"60",X"27",X"32",X"4A",
X"43",X"3A",X"4C",X"43",X"FE",X"01",X"28",X"04",X"3D",X"32",X"4C",X"43",X"AF",X"32",X"71",X"43",
X"FD",X"2A",X"72",X"08",X"FD",X"77",X"01",X"3A",X"4D",X"43",X"FE",X"14",X"38",X"05",X"D6",X"0A",
X"32",X"4D",X"43",X"FD",X"21",X"17",X"21",X"21",X"F0",X"FF",X"39",X"F9",X"CD",X"59",X"1E",X"21",
X"10",X"00",X"39",X"F9",X"C3",X"57",X"21",X"3E",X"16",X"32",X"00",X"43",X"4F",X"3A",X"4A",X"43",
X"47",X"CD",X"78",X"26",X"B8",X"38",X"1E",X"21",X"A0",X"23",X"06",X"00",X"09",X"46",X"23",X"4E",
X"CD",X"78",X"26",X"E6",X"1F",X"80",X"47",X"CD",X"78",X"26",X"E6",X"1F",X"81",X"4F",X"FD",X"21",
X"45",X"21",X"C3",X"B8",X"23",X"3A",X"00",X"43",X"3D",X"3D",X"32",X"00",X"43",X"4F",X"20",X"CD",
X"FD",X"21",X"A9",X"1E",X"C3",X"8E",X"2A",X"DD",X"2A",X"76",X"08",X"DD",X"CB",X"00",X"56",X"C8",
X"DD",X"7E",X"09",X"32",X"48",X"43",X"47",X"DD",X"7E",X"07",X"32",X"47",X"43",X"DD",X"CB",X"00",
X"7E",X"C2",X"8D",X"21",X"B7",X"F2",X"82",X"21",X"FE",X"FC",X"D2",X"AC",X"22",X"FE",X"F6",X"D2",
X"5D",X"22",X"78",X"FE",X"02",X"DA",X"20",X"22",X"FE",X"BE",X"D2",X"CF",X"21",X"3A",X"6D",X"43",
X"B7",X"28",X"03",X"CD",X"14",X"23",X"3A",X"6E",X"43",X"B7",X"28",X"07",X"CD",X"7B",X"19",X"CD",
X"97",X"19",X"C0",X"FD",X"2A",X"72",X"08",X"FD",X"CB",X"00",X"CE",X"FD",X"7E",X"01",X"B7",X"20",
X"18",X"FD",X"36",X"01",X"3B",X"06",X"0C",X"21",X"D0",X"08",X"3A",X"6E",X"43",X"B7",X"20",X"06",
X"CD",X"B3",X"2D",X"CD",X"97",X"2B",X"CD",X"78",X"26",X"CD",X"78",X"1E",X"C3",X"57",X"21",X"3E",
X"06",X"32",X"48",X"43",X"21",X"46",X"43",X"34",X"CD",X"EB",X"22",X"28",X"09",X"21",X"AD",X"5F",
X"11",X"DF",X"5F",X"C3",X"3D",X"22",X"21",X"2D",X"44",X"11",X"00",X"44",X"E5",X"3E",X"1B",X"21",
X"00",X"01",X"19",X"01",X"00",X"19",X"D5",X"ED",X"B0",X"D1",X"01",X"00",X"01",X"2B",X"36",X"00",
X"0D",X"C2",X"FD",X"21",X"10",X"F7",X"3D",X"20",X"E6",X"CD",X"40",X"25",X"E1",X"11",X"1A",X"00",
X"0E",X"02",X"06",X"06",X"36",X"FF",X"23",X"10",X"FB",X"19",X"0D",X"20",X"F5",X"C3",X"D7",X"20",
X"3E",X"B9",X"32",X"48",X"43",X"21",X"46",X"43",X"35",X"CD",X"EB",X"22",X"28",X"09",X"21",X"2D",
X"46",X"11",X"00",X"46",X"C3",X"EC",X"21",X"21",X"AD",X"5D",X"11",X"FF",X"5D",X"E5",X"3E",X"1A",
X"01",X"00",X"19",X"21",X"00",X"FF",X"19",X"D5",X"ED",X"B8",X"D1",X"01",X"00",X"01",X"23",X"36",
X"00",X"0D",X"C2",X"4E",X"22",X"10",X"F7",X"3D",X"20",X"E6",X"C3",X"09",X"22",X"3E",X"08",X"32",
X"47",X"43",X"21",X"45",X"43",X"34",X"CD",X"EB",X"22",X"28",X"09",X"21",X"1F",X"4F",X"11",X"E0",
X"5F",X"C3",X"C9",X"22",X"21",X"00",X"4D",X"11",X"00",X"44",X"E5",X"3E",X"20",X"01",X"FF",X"19",
X"21",X"01",X"00",X"19",X"D5",X"ED",X"B0",X"06",X"D0",X"11",X"E1",X"FF",X"36",X"00",X"2B",X"36",
X"00",X"19",X"10",X"F8",X"D1",X"3D",X"20",X"E5",X"3E",X"06",X"F5",X"CD",X"40",X"25",X"F1",X"E1",
X"11",X"20",X"00",X"06",X"40",X"77",X"19",X"10",X"FC",X"C3",X"D7",X"20",X"3E",X"E6",X"32",X"47",
X"43",X"21",X"45",X"43",X"35",X"CD",X"EB",X"22",X"28",X"09",X"21",X"00",X"4F",X"11",X"00",X"46",
X"C3",X"7A",X"22",X"21",X"1F",X"4D",X"11",X"00",X"5E",X"E5",X"3E",X"20",X"01",X"00",X"1A",X"21",
X"FF",X"FF",X"19",X"D5",X"ED",X"B8",X"11",X"1F",X"00",X"36",X"00",X"23",X"36",X"00",X"19",X"10",
X"F8",X"D1",X"3D",X"20",X"E7",X"3E",X"60",X"F5",X"C3",X"9B",X"22",X"CD",X"E4",X"2B",X"CD",X"4E",
X"36",X"FD",X"E5",X"E1",X"FD",X"74",X"FF",X"FD",X"75",X"FE",X"21",X"00",X"00",X"F3",X"22",X"70",
X"08",X"22",X"76",X"08",X"AF",X"21",X"7B",X"43",X"06",X"38",X"77",X"23",X"10",X"FC",X"3A",X"79",
X"43",X"B7",X"FB",X"C9",X"AF",X"32",X"6D",X"43",X"11",X"00",X"D5",X"21",X"3E",X"43",X"06",X"06",
X"CD",X"40",X"2A",X"3A",X"76",X"43",X"FE",X"02",X"C0",X"11",X"B0",X"D5",X"21",X"41",X"43",X"06",
X"06",X"C3",X"40",X"2A",X"3A",X"44",X"43",X"FE",X"02",X"21",X"41",X"43",X"C8",X"21",X"3E",X"43",
X"C9",X"3E",X"FF",X"32",X"6D",X"43",X"1E",X"04",X"CD",X"34",X"23",X"23",X"23",X"23",X"CB",X"38",
X"08",X"04",X"2B",X"1D",X"10",X"FC",X"08",X"30",X"08",X"CB",X"21",X"CB",X"21",X"CB",X"21",X"CB",
X"21",X"79",X"86",X"27",X"77",X"30",X"08",X"2B",X"1D",X"28",X"04",X"0E",X"01",X"18",X"F2",X"CD",
X"34",X"23",X"44",X"4D",X"21",X"4F",X"43",X"11",X"49",X"43",X"DB",X"61",X"CB",X"7F",X"28",X"11",
X"0A",X"B7",X"28",X"0D",X"CB",X"4E",X"C0",X"CB",X"CE",X"EB",X"34",X"CD",X"38",X"35",X"C3",X"9A",
X"25",X"DB",X"61",X"CB",X"77",X"C8",X"03",X"0A",X"FE",X"50",X"D8",X"CB",X"46",X"C0",X"CB",X"C6",
X"18",X"E7",X"0C",X"0C",X"40",X"0C",X"A0",X"0C",X"CE",X"0C",X"40",X"50",X"70",X"50",X"9E",X"50",
X"0C",X"96",X"40",X"96",X"A0",X"96",X"CE",X"96",X"C5",X"D1",X"21",X"71",X"43",X"34",X"7E",X"32",
X"72",X"43",X"CD",X"0E",X"20",X"DD",X"72",X"07",X"DD",X"73",X"09",X"AF",X"CD",X"36",X"24",X"DD",
X"36",X"0C",X"01",X"DD",X"36",X"00",X"06",X"CD",X"22",X"1E",X"DD",X"E5",X"CD",X"59",X"1E",X"3A",
X"4D",X"43",X"FE",X"1E",X"30",X"02",X"3E",X"1E",X"CD",X"6D",X"1E",X"DD",X"E1",X"0E",X"00",X"FD",
X"2A",X"76",X"08",X"C5",X"FD",X"7E",X"07",X"DD",X"96",X"07",X"57",X"06",X"00",X"28",X"06",X"06",
X"01",X"38",X"02",X"06",X"02",X"FD",X"7E",X"09",X"C6",X"02",X"DD",X"96",X"09",X"5F",X"0E",X"00",
X"28",X"06",X"0E",X"04",X"38",X"02",X"0E",X"08",X"78",X"81",X"F5",X"4F",X"CD",X"7F",X"28",X"F1",
X"C1",X"CD",X"36",X"24",X"DD",X"E5",X"C5",X"CD",X"78",X"1E",X"C1",X"DD",X"E1",X"DD",X"CB",X"00",
X"7E",X"CA",X"EF",X"23",X"18",X"21",X"E6",X"0F",X"C4",X"6E",X"1C",X"B9",X"C8",X"4F",X"CD",X"3D",
X"2B",X"21",X"2D",X"25",X"19",X"7E",X"23",X"66",X"F3",X"DD",X"77",X"0A",X"DD",X"74",X"0B",X"FB",
X"3A",X"4C",X"43",X"DD",X"77",X"0D",X"C9",X"E5",X"DD",X"E5",X"CD",X"8A",X"34",X"E1",X"11",X"06",
X"00",X"19",X"F3",X"72",X"23",X"7E",X"D6",X"04",X"77",X"23",X"72",X"23",X"7E",X"D6",X"06",X"77",
X"23",X"01",X"3B",X"10",X"71",X"23",X"70",X"FB",X"23",X"36",X"01",X"23",X"36",X"01",X"DD",X"E5",
X"01",X"05",X"01",X"CD",X"41",X"23",X"21",X"4E",X"43",X"34",X"34",X"21",X"71",X"43",X"35",X"20",
X"3A",X"3A",X"72",X"43",X"F5",X"01",X"01",X"01",X"CD",X"41",X"23",X"F1",X"3D",X"20",X"F5",X"CD",
X"7B",X"29",X"00",X"60",X"D5",X"42",X"4F",X"4E",X"55",X"53",X"00",X"F5",X"3A",X"72",X"43",X"C6",
X"00",X"27",X"0F",X"0F",X"0F",X"0F",X"6F",X"E6",X"F0",X"67",X"3E",X"0F",X"A5",X"6F",X"F1",X"22",
X"00",X"43",X"08",X"21",X"00",X"43",X"06",X"04",X"CD",X"4A",X"2A",X"3E",X"1E",X"CD",X"6D",X"1E",
X"DD",X"E1",X"21",X"08",X"12",X"DD",X"7E",X"04",X"BD",X"20",X"06",X"DD",X"7E",X"05",X"BC",X"28",
X"09",X"DD",X"E5",X"CD",X"78",X"1E",X"DD",X"E1",X"18",X"E8",X"CD",X"F7",X"24",X"2A",X"72",X"08",
X"CB",X"86",X"CD",X"78",X"1E",X"18",X"F6",X"DD",X"E5",X"C1",X"50",X"59",X"EB",X"2B",X"56",X"2B",
X"5E",X"78",X"BA",X"20",X"F7",X"79",X"BB",X"20",X"F3",X"F3",X"DD",X"7E",X"FE",X"77",X"23",X"DD",
X"7E",X"FF",X"77",X"23",X"22",X"70",X"08",X"FB",X"C9",X"00",X"00",X"01",X"FF",X"01",X"00",X"01",
X"01",X"00",X"01",X"FF",X"01",X"FF",X"00",X"FF",X"FF",X"00",X"FF",X"00",X"00",X"00",X"10",X"13",
X"10",X"13",X"10",X"13",X"10",X"1C",X"10",X"27",X"10",X"27",X"10",X"27",X"10",X"30",X"10",X"41",
X"2A",X"45",X"43",X"22",X"5C",X"43",X"3A",X"79",X"43",X"B7",X"20",X"05",X"21",X"6A",X"5E",X"18",
X"03",X"21",X"4A",X"44",X"11",X"14",X"00",X"AF",X"0E",X"0C",X"06",X"0C",X"77",X"23",X"10",X"FC",
X"19",X"0D",X"20",X"F6",X"01",X"0F",X"00",X"11",X"5E",X"43",X"21",X"8C",X"26",X"ED",X"B0",X"21",
X"08",X"00",X"CD",X"D4",X"25",X"21",X"08",X"CC",X"CD",X"D4",X"25",X"21",X"04",X"00",X"CD",X"CA",
X"25",X"21",X"F8",X"00",X"CD",X"CA",X"25",X"DD",X"21",X"5E",X"43",X"21",X"38",X"44",X"CD",X"EB",
X"25",X"21",X"38",X"88",X"CD",X"EB",X"25",X"CD",X"9F",X"36",X"3A",X"44",X"43",X"FE",X"02",X"21",
X"38",X"D5",X"20",X"02",X"2E",X"E8",X"06",X"00",X"CD",X"A3",X"29",X"EB",X"08",X"3A",X"49",X"43",
X"47",X"08",X"05",X"28",X"0A",X"C5",X"0E",X"80",X"CD",X"DB",X"29",X"13",X"C1",X"10",X"F6",X"3A",
X"6E",X"43",X"B7",X"C4",X"CD",X"18",X"CD",X"14",X"23",X"C9",X"CD",X"62",X"26",X"3E",X"40",X"84",
X"67",X"C3",X"62",X"26",X"CD",X"4C",X"26",X"CD",X"4C",X"26",X"3E",X"30",X"85",X"6F",X"CD",X"4C",
X"26",X"C3",X"4C",X"26",X"06",X"10",X"CD",X"A3",X"29",X"EB",X"C9",X"CD",X"78",X"26",X"E5",X"CD",
X"78",X"26",X"01",X"06",X"26",X"C5",X"E6",X"03",X"CA",X"30",X"26",X"3D",X"CA",X"40",X"26",X"3D",
X"CA",X"14",X"26",X"C3",X"20",X"26",X"E1",X"DD",X"23",X"3E",X"30",X"85",X"6F",X"FE",X"DC",X"38",
X"DA",X"DD",X"23",X"C9",X"CD",X"4C",X"26",X"DD",X"CB",X"01",X"DE",X"DD",X"CB",X"06",X"D6",X"C9",
X"7D",X"D6",X"30",X"6F",X"CD",X"4C",X"26",X"DD",X"CB",X"00",X"DE",X"DD",X"CB",X"05",X"D6",X"C9",
X"7C",X"D6",X"44",X"67",X"CD",X"62",X"26",X"DD",X"CB",X"00",X"CE",X"DD",X"CB",X"01",X"C6",X"C9",
X"CD",X"62",X"26",X"DD",X"CB",X"05",X"CE",X"DD",X"CB",X"06",X"C6",X"C9",X"06",X"0C",X"C5",X"E5",
X"CD",X"E4",X"25",X"21",X"9B",X"26",X"CD",X"17",X"28",X"E1",X"C1",X"3E",X"04",X"85",X"6F",X"10",
X"ED",X"C9",X"06",X"12",X"C5",X"E5",X"CD",X"E4",X"25",X"21",X"9B",X"26",X"CD",X"17",X"28",X"E1",
X"C1",X"3E",X"04",X"84",X"67",X"10",X"ED",X"C9",X"E5",X"2A",X"5C",X"43",X"54",X"5D",X"29",X"19",
X"29",X"19",X"11",X"53",X"31",X"19",X"22",X"5C",X"43",X"7C",X"E1",X"C9",X"05",X"04",X"04",X"04",
X"06",X"01",X"00",X"00",X"00",X"02",X"09",X"08",X"08",X"08",X"0A",X"01",X"04",X"F0",X"F0",X"F0",
X"F0",X"02",X"04",X"FF",X"F0",X"FF",X"F0",X"FF",X"F0",X"FF",X"F0",X"F3",X"ED",X"73",X"74",X"08",
X"31",X"40",X"08",X"F5",X"DB",X"4E",X"1F",X"38",X"20",X"E5",X"C5",X"21",X"9F",X"08",X"7E",X"23",
X"46",X"A8",X"4F",X"DB",X"49",X"2F",X"77",X"2B",X"70",X"A1",X"E6",X"E0",X"2B",X"87",X"30",X"03",
X"34",X"18",X"F9",X"20",X"F7",X"C1",X"E1",X"18",X"43",X"FD",X"E5",X"DD",X"E5",X"E5",X"D5",X"C5",
X"08",X"F5",X"2A",X"70",X"08",X"E5",X"2A",X"76",X"08",X"CD",X"2D",X"27",X"CD",X"19",X"37",X"E1",
X"E5",X"CD",X"2D",X"27",X"CD",X"F3",X"14",X"2A",X"76",X"08",X"CD",X"A9",X"27",X"E1",X"CD",X"A9",
X"27",X"2A",X"70",X"08",X"7C",X"B5",X"28",X"08",X"2B",X"56",X"2B",X"5E",X"ED",X"53",X"70",X"08",
X"CD",X"F5",X"27",X"F1",X"08",X"C1",X"D1",X"E1",X"DD",X"E1",X"FD",X"E1",X"3E",X"01",X"D3",X"4F",
X"3E",X"37",X"ED",X"47",X"ED",X"5E",X"F1",X"ED",X"7B",X"74",X"08",X"FB",X"C9",X"22",X"70",X"08",
X"E5",X"FD",X"E1",X"CB",X"46",X"CA",X"4D",X"27",X"CB",X"86",X"23",X"7E",X"D3",X"4B",X"23",X"5E",
X"23",X"56",X"23",X"7E",X"23",X"66",X"6F",X"CD",X"17",X"28",X"2A",X"70",X"08",X"CB",X"4E",X"C8",
X"CB",X"8E",X"11",X"07",X"00",X"19",X"5E",X"23",X"23",X"56",X"23",X"06",X"90",X"EB",X"CD",X"A3",
X"29",X"FD",X"77",X"01",X"EB",X"7E",X"23",X"66",X"6F",X"7E",X"23",X"6E",X"67",X"7E",X"CB",X"7F",
X"28",X"19",X"23",X"E6",X"7F",X"47",X"7E",X"23",X"4F",X"EB",X"3A",X"79",X"43",X"B7",X"CA",X"86",
X"27",X"ED",X"42",X"C3",X"8A",X"27",X"09",X"C3",X"8A",X"27",X"EB",X"FD",X"75",X"04",X"FD",X"74",
X"05",X"FD",X"73",X"02",X"FD",X"72",X"03",X"CD",X"17",X"28",X"2A",X"70",X"08",X"DB",X"4E",X"CB",
X"7F",X"C8",X"CB",X"FE",X"FD",X"CB",X"FA",X"C6",X"C9",X"22",X"70",X"08",X"CB",X"56",X"C8",X"E5",
X"FD",X"E1",X"11",X"0C",X"00",X"19",X"35",X"C0",X"23",X"7E",X"2B",X"77",X"11",X"FA",X"FF",X"19",
X"7E",X"23",X"86",X"77",X"23",X"7E",X"23",X"86",X"77",X"23",X"5E",X"23",X"56",X"13",X"13",X"EB",
X"7E",X"B7",X"C2",X"DA",X"27",X"23",X"7E",X"23",X"66",X"6F",X"EB",X"72",X"2B",X"73",X"3E",X"1B",
X"FD",X"B6",X"00",X"FD",X"77",X"00",X"FD",X"CB",X"00",X"6E",X"C8",X"3A",X"78",X"43",X"07",X"EE",
X"11",X"32",X"78",X"43",X"C9",X"2A",X"72",X"08",X"7C",X"B5",X"C8",X"54",X"5D",X"CB",X"4E",X"28",
X"09",X"23",X"35",X"2B",X"20",X"04",X"CB",X"8E",X"CB",X"C6",X"2B",X"7E",X"2B",X"6E",X"67",X"BA",
X"20",X"EB",X"7D",X"BB",X"20",X"E7",X"C9",X"06",X"00",X"7E",X"23",X"3D",X"CA",X"53",X"28",X"3A",
X"79",X"43",X"B7",X"7E",X"23",X"C2",X"3D",X"28",X"01",X"1E",X"00",X"EB",X"08",X"1A",X"13",X"77",
X"23",X"1A",X"13",X"77",X"23",X"70",X"08",X"09",X"3D",X"C2",X"2C",X"28",X"C9",X"01",X"E2",X"FF",
X"EB",X"08",X"1A",X"13",X"77",X"2B",X"1A",X"13",X"77",X"2B",X"36",X"00",X"08",X"09",X"3D",X"C2",
X"41",X"28",X"C9",X"3A",X"79",X"43",X"B7",X"7E",X"23",X"C2",X"6D",X"28",X"01",X"1F",X"00",X"EB",
X"08",X"1A",X"13",X"77",X"23",X"70",X"08",X"09",X"3D",X"C2",X"60",X"28",X"C9",X"01",X"E1",X"FF",
X"EB",X"08",X"1A",X"13",X"77",X"2B",X"36",X"00",X"08",X"09",X"3D",X"C2",X"71",X"28",X"C9",X"2A",
X"72",X"08",X"23",X"7E",X"B7",X"C0",X"C5",X"D5",X"11",X"08",X"00",X"21",X"8F",X"43",X"3A",X"4B",
X"43",X"B7",X"28",X"08",X"47",X"7E",X"B7",X"28",X"06",X"19",X"10",X"F9",X"D1",X"C1",X"C9",X"D1",
X"C1",X"2B",X"2B",X"2B",X"2B",X"7A",X"FE",X"FE",X"D2",X"D8",X"28",X"FE",X"06",X"38",X"29",X"7B",
X"FE",X"FC",X"30",X"1E",X"FE",X"07",X"38",X"1A",X"7A",X"CB",X"41",X"28",X"03",X"ED",X"44",X"57",
X"7B",X"CB",X"51",X"28",X"03",X"ED",X"44",X"5F",X"92",X"FE",X"F6",X"30",X"11",X"FE",X"06",X"D0",
X"18",X"0C",X"79",X"E6",X"03",X"4F",X"18",X"06",X"79",X"E6",X"0C",X"4F",X"18",X"00",X"06",X"00",
X"E5",X"CD",X"E7",X"34",X"21",X"42",X"20",X"09",X"4E",X"21",X"44",X"29",X"09",X"09",X"09",X"DD",
X"70",X"06",X"DD",X"70",X"08",X"7E",X"23",X"F3",X"DD",X"77",X"0A",X"7E",X"DD",X"77",X"0B",X"FB",
X"23",X"DD",X"36",X"0C",X"01",X"46",X"23",X"4E",X"23",X"56",X"DD",X"7E",X"07",X"80",X"47",X"DD",
X"7E",X"09",X"81",X"4F",X"E1",X"F3",X"72",X"23",X"36",X"00",X"23",X"70",X"23",X"71",X"23",X"72",
X"23",X"36",X"05",X"23",X"70",X"23",X"71",X"FB",X"DD",X"E5",X"3E",X"0A",X"CD",X"6D",X"1E",X"DD",
X"E1",X"2A",X"72",X"08",X"23",X"3A",X"4D",X"43",X"77",X"2B",X"CB",X"CE",X"E1",X"23",X"23",X"F1",
X"C1",X"0E",X"10",X"E9",X"00",X"10",X"00",X"00",X"00",X"00",X"00",X"10",X"07",X"06",X"06",X"00",
X"00",X"10",X"07",X"06",X"02",X"00",X"00",X"10",X"07",X"06",X"0A",X"00",X"00",X"10",X"07",X"06",
X"08",X"00",X"00",X"10",X"00",X"06",X"09",X"00",X"00",X"10",X"00",X"06",X"01",X"00",X"00",X"10",
X"00",X"06",X"05",X"00",X"00",X"10",X"07",X"01",X"04",X"00",X"CA",X"E1",X"46",X"23",X"5E",X"23",
X"56",X"23",X"EB",X"CD",X"A3",X"29",X"EB",X"4E",X"CB",X"B9",X"CD",X"DB",X"29",X"47",X"3A",X"79",
X"43",X"B7",X"20",X"03",X"13",X"18",X"01",X"1B",X"23",X"7E",X"B7",X"78",X"C2",X"87",X"29",X"23",
X"E9",X"06",X"90",X"3A",X"79",X"43",X"B7",X"3E",X"07",X"20",X"15",X"A5",X"B0",X"D3",X"4B",X"CB",
X"3C",X"CB",X"1D",X"CB",X"3C",X"CB",X"1D",X"CB",X"3C",X"CB",X"1D",X"01",X"00",X"64",X"09",X"C9",
X"A5",X"B0",X"CB",X"DF",X"D3",X"4B",X"CB",X"3C",X"CB",X"1D",X"CB",X"3C",X"CB",X"1D",X"CB",X"3C",
X"CB",X"1D",X"44",X"4D",X"21",X"FF",X"7F",X"B7",X"ED",X"42",X"C9",X"E5",X"21",X"00",X"00",X"06",
X"00",X"09",X"29",X"29",X"29",X"09",X"01",X"1E",X"2F",X"09",X"D5",X"F5",X"EB",X"3A",X"79",X"43",
X"B7",X"1A",X"20",X"26",X"B7",X"F2",X"FC",X"29",X"01",X"60",X"00",X"09",X"3E",X"09",X"01",X"1F",
X"00",X"08",X"F1",X"F5",X"F3",X"D3",X"4B",X"1A",X"E6",X"7F",X"13",X"77",X"23",X"36",X"00",X"FB",
X"09",X"08",X"3D",X"C2",X"01",X"2A",X"F1",X"D1",X"E1",X"C9",X"B7",X"F2",X"22",X"2A",X"01",X"A0",
X"FF",X"09",X"3E",X"09",X"01",X"E1",X"FF",X"08",X"F1",X"F5",X"F3",X"D3",X"4B",X"1A",X"E6",X"7F",
X"13",X"77",X"2B",X"36",X"00",X"FB",X"09",X"08",X"3D",X"C2",X"27",X"2A",X"F1",X"D1",X"E1",X"C9",
X"C5",X"06",X"00",X"EB",X"CD",X"A3",X"29",X"EB",X"08",X"C1",X"CB",X"81",X"78",X"3D",X"20",X"02",
X"CB",X"C1",X"7E",X"CB",X"40",X"20",X"09",X"CB",X"3F",X"CB",X"3F",X"CB",X"3F",X"CB",X"3F",X"2B",
X"23",X"E6",X"0F",X"20",X"08",X"CB",X"41",X"20",X"06",X"3E",X"20",X"18",X"0A",X"CB",X"C1",X"C6",
X"30",X"FE",X"3A",X"38",X"02",X"C6",X"07",X"E5",X"C5",X"4F",X"08",X"CD",X"DB",X"29",X"08",X"C1",
X"E1",X"3A",X"79",X"43",X"B7",X"20",X"03",X"13",X"18",X"01",X"1B",X"10",X"BF",X"C9",X"C5",X"D1",
X"CD",X"0E",X"20",X"CD",X"22",X"1E",X"DD",X"E5",X"CD",X"59",X"1E",X"DD",X"E1",X"2A",X"47",X"43",
X"7D",X"FE",X"18",X"30",X"04",X"2E",X"02",X"18",X"06",X"FE",X"E6",X"38",X"02",X"2E",X"F8",X"7C",
X"FE",X"B4",X"38",X"02",X"26",X"A0",X"DD",X"75",X"07",X"DD",X"74",X"09",X"3A",X"4C",X"43",X"47",
X"3A",X"72",X"43",X"80",X"47",X"3A",X"4B",X"43",X"80",X"32",X"4E",X"43",X"DD",X"E5",X"3E",X"28",
X"CD",X"6D",X"1E",X"DD",X"E1",X"21",X"4E",X"43",X"35",X"20",X"F1",X"CD",X"DE",X"2B",X"21",X"0B",
X"12",X"DD",X"75",X"0A",X"DD",X"74",X"0B",X"DD",X"36",X"0C",X"01",X"DD",X"36",X"0D",X"02",X"DD",
X"36",X"00",X"06",X"AF",X"CD",X"39",X"2B",X"DD",X"E5",X"C5",X"3E",X"28",X"CD",X"6D",X"1E",X"C1",
X"DD",X"E1",X"FD",X"2A",X"76",X"08",X"C5",X"FD",X"7E",X"07",X"C6",X"02",X"DD",X"96",X"07",X"57",
X"06",X"00",X"28",X"06",X"06",X"01",X"38",X"02",X"06",X"02",X"FD",X"7E",X"09",X"DD",X"96",X"09",
X"5F",X"0E",X"00",X"28",X"06",X"0E",X"04",X"38",X"02",X"0E",X"08",X"78",X"81",X"C1",X"CD",X"39",
X"2B",X"3E",X"04",X"CD",X"54",X"2B",X"C3",X"02",X"2B",X"E6",X"0F",X"B9",X"C8",X"4F",X"06",X"00",
X"50",X"21",X"42",X"20",X"09",X"5E",X"21",X"19",X"25",X"19",X"7E",X"23",X"DD",X"77",X"06",X"7E",
X"DD",X"77",X"08",X"C9",X"2A",X"72",X"08",X"36",X"82",X"23",X"77",X"DD",X"E5",X"E5",X"C5",X"CD",
X"78",X"1E",X"C1",X"E1",X"DD",X"E1",X"DD",X"CB",X"00",X"7E",X"C9",X"D5",X"CD",X"78",X"26",X"D1",
X"07",X"07",X"EE",X"09",X"E6",X"0F",X"90",X"FA",X"7C",X"2B",X"18",X"FA",X"80",X"28",X"0C",X"47",
X"7E",X"CB",X"7F",X"20",X"03",X"23",X"18",X"F8",X"23",X"10",X"F5",X"7E",X"47",X"E6",X"7F",X"12",
X"13",X"CB",X"78",X"23",X"28",X"F5",X"C9",X"2A",X"98",X"08",X"7C",X"B5",X"C0",X"21",X"9B",X"08",
X"35",X"C0",X"CD",X"78",X"26",X"07",X"07",X"E6",X"0C",X"C6",X"04",X"77",X"21",X"18",X"09",X"CD",
X"78",X"26",X"E6",X"1F",X"F6",X"60",X"77",X"23",X"EB",X"21",X"2C",X"2C",X"06",X"06",X"CD",X"6B",
X"2B",X"21",X"25",X"2C",X"06",X"04",X"3A",X"9A",X"08",X"B7",X"20",X"03",X"23",X"23",X"05",X"CD",
X"6B",X"2B",X"EB",X"36",X"47",X"23",X"36",X"FF",X"21",X"18",X"09",X"C3",X"1B",X"2C",X"21",X"4A",
X"2C",X"C3",X"1B",X"2C",X"3A",X"71",X"43",X"B7",X"20",X"29",X"21",X"18",X"09",X"CD",X"78",X"26",
X"E6",X"07",X"F6",X"70",X"77",X"23",X"EB",X"21",X"28",X"2C",X"06",X"02",X"CD",X"6B",X"2B",X"21",
X"32",X"2C",X"06",X"01",X"CD",X"6B",X"2B",X"EB",X"36",X"44",X"23",X"36",X"FF",X"21",X"18",X"09",
X"AF",X"18",X"05",X"21",X"35",X"2C",X"3E",X"FF",X"32",X"9A",X"08",X"22",X"98",X"08",X"C9",X"21",
X"40",X"2C",X"AF",X"18",X"F3",X"0A",X"98",X"8C",X"0A",X"8F",X"0A",X"92",X"86",X"83",X"82",X"95",
X"85",X"81",X"16",X"17",X"94",X"73",X"18",X"47",X"1B",X"73",X"19",X"1A",X"1B",X"1C",X"47",X"FF",
X"7B",X"04",X"0A",X"0F",X"7D",X"04",X"0A",X"12",X"47",X"FF",X"7B",X"12",X"08",X"12",X"08",X"47",
X"FF",X"CD",X"34",X"23",X"E5",X"23",X"23",X"EB",X"21",X"C4",X"08",X"0E",X"03",X"06",X"0C",X"1A",
X"E6",X"0F",X"28",X"06",X"CD",X"B3",X"2D",X"3D",X"20",X"FA",X"05",X"1A",X"E6",X"F0",X"28",X"07",
X"CD",X"B3",X"2D",X"D6",X"10",X"20",X"F9",X"05",X"1B",X"0D",X"20",X"E3",X"0E",X"0A",X"11",X"02",
X"43",X"E1",X"E5",X"D5",X"06",X"03",X"1A",X"BE",X"38",X"11",X"20",X"04",X"13",X"23",X"10",X"F6",
X"D1",X"21",X"06",X"00",X"19",X"EB",X"E1",X"0D",X"20",X"E8",X"C9",X"D1",X"D5",X"06",X"00",X"0D",
X"28",X"14",X"21",X"00",X"00",X"09",X"29",X"09",X"29",X"E5",X"19",X"2B",X"54",X"5D",X"01",X"06",
X"00",X"09",X"EB",X"C1",X"ED",X"B8",X"D1",X"E1",X"06",X"03",X"7E",X"23",X"12",X"13",X"10",X"FA",
X"EB",X"E5",X"CD",X"4E",X"1A",X"CD",X"1C",X"36",X"CD",X"ED",X"1A",X"1B",X"00",X"D8",X"2D",X"3A",
X"00",X"F4",X"2D",X"08",X"06",X"01",X"21",X"44",X"43",X"CD",X"4A",X"2A",X"CD",X"ED",X"1A",X"93",
X"07",X"71",X"2E",X"13",X"2E",X"CB",X"2E",X"CD",X"7B",X"29",X"90",X"78",X"62",X"5F",X"5F",X"5F",
X"00",X"CD",X"ED",X"1A",X"1B",X"2F",X"1B",X"2F",X"61",X"2F",X"BC",X"2F",X"06",X"00",X"21",X"78",
X"60",X"CD",X"A3",X"29",X"EB",X"E1",X"E5",X"06",X"03",X"36",X"20",X"23",X"10",X"FB",X"E1",X"3E",
X"1E",X"32",X"49",X"43",X"06",X"03",X"0E",X"41",X"C5",X"3A",X"79",X"43",X"CD",X"DB",X"29",X"D5",
X"E5",X"3E",X"0F",X"CD",X"6D",X"1E",X"E1",X"D1",X"C1",X"FD",X"CB",X"00",X"CE",X"FD",X"36",X"01",
X"3C",X"FD",X"7E",X"01",X"B7",X"20",X"0B",X"3A",X"49",X"43",X"3D",X"32",X"49",X"43",X"28",X"3A",
X"18",X"E7",X"CD",X"CE",X"2D",X"CB",X"67",X"20",X"46",X"71",X"C5",X"3A",X"79",X"43",X"B7",X"01",
X"40",X"00",X"28",X"03",X"01",X"C0",X"FF",X"D5",X"EB",X"09",X"EB",X"3A",X"79",X"43",X"F6",X"90",
X"0E",X"5F",X"CD",X"DB",X"29",X"D1",X"C1",X"23",X"3A",X"79",X"43",X"B7",X"13",X"28",X"02",X"1B",
X"1B",X"CD",X"CE",X"2D",X"CB",X"67",X"28",X"F9",X"10",X"9E",X"21",X"02",X"43",X"11",X"DC",X"08",
X"06",X"1E",X"7E",X"23",X"12",X"13",X"07",X"07",X"07",X"07",X"12",X"13",X"10",X"F4",X"C9",X"CD",
X"CE",X"2D",X"2F",X"CB",X"47",X"28",X"04",X"3E",X"FF",X"18",X"07",X"CB",X"4F",X"CA",X"31",X"2D",
X"3E",X"01",X"81",X"FE",X"40",X"20",X"02",X"3E",X"5A",X"FE",X"5B",X"20",X"02",X"3E",X"41",X"4F",
X"C3",X"18",X"2D",X"F5",X"C5",X"D5",X"E5",X"16",X"00",X"58",X"1D",X"19",X"0E",X"10",X"7E",X"E6",
X"F0",X"81",X"27",X"77",X"30",X"03",X"2B",X"10",X"F5",X"E1",X"D1",X"C1",X"F1",X"C9",X"3A",X"79",
X"43",X"B7",X"DB",X"48",X"C8",X"DB",X"4A",X"C9",X"CD",X"7B",X"29",X"90",X"20",X"08",X"47",X"72",
X"61",X"74",X"75",X"6C",X"69",X"65",X"72",X"65",X"2C",X"20",X"53",X"70",X"69",X"65",X"6C",X"65",
X"72",X"20",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"20",X"08",X"46",X"65",X"6C",X"69",X"63",X"69",
X"74",X"61",X"63",X"69",X"6F",X"6E",X"65",X"73",X"20",X"6A",X"75",X"67",X"61",X"64",X"6F",X"72",
X"20",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"08",X"20",X"56",X"6F",X"75",X"73",X"20",X"61",X"76",
X"65",X"7A",X"20",X"6A",X"6F",X"69",X"6E",X"74",X"20",X"6C",X"65",X"73",X"20",X"69",X"6D",X"6D",
X"6F",X"72",X"74",X"65",X"6C",X"73",X"00",X"CD",X"7B",X"29",X"90",X"08",X"30",X"64",X"75",X"20",
X"70",X"61",X"6E",X"74",X"68",X"65",X"6F",X"6E",X"20",X"42",X"45",X"52",X"5A",X"45",X"52",X"4B",
X"2E",X"00",X"CD",X"7B",X"29",X"90",X"08",X"50",X"49",X"6E",X"73",X"63",X"72",X"69",X"72",X"65",
X"20",X"76",X"6F",X"73",X"20",X"69",X"6E",X"69",X"74",X"69",X"61",X"6C",X"65",X"73",X"3A",X"00",
X"C9",X"CD",X"7B",X"29",X"90",X"08",X"20",X"44",X"61",X"73",X"20",X"57",X"61",X"72",X"20",X"65",
X"69",X"6E",X"20",X"52",X"75",X"68",X"6D",X"76",X"6F",X"6C",X"6C",X"65",X"72",X"20",X"53",X"69",
X"65",X"67",X"21",X"00",X"CD",X"7B",X"29",X"90",X"08",X"40",X"54",X"72",X"61",X"67",X"20",X"44",
X"65",X"69",X"6E",X"65",X"6E",X"20",X"4E",X"61",X"6D",X"65",X"6E",X"20",X"69",X"6E",X"20",X"64",
X"69",X"65",X"00",X"CD",X"7B",X"29",X"90",X"08",X"50",X"48",X"65",X"6C",X"64",X"65",X"6E",X"6C",
X"69",X"73",X"74",X"65",X"20",X"65",X"69",X"6E",X"21",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"04",
X"20",X"53",X"65",X"20",X"70",X"75",X"6E",X"74",X"61",X"6A",X"65",X"20",X"65",X"73",X"74",X"61",
X"20",X"65",X"6E",X"74",X"72",X"65",X"20",X"6C",X"6F",X"73",X"20",X"64",X"69",X"65",X"7A",X"00",
X"CD",X"7B",X"29",X"90",X"08",X"30",X"6D",X"65",X"6A",X"6F",X"72",X"65",X"73",X"2E",X"00",X"CD",
X"7B",X"29",X"90",X"18",X"50",X"45",X"6E",X"74",X"72",X"65",X"20",X"73",X"75",X"73",X"20",X"69",
X"6E",X"69",X"63",X"69",X"61",X"6C",X"65",X"73",X"3A",X"00",X"C9",X"CD",X"7B",X"29",X"90",X"08",
X"80",X"4D",X"6F",X"76",X"65",X"20",X"73",X"74",X"69",X"63",X"6B",X"20",X"74",X"6F",X"20",X"63",
X"68",X"61",X"6E",X"67",X"65",X"20",X"6C",X"65",X"74",X"74",X"65",X"72",X"00",X"CD",X"7B",X"29",
X"90",X"08",X"90",X"74",X"68",X"65",X"6E",X"20",X"70",X"72",X"65",X"73",X"73",X"20",X"46",X"49",
X"52",X"45",X"20",X"74",X"6F",X"20",X"73",X"74",X"6F",X"72",X"65",X"20",X"69",X"74",X"2E",X"00",
X"C9",X"CD",X"7B",X"29",X"90",X"04",X"80",X"50",X"6F",X"75",X"73",X"73",X"65",X"7A",X"20",X"62",
X"61",X"74",X"6F",X"6E",X"6E",X"65",X"74",X"20",X"70",X"6F",X"75",X"72",X"20",X"76",X"6F",X"73",
X"00",X"CD",X"7B",X"29",X"90",X"04",X"90",X"69",X"6E",X"69",X"74",X"69",X"61",X"6C",X"65",X"73",
X"2E",X"20",X"50",X"6F",X"75",X"73",X"73",X"65",X"7A",X"20",X"46",X"49",X"52",X"45",X"20",X"71",
X"75",X"61",X"6E",X"64",X"00",X"CD",X"7B",X"29",X"90",X"04",X"A0",X"6C",X"65",X"74",X"74",X"72",
X"65",X"20",X"63",X"6F",X"72",X"72",X"65",X"63",X"74",X"65",X"00",X"C9",X"CD",X"7B",X"29",X"90",
X"04",X"80",X"4D",X"6F",X"76",X"69",X"65",X"6E",X"64",X"6F",X"20",X"6C",X"61",X"20",X"70",X"61",
X"6C",X"61",X"6E",X"63",X"61",X"20",X"70",X"61",X"72",X"61",X"00",X"CD",X"7B",X"29",X"90",X"04",
X"90",X"63",X"61",X"6D",X"62",X"69",X"61",X"72",X"20",X"6C",X"61",X"73",X"20",X"6C",X"65",X"74",
X"72",X"61",X"73",X"2C",X"20",X"6C",X"75",X"65",X"67",X"6F",X"00",X"CD",X"7B",X"29",X"90",X"04",
X"A0",X"61",X"70",X"6C",X"61",X"73",X"74",X"65",X"20",X"65",X"6C",X"20",X"62",X"6F",X"74",X"6F",
X"6E",X"20",X"64",X"65",X"20",X"64",X"69",X"73",X"70",X"61",X"72",X"6F",X"00",X"CD",X"7B",X"29",
X"90",X"04",X"B0",X"70",X"61",X"72",X"61",X"20",X"72",X"65",X"74",X"65",X"6E",X"65",X"72",X"6C",
X"61",X"73",X"2E",X"00",X"C9",X"00",X"3E",X"41",X"5D",X"51",X"5D",X"41",X"3E",X"00",X"00",X"00",
X"00",X"00",X"00",X"00",X"00",X"00",X"00",X"10",X"10",X"10",X"10",X"10",X"10",X"10",X"00",X"10",
X"14",X"14",X"14",X"00",X"00",X"00",X"00",X"00",X"00",X"14",X"14",X"14",X"7F",X"14",X"7F",X"14",
X"14",X"14",X"14",X"7F",X"54",X"54",X"7F",X"15",X"15",X"7F",X"14",X"20",X"51",X"22",X"04",X"08",
X"10",X"22",X"45",X"02",X"00",X"18",X"24",X"28",X"10",X"29",X"46",X"46",X"39",X"08",X"08",X"08",
X"00",X"00",X"00",X"00",X"00",X"00",X"04",X"08",X"10",X"10",X"10",X"10",X"10",X"08",X"04",X"10",
X"08",X"04",X"04",X"04",X"04",X"04",X"08",X"10",X"00",X"00",X"08",X"2A",X"1C",X"1C",X"2A",X"08",
X"00",X"00",X"00",X"08",X"08",X"3E",X"08",X"08",X"00",X"00",X"80",X"00",X"00",X"00",X"18",X"18",
X"08",X"10",X"00",X"00",X"00",X"00",X"00",X"3E",X"00",X"00",X"00",X"00",X"00",X"00",X"00",X"00",
X"00",X"00",X"00",X"18",X"18",X"00",X"00",X"01",X"02",X"04",X"08",X"10",X"20",X"40",X"1C",X"22",
X"41",X"41",X"41",X"41",X"41",X"22",X"1C",X"08",X"18",X"08",X"08",X"08",X"08",X"08",X"08",X"1C",
X"3E",X"41",X"01",X"01",X"3E",X"40",X"40",X"40",X"7F",X"3E",X"41",X"01",X"01",X"1E",X"01",X"01",
X"41",X"3E",X"02",X"06",X"0A",X"12",X"22",X"7F",X"02",X"02",X"02",X"7F",X"40",X"40",X"40",X"7E",
X"01",X"01",X"41",X"3E",X"3E",X"41",X"40",X"40",X"7E",X"41",X"41",X"41",X"3E",X"7F",X"01",X"02",
X"02",X"04",X"04",X"08",X"08",X"08",X"3E",X"41",X"41",X"41",X"3E",X"41",X"41",X"41",X"3E",X"3E",
X"41",X"41",X"41",X"3F",X"01",X"01",X"41",X"3E",X"00",X"00",X"00",X"18",X"18",X"00",X"00",X"18",
X"18",X"98",X"18",X"00",X"00",X"18",X"18",X"08",X"10",X"00",X"02",X"04",X"08",X"10",X"20",X"10",
X"08",X"04",X"02",X"00",X"00",X"00",X"3E",X"00",X"3E",X"00",X"00",X"00",X"20",X"10",X"08",X"04",
X"02",X"04",X"08",X"10",X"20",X"1C",X"22",X"02",X"02",X"04",X"08",X"08",X"00",X"08",X"3E",X"41",
X"4F",X"49",X"49",X"4F",X"40",X"40",X"3F",X"3E",X"41",X"41",X"41",X"7F",X"41",X"41",X"41",X"41",
X"7E",X"41",X"41",X"41",X"7E",X"41",X"41",X"41",X"7E",X"3E",X"41",X"40",X"40",X"40",X"40",X"40",
X"41",X"3E",X"7E",X"41",X"41",X"41",X"41",X"41",X"41",X"41",X"7E",X"7F",X"40",X"40",X"40",X"7C",
X"40",X"40",X"40",X"7F",X"7F",X"40",X"40",X"40",X"7C",X"40",X"40",X"40",X"40",X"3E",X"41",X"40",
X"40",X"47",X"41",X"41",X"41",X"3F",X"41",X"41",X"41",X"41",X"7F",X"41",X"41",X"41",X"41",X"1C",
X"08",X"08",X"08",X"08",X"08",X"08",X"08",X"1C",X"01",X"01",X"01",X"01",X"01",X"01",X"01",X"41",
X"3E",X"41",X"42",X"44",X"48",X"50",X"68",X"44",X"42",X"41",X"40",X"40",X"40",X"40",X"40",X"40",
X"40",X"40",X"7F",X"41",X"63",X"55",X"49",X"41",X"41",X"41",X"41",X"41",X"41",X"61",X"51",X"49",
X"45",X"43",X"41",X"41",X"41",X"3E",X"41",X"41",X"41",X"41",X"41",X"41",X"41",X"3E",X"7E",X"41",
X"41",X"41",X"7E",X"40",X"40",X"40",X"40",X"3E",X"41",X"41",X"41",X"41",X"41",X"45",X"42",X"3D",
X"7E",X"41",X"41",X"41",X"7E",X"48",X"44",X"42",X"41",X"3E",X"41",X"40",X"40",X"3E",X"01",X"01",
X"41",X"3E",X"7F",X"08",X"08",X"08",X"08",X"08",X"08",X"08",X"08",X"41",X"41",X"41",X"41",X"41",
X"41",X"41",X"41",X"3E",X"41",X"41",X"41",X"22",X"22",X"14",X"14",X"08",X"08",X"41",X"41",X"41",
X"41",X"41",X"49",X"55",X"63",X"41",X"41",X"41",X"22",X"14",X"08",X"14",X"22",X"41",X"41",X"41",
X"41",X"22",X"14",X"08",X"08",X"08",X"08",X"08",X"7F",X"01",X"02",X"04",X"08",X"10",X"20",X"40",
X"7F",X"3C",X"20",X"20",X"20",X"20",X"20",X"20",X"20",X"3C",X"00",X"00",X"40",X"20",X"10",X"08",
X"04",X"02",X"01",X"3C",X"04",X"04",X"04",X"04",X"04",X"04",X"04",X"3C",X"08",X"14",X"22",X"41",
X"00",X"00",X"00",X"00",X"00",X"80",X"00",X"00",X"00",X"00",X"00",X"FF",X"00",X"00",X"18",X"18",
X"10",X"08",X"00",X"00",X"00",X"00",X"00",X"00",X"00",X"00",X"3A",X"46",X"42",X"42",X"46",X"3A",
X"40",X"40",X"40",X"5C",X"62",X"42",X"42",X"62",X"5C",X"00",X"00",X"00",X"3C",X"42",X"40",X"40",
X"42",X"3C",X"02",X"02",X"02",X"3A",X"46",X"42",X"42",X"46",X"3A",X"00",X"00",X"00",X"3C",X"42",
X"7E",X"40",X"40",X"3C",X"0C",X"12",X"10",X"10",X"38",X"10",X"10",X"10",X"10",X"BA",X"46",X"42",
X"42",X"46",X"3A",X"02",X"42",X"3C",X"40",X"40",X"40",X"7C",X"42",X"42",X"42",X"42",X"42",X"00",
X"08",X"00",X"08",X"08",X"08",X"08",X"08",X"08",X"84",X"04",X"04",X"04",X"04",X"04",X"04",X"44",
X"38",X"40",X"40",X"40",X"44",X"48",X"50",X"70",X"48",X"44",X"10",X"10",X"10",X"10",X"10",X"10",
X"10",X"10",X"10",X"00",X"00",X"00",X"76",X"49",X"49",X"49",X"49",X"49",X"00",X"00",X"00",X"7C",
X"42",X"42",X"42",X"42",X"42",X"00",X"00",X"00",X"3C",X"42",X"42",X"42",X"42",X"3C",X"DC",X"62",
X"42",X"42",X"62",X"5C",X"40",X"40",X"40",X"BA",X"46",X"42",X"42",X"46",X"3A",X"02",X"02",X"02",
X"00",X"00",X"00",X"5C",X"62",X"40",X"40",X"40",X"40",X"00",X"00",X"00",X"3C",X"42",X"30",X"0C",
X"42",X"3C",X"00",X"10",X"10",X"7C",X"10",X"10",X"10",X"10",X"10",X"00",X"00",X"00",X"42",X"42",
X"42",X"42",X"42",X"3C",X"00",X"00",X"00",X"44",X"44",X"44",X"44",X"28",X"10",X"00",X"00",X"00",
X"41",X"41",X"41",X"49",X"49",X"36",X"00",X"00",X"00",X"42",X"24",X"18",X"18",X"24",X"42",X"C2",
X"42",X"42",X"42",X"46",X"3A",X"02",X"42",X"3C",X"00",X"00",X"00",X"7E",X"04",X"08",X"10",X"20",
X"7E",X"0C",X"10",X"10",X"10",X"20",X"10",X"10",X"10",X"0C",X"08",X"08",X"08",X"00",X"00",X"08",
X"08",X"08",X"00",X"18",X"04",X"04",X"04",X"02",X"04",X"04",X"04",X"18",X"30",X"49",X"06",X"00",
X"00",X"00",X"00",X"00",X"00",X"55",X"2A",X"55",X"2A",X"55",X"2A",X"55",X"2A",X"55",X"08",X"00",
X"1C",X"2A",X"08",X"08",X"14",X"22",X"00",X"21",X"89",X"08",X"F5",X"3E",X"FF",X"BE",X"38",X"09",
X"D3",X"4D",X"77",X"21",X"29",X"34",X"22",X"85",X"08",X"F1",X"D3",X"4C",X"C9",X"21",X"89",X"08",
X"F5",X"3E",X"00",X"BE",X"38",X"09",X"D3",X"4D",X"77",X"21",X"D3",X"33",X"22",X"85",X"08",X"F1",
X"D3",X"4C",X"C9",X"0E",X"04",X"81",X"08",X"00",X"05",X"06",X"06",X"0E",X"03",X"78",X"08",X"92",
X"92",X"92",X"0F",X"03",X"7B",X"08",X"32",X"00",X"32",X"00",X"32",X"00",X"06",X"04",X"95",X"08",
X"06",X"32",X"93",X"08",X"01",X"0B",X"0F",X"00",X"7B",X"08",X"0B",X"11",X"00",X"7D",X"08",X"0B",
X"10",X"00",X"7F",X"08",X"03",X"93",X"08",X"EC",X"07",X"32",X"00",X"7B",X"08",X"03",X"95",X"08",
X"DF",X"06",X"FA",X"93",X"08",X"01",X"0B",X"0A",X"00",X"7B",X"08",X"0B",X"0D",X"00",X"7D",X"08",
X"0B",X"0F",X"00",X"7F",X"08",X"03",X"93",X"08",X"EC",X"0E",X"03",X"78",X"08",X"00",X"00",X"00",
X"0E",X"04",X"82",X"08",X"00",X"00",X"00",X"00",X"00",X"21",X"89",X"08",X"F5",X"3E",X"03",X"BE",
X"38",X"09",X"D3",X"4D",X"77",X"21",X"4F",X"34",X"22",X"85",X"08",X"F1",X"D3",X"4C",X"C9",X"0E",
X"04",X"81",X"08",X"00",X"06",X"07",X"07",X"0E",X"03",X"78",X"08",X"90",X"90",X"90",X"06",X"10",
X"93",X"08",X"07",X"AC",X"00",X"7B",X"08",X"0F",X"02",X"7D",X"08",X"14",X"00",X"0A",X"00",X"06",
X"19",X"95",X"08",X"01",X"0A",X"05",X"7D",X"08",X"0A",X"1E",X"7F",X"08",X"03",X"95",X"08",X"F3",
X"0A",X"FC",X"7B",X"08",X"03",X"93",X"08",X"DF",X"02",X"9F",X"21",X"89",X"08",X"F5",X"3E",X"01",
X"BE",X"38",X"09",X"D3",X"4D",X"77",X"21",X"A0",X"34",X"22",X"85",X"08",X"F1",X"D3",X"4C",X"C9",
X"0E",X"03",X"78",X"08",X"82",X"80",X"80",X"0E",X"04",X"81",X"08",X"03",X"07",X"07",X"07",X"0F",
X"03",X"7B",X"08",X"01",X"00",X"01",X"00",X"05",X"00",X"01",X"0E",X"03",X"78",X"08",X"92",X"90",
X"90",X"06",X"37",X"95",X"08",X"06",X"06",X"93",X"08",X"01",X"03",X"93",X"08",X"FB",X"0B",X"01",
X"00",X"7B",X"08",X"03",X"95",X"08",X"EE",X"0E",X"03",X"78",X"08",X"00",X"00",X"00",X"0E",X"04",
X"81",X"08",X"00",X"00",X"00",X"00",X"00",X"21",X"89",X"08",X"F5",X"3E",X"01",X"BE",X"38",X"09",
X"D3",X"4D",X"77",X"21",X"FD",X"34",X"22",X"85",X"08",X"F1",X"D3",X"4C",X"C9",X"0E",X"03",X"78",
X"08",X"92",X"92",X"92",X"0E",X"04",X"81",X"08",X"00",X"06",X"06",X"07",X"0F",X"03",X"7B",X"08",
X"14",X"00",X"2D",X"00",X"5A",X"00",X"06",X"04",X"95",X"08",X"06",X"50",X"93",X"08",X"01",X"0B",
X"08",X"00",X"7B",X"08",X"0B",X"11",X"00",X"7D",X"08",X"0B",X"2F",X"00",X"7F",X"08",X"03",X"93",
X"08",X"EC",X"03",X"95",X"08",X"E4",X"02",X"9F",X"21",X"89",X"08",X"F5",X"3E",X"02",X"BE",X"38",
X"09",X"D3",X"4D",X"77",X"21",X"4E",X"35",X"22",X"85",X"08",X"F1",X"D3",X"4C",X"C9",X"0E",X"04",
X"81",X"08",X"00",X"07",X"07",X"07",X"0E",X"03",X"78",X"08",X"92",X"92",X"92",X"0F",X"03",X"7B",
X"08",X"C8",X"00",X"3C",X"00",X"28",X"00",X"06",X"14",X"95",X"08",X"06",X"14",X"93",X"08",X"01",
X"0B",X"14",X"00",X"7B",X"08",X"0B",X"06",X"00",X"7D",X"08",X"0B",X"04",X"00",X"7F",X"08",X"03",
X"93",X"08",X"EC",X"06",X"14",X"93",X"08",X"01",X"0B",X"EC",X"FF",X"7B",X"08",X"0B",X"FA",X"FF",
X"7D",X"08",X"0B",X"FC",X"FF",X"7F",X"08",X"03",X"93",X"08",X"EC",X"03",X"95",X"08",X"CC",X"0E",
X"03",X"78",X"08",X"00",X"00",X"00",X"0E",X"04",X"81",X"08",X"00",X"00",X"00",X"00",X"00",X"CD",
X"57",X"36",X"00",X"00",X"04",X"20",X"AA",X"CD",X"57",X"36",X"80",X"00",X"01",X"20",X"FF",X"CD",
X"57",X"36",X"A0",X"00",X"29",X"20",X"11",X"CD",X"57",X"36",X"A0",X"00",X"29",X"09",X"99",X"CD",
X"57",X"36",X"A9",X"00",X"29",X"08",X"BB",X"CD",X"57",X"36",X"B0",X"00",X"29",X"10",X"55",X"CD",
X"57",X"36",X"C0",X"05",X"0A",X"20",X"77",X"CD",X"57",X"36",X"80",X"06",X"04",X"0A",X"AA",X"CD",
X"57",X"36",X"96",X"06",X"04",X"0A",X"DD",X"C9",X"CD",X"57",X"36",X"00",X"00",X"38",X"20",X"FF",
X"C9",X"CD",X"57",X"36",X"E0",X"05",X"04",X"20",X"33",X"C9",X"CD",X"57",X"36",X"E0",X"05",X"04",
X"20",X"99",X"C9",X"CD",X"57",X"36",X"E0",X"05",X"04",X"20",X"66",X"C9",X"CD",X"57",X"36",X"00",
X"00",X"08",X"20",X"BB",X"CD",X"57",X"36",X"00",X"01",X"10",X"20",X"66",X"CD",X"57",X"36",X"00",
X"03",X"04",X"20",X"FF",X"CD",X"57",X"36",X"80",X"03",X"1C",X"20",X"AA",X"C9",X"CD",X"57",X"36",
X"00",X"00",X"2F",X"20",X"CC",X"CD",X"57",X"36",X"E0",X"05",X"09",X"20",X"AA",X"C9",X"CD",X"57",
X"36",X"00",X"00",X"34",X"20",X"44",X"C9",X"E1",X"5E",X"23",X"56",X"23",X"E5",X"3A",X"79",X"43",
X"B7",X"20",X"06",X"21",X"00",X"81",X"19",X"18",X"05",X"21",X"FF",X"87",X"ED",X"52",X"EB",X"E1",
X"4E",X"23",X"08",X"7E",X"23",X"08",X"B7",X"7E",X"23",X"E5",X"EB",X"20",X"11",X"11",X"20",X"00",
X"08",X"47",X"08",X"E5",X"77",X"23",X"10",X"FC",X"E1",X"19",X"0D",X"20",X"F3",X"C9",X"11",X"E0",
X"FF",X"08",X"47",X"08",X"E5",X"77",X"2B",X"10",X"FC",X"E1",X"19",X"0D",X"20",X"F3",X"C9",X"CD",
X"57",X"36",X"80",X"06",X"04",X"20",X"77",X"CD",X"E7",X"35",X"CD",X"34",X"23",X"EB",X"01",X"05",
X"00",X"13",X"1A",X"08",X"1B",X"1A",X"B7",X"21",X"94",X"37",X"28",X"0F",X"E6",X"0F",X"67",X"08",
X"E6",X"F0",X"B4",X"07",X"07",X"07",X"07",X"21",X"BC",X"37",X"08",X"08",X"BE",X"38",X"06",X"08",
X"09",X"7E",X"B7",X"20",X"F6",X"23",X"7E",X"23",X"32",X"4B",X"43",X"7E",X"23",X"32",X"7A",X"43",
X"7E",X"23",X"32",X"4D",X"43",X"4E",X"3A",X"79",X"43",X"B7",X"DD",X"21",X"00",X"81",X"21",X"00",
X"44",X"28",X"07",X"DD",X"21",X"80",X"81",X"21",X"00",X"46",X"3E",X"34",X"08",X"06",X"20",X"7E",
X"23",X"5F",X"E6",X"44",X"57",X"7B",X"2F",X"A1",X"B2",X"DD",X"77",X"00",X"DD",X"23",X"10",X"EF",
X"11",X"60",X"00",X"19",X"08",X"3D",X"20",X"E4",X"C9",X"CB",X"5E",X"CA",X"3C",X"37",X"CB",X"9E",
X"E5",X"2A",X"40",X"09",X"11",X"42",X"09",X"3E",X"05",X"08",X"06",X"02",X"1A",X"13",X"77",X"23",
X"10",X"FA",X"01",X"1E",X"00",X"09",X"08",X"3D",X"C2",X"29",X"37",X"E1",X"CB",X"66",X"C8",X"CB",
X"DE",X"E5",X"11",X"07",X"00",X"19",X"5E",X"23",X"23",X"3A",X"79",X"43",X"B7",X"7E",X"28",X"0A",
X"ED",X"44",X"C6",X"D0",X"08",X"3E",X"F7",X"93",X"5F",X"08",X"CB",X"3F",X"CB",X"3F",X"67",X"6B",
X"CB",X"3C",X"CB",X"1D",X"CB",X"3C",X"CB",X"1D",X"CB",X"3C",X"CB",X"1D",X"01",X"00",X"81",X"09",
X"22",X"40",X"09",X"3A",X"78",X"43",X"11",X"1E",X"00",X"FD",X"21",X"42",X"09",X"0E",X"05",X"06",
X"02",X"08",X"7E",X"FD",X"77",X"00",X"FD",X"23",X"08",X"77",X"23",X"10",X"F4",X"19",X"0D",X"C2",
X"7F",X"37",X"E1",X"C9",X"03",X"00",X"00",X"50",X"33",X"15",X"01",X"00",X"50",X"99",X"30",X"02",
X"00",X"14",X"66",X"45",X"03",X"00",X"0A",X"AA",X"60",X"04",X"00",X"0A",X"55",X"75",X"05",X"00",
X"0F",X"BB",X"90",X"01",X"01",X"3C",X"FF",X"00",X"01",X"01",X"32",X"FF",X"10",X"01",X"01",X"2D",
X"FF",X"11",X"02",X"02",X"23",X"66",X"13",X"03",X"03",X"19",X"DD",X"15",X"04",X"04",X"14",X"77",
X"17",X"05",X"05",X"0F",X"33",X"19",X"05",X"05",X"0A",X"99",X"00",X"05",X"05",X"05",X"EE",X"81",
X"94",X"0C",X"02",X"AD",X"20",X"75",X"7A",X"0D",X"5F",X"40",X"93",X"D5",X"67",X"8A",X"49",X"14",
X"F5",X"74",X"CF",X"80",X"21",X"2B",X"CA",X"CC",X"2B",X"3C",X"04",X"FB",X"AB",X"26",X"F8",X"00");
begin
process(clk)
begin
if rising_edge(clk) then
data <= rom_data(to_integer(unsigned(addr)));
end if;
end process;
end architecture;

View File

@@ -0,0 +1,277 @@
---------------------------------------------------------------------------------
-- Berzerk sound effects - Dar - July 2018
---------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity berzerk_sound_fx is
port (
clock : in std_logic;
reset : in std_logic;
cs : in std_logic;
addr : in std_logic_vector(4 downto 0);
di : in std_logic_vector(7 downto 0);
sample : out std_logic_vector(15 downto 0)
);
end berzerk_sound_fx;
architecture struct of berzerk_sound_fx is
signal hdiv : std_logic_vector(1 downto 0);
signal ena_internal_clock : std_logic;
signal ptm6840_msb_buffer : std_logic_vector(7 downto 0);
signal ptm6840_max1 : std_logic_vector(15 downto 0);
signal ptm6840_max2 : std_logic_vector(15 downto 0);
signal ptm6840_max3 : std_logic_vector(15 downto 0);
signal ptm6840_cnt1 : std_logic_vector(15 downto 0);
signal ptm6840_cnt2 : std_logic_vector(15 downto 0);
signal ptm6840_cnt3 : std_logic_vector(15 downto 0);
signal ptm6840_ctrl1 : std_logic_vector(7 downto 0);
signal ptm6840_ctrl2 : std_logic_vector(7 downto 0);
signal ptm6840_ctrl3 : std_logic_vector(7 downto 0);
signal ptm6840_q1 : std_logic;
signal ptm6840_q2 : std_logic;
signal ptm6840_q3 : std_logic;
signal ctrl_noise_and_ch1 : std_logic_vector(1 downto 0);
signal ctrl_vol_ch1 : std_logic_vector(2 downto 0);
signal ctrl_vol_ch2 : std_logic_vector(2 downto 0);
signal ctrl_vol_ch3 : std_logic_vector(2 downto 0);
type vol_type is array(0 to 7) of unsigned(7 downto 0);
constant vol : vol_type := (X"01", X"02", X"04", X"08", X"10", X"20", X"40", X"80");
signal snd1 : signed(8 downto 0);
signal snd2 : signed(8 downto 0);
signal snd3 : signed(8 downto 0);
signal snd : std_logic_vector(11 downto 0);
signal ptm6840_q1_r : std_logic;
signal ena_q1_clock : std_logic;
signal noise_xor, noise_xor_r : std_logic;
signal noise_shift_reg : std_logic_vector(127 downto 0) := (others => '1');
signal noise_shift_reg_95_r : std_logic;
signal ena_external_clock : std_logic;
begin
snd <= std_logic_vector(snd1+snd2+snd3) + X"7FF";
sample <= '0' & snd & "000";
-- make enable signal to replace misc clocks
process(clock)
begin
if rising_edge(clock) then
-- ptm_6840 E input pin (internal clock)
-- board input clock divide by 4
if hdiv = "11" then
hdiv <= "00";
ena_internal_clock <= '1';
else
hdiv <= std_logic_vector(unsigned(hdiv) + 1);
ena_internal_clock <= '0';
end if;
-- ptm6840_q1 is used for alternate noise generator clock
ptm6840_q1_r <= ptm6840_q1;
if ptm6840_q1_r = '0' and ptm6840_q1 = '1' then
ena_q1_clock <= '1';
else
ena_q1_clock <= '0';
end if;
-- noise generator ouput is use for ptm6840 external clocks (C1, C2, C3)
noise_shift_reg_95_r <= noise_shift_reg(95);
if noise_shift_reg_95_r = '0' and noise_shift_reg(95) = '1' then
ena_external_clock <= '1';
else
ena_external_clock <= '0';
end if;
end if;
end process;
--control/registers interface with cpu addr/data
ctrl_regs : process(clock, reset)
begin
if reset = '1' then
ptm6840_ctrl1 <= X"01";
ptm6840_ctrl2 <= (others => '0');
ptm6840_ctrl3 <= (others => '0');
ctrl_noise_and_ch1 <= (others => '0');
ctrl_vol_ch1 <= (others => '0');
ctrl_vol_ch2 <= (others => '0');
ctrl_vol_ch3 <= (others => '0');
else
if rising_edge(clock) then
if cs = '1' and addr(4 downto 3) = "00" then
case addr(2 downto 0) is
when "000" =>
if ptm6840_ctrl2(0) = '1' then
ptm6840_ctrl1 <= di;
else
ptm6840_ctrl3 <= di;
end if;
when "001" =>
ptm6840_ctrl2 <= di;
when "011" =>
ptm6840_max1 <= ptm6840_msb_buffer & di;
when "101" =>
ptm6840_max2 <= ptm6840_msb_buffer & di;
when "111" =>
ptm6840_max3 <= ptm6840_msb_buffer & di;
when "110" =>
-- ptm6840_msb_buffer <= di;
case di(7 downto 6) is
when "00" =>
ctrl_noise_and_ch1 <= di(1 downto 0);
when "01" =>
ctrl_vol_ch1 <= di(2 downto 0);
when "10" =>
ctrl_vol_ch2 <= di(2 downto 0);
when others =>
ctrl_vol_ch3 <= di(2 downto 0);
end case;
when others =>
ptm6840_msb_buffer <= di;
end case;
end if;
end if;
end if;
end process;
-- simplified ptm6840 (only useful part for berzerk)
-- only synthesis mode
-- 16 bits count mode only (no dual 8 bits mode)
-- count on internal or external clock
-- no status
-- no IRQ
-- no gates input
counters : process(clock, reset)
begin
if reset = '1' then
ptm6840_cnt1 <= ptm6840_max1;
ptm6840_cnt2 <= ptm6840_max2;
ptm6840_cnt3 <= ptm6840_max3;
ptm6840_q1 <= '0';
ptm6840_q2 <= '0';
ptm6840_q3 <= '0';
else
if rising_edge(clock) then
if ptm6840_ctrl1(0) = '0' then
-- counter #1
if (ptm6840_ctrl1(1) = '1' and ena_internal_clock = '1') or
(ptm6840_ctrl1(1) = '0' and ena_external_clock = '1') then
if ptm6840_cnt1 = X"0000" then
ptm6840_cnt1 <= ptm6840_max1;
ptm6840_q1 <= not ptm6840_q1;
else
ptm6840_cnt1 <= ptm6840_cnt1 - '1';
end if;
end if;
-- counter #2
if (ptm6840_ctrl2(1) = '1' and ena_internal_clock = '1') or
(ptm6840_ctrl2(1) = '0' and ena_external_clock = '1') then
if ptm6840_cnt2 = X"0000" then
ptm6840_cnt2 <= ptm6840_max2;
ptm6840_q2 <= not ptm6840_q2;
else
ptm6840_cnt2 <= ptm6840_cnt2 - '1';
end if;
end if;
-- counter #3
if (ptm6840_ctrl3(1) = '1' and ena_internal_clock = '1') or
(ptm6840_ctrl3(1) = '0' and ena_external_clock = '1') then
if ptm6840_cnt3 = X"0000" then
ptm6840_cnt3 <= ptm6840_max3;
ptm6840_q3 <= not ptm6840_q3;
else
ptm6840_cnt3 <= ptm6840_cnt3 - '1';
end if;
end if;
else
ptm6840_cnt1 <= ptm6840_max1;
ptm6840_cnt2 <= ptm6840_max2;
ptm6840_cnt3 <= ptm6840_max3;
end if;
-- fx channel #1 enable and volume
-- channel #1 output is OFF when q1 drive noise generator clock
snd1 <= (others=>'0');
if ptm6840_ctrl1(7) = '1' then
if ptm6840_q1 = '1' and ctrl_noise_and_ch1(1) = '0' then
snd1 <= signed('0'&vol(to_integer(unsigned(ctrl_vol_ch1))));
else
snd1 <= -signed('0'&vol(to_integer(unsigned(ctrl_vol_ch1))));
end if;
end if;
-- fx channel #2 enable and volume
snd2 <= (others=>'0');
if ptm6840_ctrl2(7) = '1' then
if ptm6840_q2 = '1' then
snd2 <= signed('0'&vol(to_integer(unsigned(ctrl_vol_ch2))));
else
snd2 <= -signed('0'&vol(to_integer(unsigned(ctrl_vol_ch2))));
end if;
end if;
-- fx channel #2 enable and volume
snd3 <= (others=>'0');
if ptm6840_ctrl3(7) = '1' then
if ptm6840_q3 = '1' then
snd3 <= signed('0'&vol(to_integer(unsigned(ctrl_vol_ch3))));
else
snd3 <= -signed('0'&vol(to_integer(unsigned(ctrl_vol_ch3))));
end if;
end if;
end if;
end if;
end process;
-- noise generator
noise_xor <= noise_shift_reg(127) xor noise_shift_reg(95);
noise: process(clock, reset)
begin
if reset = '1' then
noise_shift_reg <= (others => '1');
else
if rising_edge(clock) then
-- noise clock is either same as internal clock or q1 output
if (ctrl_noise_and_ch1(0) = '0' and ena_internal_clock = '1') or
(ctrl_noise_and_ch1(0) = '1' and ena_q1_clock = '1') then
noise_shift_reg <= noise_shift_reg(126 downto 0) & (noise_xor_r xor noise_xor);
noise_xor_r <= noise_xor;
end if;
end if;
end if;
end process;
end architecture;

View File

@@ -0,0 +1,278 @@
library ieee;
use ieee.std_logic_1164.all,ieee.numeric_std.all;
entity berzerk_speech is
port (
clk : in std_logic;
addr : in std_logic_vector(11 downto 0);
data : out std_logic_vector(7 downto 0)
);
end entity;
architecture prom of berzerk_speech is
type rom is array(0 to 4095) of std_logic_vector(7 downto 0);
signal rom_data: rom := (
X"03",X"A0",X"04",X"40",X"04",X"E0",X"05",X"E0",X"06",X"E0",X"07",X"80",X"08",X"40",X"08",X"C0",
X"09",X"20",X"09",X"A0",X"0A",X"E0",X"0B",X"40",X"0B",X"80",X"0B",X"E0",X"0C",X"60",X"0C",X"A0",
X"0D",X"80",X"0E",X"60",X"0F",X"80",X"10",X"80",X"10",X"C0",X"11",X"E0",X"12",X"C0",X"13",X"60",
X"13",X"C0",X"14",X"C0",X"15",X"60",X"15",X"E0",X"16",X"00",X"17",X"1D",X"17",X"1D",X"1D",X"49",
X"1D",X"6E",X"20",X"9F",X"22",X"1F",X"22",X"1F",X"17",X"1E",X"24",X"41",X"28",X"D9",X"29",X"59",
X"29",X"78",X"2D",X"1F",X"2D",X"1F",X"2D",X"7F",X"2A",X"49",X"2A",X"78",X"22",X"9F",X"2D",X"1F",
X"2D",X"1F",X"2F",X"1C",X"37",X"41",X"37",X"7C",X"2D",X"1F",X"3B",X"5B",X"2F",X"9C",X"22",X"1F",
X"3C",X"51",X"3E",X"51",X"3E",X"6E",X"2D",X"9F",X"2F",X"1D",X"2F",X"1E",X"2F",X"1D",X"40",X"50",
X"40",X"6E",X"2D",X"9F",X"22",X"1F",X"42",X"49",X"42",X"78",X"2D",X"9F",X"45",X"41",X"49",X"1C",
X"49",X"9C",X"51",X"59",X"52",X"41",X"52",X"78",X"2D",X"9F",X"2D",X"1F",X"56",X"52",X"56",X"79",
X"2D",X"1F",X"58",X"51",X"58",X"78",X"2D",X"1F",X"5A",X"51",X"5A",X"78",X"2D",X"9F",X"5C",X"1E",
X"5C",X"1E",X"60",X"C1",X"64",X"41",X"68",X"D9",X"69",X"50",X"69",X"6E",X"2D",X"9F",X"5C",X"1E",
X"5C",X"1E",X"6B",X"5A",X"6C",X"C1",X"70",X"41",X"74",X"D1",X"17",X"1D",X"17",X"1D",X"76",X"41",
X"7A",X"41",X"7E",X"59",X"7E",X"7C",X"2D",X"9F",X"22",X"1F",X"22",X"1F",X"22",X"7E",X"7F",X"41",
X"83",X"58",X"49",X"1D",X"49",X"9D",X"20",X"1F",X"17",X"1E",X"84",X"51",X"84",X"78",X"22",X"1F",
X"22",X"7F",X"86",X"58",X"86",X"78",X"2D",X"9F",X"87",X"49",X"87",X"7C",X"2D",X"1F",X"2D",X"1F",
X"2D",X"7E",X"8F",X"5B",X"8A",X"5A",X"8B",X"C1",X"96",X"51",X"98",X"D0",X"9A",X"58",X"49",X"1D",
X"49",X"1D",X"49",X"7C",X"22",X"1F",X"17",X"1E",X"9B",X"49",X"9B",X"79",X"20",X"9F",X"2D",X"1F",
X"9E",X"52",X"49",X"1D",X"49",X"1D",X"49",X"79",X"A0",X"41",X"A4",X"D9",X"A5",X"41",X"49",X"1D",
X"49",X"1D",X"49",X"78",X"2D",X"9F",X"A9",X"49",X"A9",X"78",X"2D",X"9F",X"2D",X"1F",X"2D",X"1F",
X"2F",X"1C",X"AC",X"58",X"AC",X"79",X"22",X"1F",X"22",X"7F",X"AD",X"C9",X"B0",X"1D",X"B0",X"1D",
X"B6",X"49",X"B6",X"78",X"2D",X"9F",X"B9",X"41",X"B9",X"78",X"22",X"1F",X"17",X"9F",X"BD",X"C1",
X"8F",X"41",X"8F",X"7C",X"20",X"1F",X"93",X"49",X"93",X"78",X"2D",X"9F",X"FF",X"FF",X"FF",X"FF",
X"75",X"A3",X"28",X"C9",X"D7",X"59",X"D9",X"67",X"5D",X"69",X"75",X"D8",X"C7",X"97",X"5A",X"29",
X"89",X"A5",X"A5",X"A6",X"26",X"97",X"5A",X"89",X"67",X"65",X"9D",X"96",X"69",X"89",X"A5",X"A2",
X"67",X"5D",X"76",X"28",X"9E",X"22",X"98",X"CA",X"63",X"27",X"28",X"9A",X"65",X"A5",X"9A",X"66",
X"63",X"28",X"9D",X"99",X"66",X"96",X"76",X"5A",X"27",X"59",X"D9",X"66",X"78",X"89",X"D6",X"75",
X"96",X"98",X"9A",X"5D",X"8A",X"71",X"78",X"D8",X"CA",X"59",X"D9",X"69",X"98",X"99",X"D6",X"76",
X"27",X"5D",X"8A",X"65",X"99",X"9D",X"6A",X"19",X"D8",X"D5",X"E6",X"5A",X"5D",X"69",X"75",X"99",
X"67",X"62",X"77",X"1A",X"94",X"7A",X"98",X"7F",X"C0",X"FC",X"6D",X"0F",X"80",X"AE",X"61",X"AF",
X"A8",X"26",X"2F",X"85",X"46",X"F0",X"3D",X"7F",X"1A",X"A7",X"85",X"D6",X"B4",X"64",X"3F",X"6F",
X"67",X"66",X"62",X"A5",X"A5",X"26",X"2B",X"9F",X"A6",X"62",X"66",X"65",X"98",X"69",X"7A",X"9E",
X"99",X"72",X"63",X"69",X"99",X"99",X"99",X"97",X"72",X"5A",X"66",X"59",X"99",X"98",X"A6",X"65",
X"E2",X"97",X"66",X"5D",X"99",X"69",X"99",X"99",X"8A",X"66",X"59",X"99",X"9D",X"75",X"99",X"98",
X"8D",X"72",X"66",X"76",X"27",X"5D",X"97",X"5C",X"9D",X"75",X"99",X"E2",X"62",X"73",X"65",X"A2",
X"8A",X"27",X"29",X"89",X"9A",X"5D",X"66",X"6A",X"25",X"9D",X"99",X"62",X"79",X"99",X"66",X"99",
X"98",X"A6",X"26",X"5D",X"67",X"86",X"B5",X"3F",X"D4",X"F4",X"2F",X"03",X"E5",X"67",X"B1",X"2F",
X"99",X"79",X"A5",X"1F",X"42",X"A7",X"B5",X"3F",X"2A",X"8A",X"5A",X"96",X"42",X"F4",X"3C",X"EF",
X"78",X"2D",X"6F",X"43",X"82",X"E0",X"2F",X"3F",X"1E",X"2B",X"57",X"82",X"E0",X"E4",X"2F",X"6F",
X"2A",X"67",X"59",X"89",X"E1",X"95",X"6E",X"6B",X"9A",X"65",X"99",X"99",X"98",X"59",X"AA",X"9E",
X"99",X"97",X"62",X"98",X"98",X"69",X"AA",X"9E",X"99",X"98",X"99",X"99",X"96",X"29",X"AA",X"9E",
X"98",X"9E",X"59",X"8A",X"81",X"F8",X"78",X"2F",X"99",X"99",X"96",X"57",X"95",X"A9",X"E8",X"6E",
X"66",X"6A",X"65",X"6A",X"94",X"5E",X"A1",X"7F",X"D0",X"B8",X"AD",X"0F",X"D0",X"69",X"A8",X"7F",
X"D0",X"B8",X"6E",X"0B",X"C0",X"A7",X"94",X"BF",X"D1",X"D5",X"F5",X"2F",X"52",X"82",X"F4",X"3F",
X"E0",X"5A",X"B4",X"2F",X"81",X"E0",X"BC",X"2F",X"A5",X"1F",X"D4",X"2F",X"81",X"C5",X"F8",X"3F",
X"8A",X"63",X"66",X"87",X"63",X"5A",X"59",X"CA",X"5A",X"5A",X"29",X"69",X"8A",X"29",X"5E",X"29",
X"68",X"A5",X"A5",X"A6",X"66",X"66",X"66",X"66",X"62",X"66",X"63",X"67",X"26",X"69",X"96",X"89",
X"96",X"99",X"73",X"5A",X"63",X"5C",X"CC",X"CA",X"62",X"96",X"73",X"32",X"8C",X"D6",X"98",X"A6",
X"29",X"8A",X"32",X"8C",X"A5",X"A5",X"CA",X"5C",X"A3",X"35",X"A2",X"8C",X"D6",X"76",X"27",X"5C",
X"89",X"D6",X"75",X"A5",X"CC",X"A3",X"27",X"32",X"98",X"A6",X"28",X"CA",X"5A",X"35",X"9C",X"CD",
X"73",X"35",X"A6",X"29",X"8A",X"65",X"CD",X"73",X"26",X"96",X"98",X"9D",X"89",X"D8",X"A3",X"27",
X"8A",X"35",X"A5",X"A5",X"9C",X"D7",X"35",X"CD",X"69",X"67",X"62",X"97",X"32",X"97",X"5C",X"CA",
X"33",X"5D",X"72",X"8C",X"9D",X"73",X"5A",X"35",X"A5",X"CC",X"D7",X"33",X"35",X"D6",X"8D",X"69",
X"96",X"69",X"73",X"5C",X"D8",X"A5",X"CC",X"CC",X"A3",X"5A",X"33",X"32",X"8C",X"D8",X"9C",X"CD",
X"73",X"59",X"D7",X"32",X"8C",X"CC",X"A5",X"9C",X"CA",X"33",X"33",X"28",X"CA",X"5C",X"D7",X"35",
X"86",X"A9",X"57",X"98",X"56",X"7A",X"87",X"BE",X"A0",X"6E",X"8B",X"90",X"6A",X"62",X"71",X"BF",
X"A0",X"3F",X"5B",X"90",X"6A",X"95",X"99",X"AF",X"61",X"AA",X"69",X"E0",X"2F",X"43",X"96",X"BE",
X"88",X"9E",X"2B",X"80",X"A9",X"6A",X"81",X"FF",X"1F",X"55",X"AB",X"90",X"6A",X"5A",X"85",X"BF",
X"2A",X"D4",X"7A",X"26",X"55",X"7B",X"80",X"FF",X"96",X"A5",X"95",X"79",X"D5",X"3F",X"80",X"BF",
X"76",X"62",X"36",X"29",X"99",X"A9",X"66",X"3A",X"99",X"66",X"59",X"9D",X"99",X"A6",X"66",X"76",
X"99",X"A1",X"A8",X"6A",X"47",X"D1",X"F5",X"2F",X"66",X"6A",X"95",X"6A",X"52",X"72",X"F4",X"3F",
X"5A",X"95",X"E6",X"7A",X"02",X"F0",X"68",X"BF",X"98",X"D4",X"BC",X"6D",X"0B",X"C0",X"79",X"FF",
X"D4",X"95",X"FD",X"5D",X"0F",X"C0",X"A8",X"BF",X"C1",X"F0",X"BC",X"1F",X"47",X"D0",X"79",X"BF",
X"A1",X"69",X"9E",X"1A",X"86",X"D4",X"3D",X"6F",X"A1",X"9C",X"7A",X"57",X"56",X"E0",X"79",X"6F",
X"C5",X"A7",X"80",X"FD",X"0B",X"92",X"F4",X"3F",X"99",X"96",X"66",X"29",X"5A",X"A5",X"A8",X"6F",
X"98",X"A5",X"98",X"5E",X"67",X"A1",X"A9",X"7A",X"95",X"E1",X"78",X"67",X"99",X"E1",X"A9",X"9E",
X"6A",X"1A",X"87",X"56",X"D1",X"F4",X"AD",X"1F",X"76",X"1E",X"1A",X"63",X"5A",X"95",X"F5",X"2F",
X"C2",X"F4",X"2E",X"07",X"96",X"86",X"F4",X"3F",X"5B",X"81",X"FC",X"0F",X"47",X"93",X"F4",X"3F",
X"86",X"96",X"B8",X"0F",X"C0",X"B8",X"7C",X"2F",X"C0",X"FD",X"65",X"3F",X"03",X"A0",X"F8",X"3F",
X"96",X"B0",X"2F",X"02",X"E6",X"1A",X"E8",X"2F",X"D4",X"F4",X"2F",X"03",X"D5",X"D9",X"F8",X"2F",
X"97",X"94",X"BC",X"0B",X"D0",X"F4",X"BC",X"2B",X"C4",X"F8",X"3D",X"0F",X"C0",X"B8",X"A8",X"3F",
X"C4",X"BD",X"1A",X"17",X"D0",X"FC",X"3C",X"2F",X"A4",X"AD",X"1B",X"47",X"C1",X"F8",X"78",X"2F",
X"89",X"D9",X"57",X"96",X"A0",X"F8",X"6D",X"2F",X"66",X"66",X"57",X"96",X"95",X"F8",X"69",X"3F",
X"97",X"5A",X"5D",X"75",X"D8",X"D7",X"5C",X"A3",X"35",X"CA",X"33",X"28",X"CA",X"35",X"CA",X"33",
X"5A",X"28",X"9C",X"A5",X"D6",X"97",X"32",X"8D",X"72",X"8A",X"35",X"D6",X"96",X"8A",X"28",X"A5",
X"72",X"97",X"5C",X"A3",X"32",X"8C",X"A5",X"A2",X"8C",X"A3",X"28",X"A2",X"8D",X"73",X"35",X"CA",
X"5A",X"29",X"75",X"A2",X"97",X"28",X"CD",X"73",X"28",X"A3",X"33",X"5D",X"75",X"A5",X"D7",X"5C",
X"69",X"68",X"CC",X"A3",X"35",X"D6",X"96",X"8A",X"35",X"CA",X"27",X"28",X"D6",X"97",X"5C",X"CA",
X"29",X"75",X"D7",X"33",X"5C",X"CA",X"28",X"CA",X"33",X"28",X"D7",X"5C",X"A5",X"D7",X"5D",X"73",
X"8D",X"75",X"CA",X"32",X"8A",X"5D",X"75",X"D6",X"97",X"5A",X"29",X"73",X"28",X"A2",X"8A",X"5A",
X"28",X"D7",X"33",X"5A",X"5D",X"75",X"D6",X"8A",X"5D",X"68",X"A2",X"8A",X"5D",X"73",X"35",X"D7",
X"65",X"5F",X"9E",X"81",X"95",X"F4",X"6A",X"7E",X"95",X"AA",X"9A",X"50",X"F5",X"74",X"3F",X"7F",
X"9A",X"9E",X"54",X"56",X"A9",X"A5",X"2B",X"7B",X"66",X"99",X"86",X"62",X"A8",X"A5",X"6A",X"AA",
X"99",X"5E",X"57",X"56",X"A8",X"A9",X"2B",X"1F",X"75",X"F4",X"3F",X"0D",X"43",X"F4",X"79",X"7F",
X"3A",X"1F",X"12",X"F0",X"0B",X"D7",X"90",X"FF",X"67",X"E0",X"3E",X"55",X"61",X"7F",X"80",X"BF",
X"5F",X"85",X"66",X"89",X"91",X"EF",X"50",X"BF",X"99",X"99",X"98",X"67",X"95",X"6B",X"94",X"7F",
X"A1",X"79",X"5A",X"5A",X"86",X"D4",X"F9",X"2B",X"69",X"5E",X"57",X"66",X"86",X"D4",X"BC",X"2B",
X"69",X"5A",X"96",X"67",X"56",X"D4",X"BC",X"2B",X"69",X"5A",X"95",X"DA",X"56",X"D4",X"BC",X"2B",
X"69",X"99",X"76",X"56",X"98",X"9A",X"A1",X"AF",X"D0",X"F8",X"7D",X"0B",X"C0",X"7A",X"E0",X"7F",
X"C1",X"B5",X"B5",X"2F",X"40",X"B8",X"7D",X"2F",X"2B",X"12",X"F0",X"3F",X"05",X"DA",X"C4",X"BE",
X"A5",X"96",X"66",X"1E",X"85",X"E9",X"A8",X"2F",X"E4",X"78",X"6C",X"0B",X"D0",X"BC",X"79",X"2F",
X"D4",X"B8",X"3D",X"0B",X"C0",X"F8",X"A8",X"3F",X"B4",X"7D",X"0F",X"0A",X"C0",X"FC",X"79",X"2F",
X"8C",X"CD",X"75",X"A3",X"5C",X"D7",X"28",X"CD",X"73",X"5C",X"CA",X"33",X"28",X"D7",X"28",X"CC",
X"A3",X"32",X"8C",X"A3",X"33",X"28",X"CC",X"CD",X"73",X"35",X"CC",X"A3",X"33",X"28",X"C9",X"A3",
X"8C",X"CD",X"73",X"5C",X"A3",X"35",X"CC",X"CA",X"27",X"5C",X"D7",X"32",X"75",X"A3",X"28",X"CC",
X"CD",X"73",X"32",X"8A",X"26",X"8C",X"A3",X"5C",X"A3",X"5C",X"A5",X"CD",X"8D",X"73",X"28",X"D7",
X"99",X"A2",X"76",X"16",X"57",X"A5",X"A9",X"AF",X"88",X"99",X"FD",X"46",X"07",X"E0",X"7E",X"6F",
X"66",X"17",X"FC",X"18",X"47",X"E4",X"7D",X"7F",X"91",X"A7",X"BD",X"18",X"4E",X"D0",X"BC",X"6F",
X"89",X"86",X"F9",X"1E",X"07",X"D0",X"A9",X"FF",X"85",X"D7",X"BC",X"28",X"0F",X"C0",X"B9",X"7F",
X"86",X"57",X"F9",X"28",X"0F",X"D0",X"AC",X"7F",X"66",X"5A",X"AA",X"55",X"5A",X"94",X"5E",X"FE",
X"A1",X"6D",X"4A",X"D0",X"F8",X"78",X"AD",X"1F",X"75",X"7D",X"0B",X"C0",X"F8",X"79",X"7D",X"1F",
X"66",X"A4",X"7E",X"03",X"F0",X"3D",X"B8",X"2F",X"38",X"5B",X"A8",X"0B",X"D0",X"7E",X"78",X"3F",
X"35",X"7E",X"07",X"97",X"C0",X"BA",X"A0",X"BF",X"38",X"69",X"69",X"8A",X"57",X"E0",X"BC",X"2B",
X"75",X"69",X"69",X"8A",X"57",X"E0",X"BC",X"2B",X"75",X"69",X"69",X"8A",X"57",X"E0",X"BC",X"2B",
X"66",X"29",X"69",X"8A",X"57",X"E0",X"BC",X"2B",X"65",X"AA",X"12",X"B9",X"81",X"F8",X"78",X"7F",
X"6A",X"61",X"9D",X"85",X"E8",X"89",X"F5",X"2F",X"79",X"66",X"3A",X"07",X"D1",X"E2",X"B4",X"3F",
X"A0",X"F8",X"3D",X"0F",X"C0",X"B8",X"A8",X"2F",X"A4",X"AD",X"1F",X"0A",X"C0",X"F8",X"A8",X"2F",
X"76",X"29",X"5A",X"99",X"56",X"B5",X"68",X"7F",X"A1",X"AA",X"19",X"5A",X"94",X"AA",X"78",X"6F",
X"B0",X"6A",X"79",X"0B",X"C0",X"BC",X"3D",X"2F",X"2B",X"51",X"FC",X"0B",X"C0",X"F4",X"B8",X"2F",
X"2E",X"0E",X"D0",X"F4",X"7D",X"0F",X"E0",X"3F",X"C4",X"AF",X"02",X"F0",X"78",X"1F",X"D4",X"7F",
X"56",X"F5",X"27",X"95",X"A4",X"2F",X"C0",X"BF",X"1F",X"95",X"67",X"67",X"80",X"7F",X"90",X"BF",
X"3D",X"55",X"E7",X"66",X"50",X"BF",X"41",X"BF",X"77",X"26",X"66",X"66",X"21",X"EA",X"51",X"FE",
X"66",X"66",X"66",X"59",X"99",X"9D",X"DE",X"76",X"65",X"D9",X"99",X"89",X"99",X"A6",X"A7",X"76",
X"96",X"66",X"69",X"66",X"59",X"99",X"E9",X"DE",X"5E",X"66",X"75",X"5D",X"89",X"E1",X"7A",X"6F",
X"2A",X"67",X"83",X"B8",X"03",X"F0",X"B8",X"3F",X"A8",X"1B",X"D4",X"3F",X"03",X"D2",X"F4",X"3F",
X"3D",X"0F",X"C1",X"E1",X"E9",X"0B",X"F0",X"3F",X"A5",X"2F",X"47",X"55",X"F8",X"0F",X"E0",X"3F",
X"92",X"B8",X"5A",X"95",X"A4",X"2F",X"D0",X"BF",X"67",X"95",X"9E",X"62",X"55",X"7B",X"80",X"FF",
X"69",X"99",X"99",X"99",X"85",X"AD",X"55",X"EF",X"76",X"66",X"66",X"66",X"55",X"EA",X"15",X"BE",
X"96",X"75",X"99",X"79",X"5A",X"C1",X"F8",X"2F",X"2E",X"03",X"F4",X"2E",X"1B",X"53",X"F0",X"3F",
X"5B",X"81",X"A9",X"6D",X"0B",X"D2",X"B5",X"3F",X"8A",X"56",X"A5",X"5E",X"27",X"A1",X"7A",X"3B",
X"66",X"61",X"E8",X"6A",X"57",X"D1",X"B8",X"2F",X"71",X"A6",X"29",X"8E",X"57",X"D4",X"B8",X"2F",
X"B0",X"39",X"AE",X"06",X"1E",X"D5",X"76",X"7F",X"66",X"AC",X"0B",X"9A",X"02",X"F0",X"B8",X"3F",
X"66",X"62",X"67",X"67",X"56",X"E1",X"A8",X"2F",X"65",X"99",X"9A",X"66",X"67",X"A1",X"78",X"6F",
X"A5",X"1E",X"8B",X"D0",X"92",X"F8",X"35",X"BF",X"74",X"7E",X"2A",X"06",X"AA",X"60",X"2F",X"7F",
X"1E",X"5F",X"0F",X"43",X"E1",X"E0",X"2F",X"7F",X"A0",X"7C",X"7F",X"03",X"82",X"F0",X"3E",X"3F",
X"83",X"F0",X"F4",X"2F",X"02",X"B8",X"68",X"6F",X"8A",X"C0",X"FC",X"0B",X"57",X"C2",X"F4",X"3F",
X"86",X"B4",X"2F",X"43",X"E0",X"B8",X"7C",X"2B",X"56",X"A5",X"7A",X"27",X"5A",X"A1",X"7A",X"1E",
X"66",X"A9",X"55",X"99",X"A9",X"55",X"AA",X"EE",X"2A",X"9D",X"56",X"95",X"A9",X"46",X"B6",X"BE",
X"27",X"7A",X"55",X"96",X"7D",X"41",X"F7",X"BE",X"61",X"7F",X"1A",X"81",X"AD",X"45",X"A6",X"BF",
X"66",X"39",X"6B",X"A0",X"1D",X"5B",X"C0",X"FF",X"A5",X"6A",X"86",X"65",X"9D",X"1B",X"D0",X"BF",
X"66",X"A1",X"79",X"59",X"9D",X"4F",X"E0",X"7F",X"66",X"95",X"9D",X"86",X"A6",X"5A",X"B4",X"6F",
X"66",X"62",X"68",X"6A",X"5A",X"A1",X"B8",X"2F",X"62",X"6A",X"55",X"DD",X"8A",X"67",X"A5",X"3F",
X"96",X"66",X"76",X"59",X"D9",X"95",X"67",X"AE",X"C1",X"E1",X"BD",X"49",X"D7",X"94",X"3E",X"7F",
X"D4",X"78",X"7F",X"07",X"92",X"B0",X"2E",X"6F",X"D4",X"75",X"AF",X"07",X"85",X"F0",X"2E",X"6F",
X"6A",X"62",X"75",X"66",X"66",X"62",X"B4",X"3F",X"D0",X"FC",X"65",X"2F",X"02",X"E0",X"F8",X"3F",
X"96",X"76",X"27",X"56",X"A5",X"A1",X"B8",X"2F",X"86",X"E4",X"3F",X"03",X"E0",X"B5",X"7D",X"2B",
X"79",X"61",X"AD",X"0B",X"D0",X"BC",X"3C",X"2F",X"66",X"5A",X"62",X"69",X"99",X"A9",X"98",X"6F",
X"66",X"59",X"99",X"9A",X"5A",X"A5",X"A9",X"6A",X"65",X"99",X"99",X"9A",X"66",X"99",X"A9",X"6A",
X"96",X"69",X"65",X"9D",X"98",X"9E",X"95",X"EE",X"86",X"B8",X"0B",X"86",X"A5",X"3B",X"C0",X"BF",
X"7C",X"1B",X"43",X"F4",X"1F",X"C2",X"E0",X"AF",X"7A",X"07",X"99",X"95",X"6B",X"95",X"A5",X"AF",
X"79",X"66",X"15",X"F8",X"0F",X"C7",X"D0",X"BF",X"96",X"66",X"75",X"6A",X"85",X"AA",X"94",X"7F",
X"D4",X"AE",X"42",X"A5",X"B4",X"2F",X"C4",X"3F",X"86",X"E8",X"47",X"95",X"F4",X"2F",X"C0",X"BF",
X"8A",X"E0",X"69",X"66",X"94",X"7F",X"80",X"BF",X"6A",X"95",X"5A",X"62",X"95",X"6F",X"90",X"BF",
X"66",X"62",X"66",X"66",X"76",X"76",X"69",X"DD",X"66",X"59",X"99",X"99",X"DD",X"96",X"79",X"DD",
X"89",X"9D",X"85",X"9D",X"D9",X"99",X"9D",X"EA",X"99",X"99",X"D9",X"55",X"A9",X"9A",X"22",X"AE",
X"82",X"F5",X"F4",X"1E",X"0B",X"91",X"B9",X"6F",X"72",X"B8",X"2C",X"0F",X"57",X"84",X"7F",X"2F",
X"A6",X"65",X"69",X"5A",X"86",X"71",X"7E",X"3B",X"98",X"99",X"67",X"27",X"65",X"A6",X"2E",X"6A",
X"99",X"A6",X"1A",X"17",X"98",X"A5",X"6E",X"6B",X"95",X"6B",X"9E",X"03",X"D1",X"F0",X"3E",X"7F",
X"A4",X"3E",X"2F",X"02",X"87",X"B4",X"2E",X"2F",X"A4",X"3D",X"6F",X"46",X"52",X"F4",X"3A",X"3F",
X"D4",X"E0",X"BE",X"1E",X"02",X"F0",X"69",X"AF",X"66",X"98",X"7A",X"66",X"47",X"A5",X"65",X"BF",
X"65",X"9D",X"66",X"5A",X"96",X"A5",X"B8",X"6B",X"65",X"A6",X"27",X"1A",X"86",X"E1",X"B8",X"2F",
X"A4",X"7D",X"47",X"8E",X"82",X"F5",X"78",X"3F",X"95",X"A5",X"7F",X"0A",X"02",X"FC",X"0E",X"AF",
X"95",X"86",X"F9",X"55",X"56",X"F0",X"3E",X"6F",X"17",X"A3",X"F4",X"19",X"6A",X"A0",X"7D",X"7F",
X"6A",X"99",X"C5",X"89",X"96",X"90",X"FD",X"AF",X"A6",X"58",X"99",X"9C",X"85",X"99",X"EE",X"7E",
X"99",X"99",X"99",X"66",X"85",X"A8",X"E8",X"6F",X"A2",X"67",X"62",X"1E",X"81",X"F5",X"78",X"6F",
X"76",X"59",X"99",X"9A",X"1A",X"C1",X"F8",X"2F",X"C2",X"B4",X"79",X"69",X"4F",X"82",X"F4",X"2F",
X"A1",X"E8",X"2E",X"0B",X"47",X"C2",X"F4",X"2F",X"C4",X"BC",X"0F",X"83",X"D1",X"F0",X"BC",X"1F",
X"B4",X"3E",X"0A",X"D0",X"F5",X"78",X"7D",X"1F",X"A4",X"AD",X"2A",X"1E",X"4A",X"D0",X"F5",X"2F",
X"96",X"75",X"6A",X"1A",X"95",X"E2",X"A8",X"2F",X"A4",X"AD",X"0F",X"82",X"D6",X"A0",X"F8",X"2F",
X"78",X"2E",X"0E",X"8A",X"57",X"D0",X"FC",X"2B",X"75",X"6A",X"57",X"67",X"56",X"D4",X"F8",X"3B",
X"6A",X"55",X"E8",X"6A",X"55",X"6B",X"84",X"AF",X"99",X"96",X"76",X"18",X"9D",X"9E",X"85",X"FE",
X"9A",X"9D",X"56",X"11",X"FA",X"19",X"A9",X"7F",X"1F",X"87",X"D0",X"A8",X"6A",X"80",X"AE",X"AF",
X"57",X"E5",X"B0",X"2D",X"67",X"90",X"7E",X"AF",X"69",X"95",X"FC",X"0E",X"0B",X"C0",X"E6",X"BF",
X"1B",X"D1",X"E4",X"BC",X"03",X"F4",X"7C",X"3F",X"C6",X"92",X"F0",X"2F",X"02",X"E1",X"F0",X"7F",
X"99",X"A1",X"79",X"59",X"9D",X"87",X"B5",X"3F",X"98",X"9D",X"5A",X"62",X"69",X"99",X"B8",X"2F",
X"57",X"A5",X"66",X"2A",X"96",X"99",X"A7",X"66",X"59",X"D9",X"66",X"66",X"A6",X"66",X"77",X"66",
X"26",X"A5",X"69",X"5A",X"A6",X"66",X"6A",X"66",X"27",X"6A",X"62",X"19",X"E6",X"61",X"6A",X"AB",
X"79",X"0B",X"DA",X"90",X"E9",X"A4",X"2A",X"BF",X"75",X"5E",X"5B",X"D0",X"E1",X"F0",X"2A",X"BF",
X"79",X"1E",X"1F",X"C1",X"C2",X"F0",X"2E",X"7F",X"27",X"99",X"8A",X"A1",X"86",X"A5",X"66",X"7F",
X"66",X"62",X"66",X"69",X"87",X"D5",X"B8",X"2F",X"27",X"98",X"5E",X"D9",X"07",X"E1",X"E1",X"BF",
X"5E",X"84",X"7F",X"8A",X"41",X"F5",X"68",X"AF",X"E4",X"61",X"7E",X"9D",X"07",X"E0",X"7A",X"3F",
X"E1",X"18",X"BE",X"1A",X"06",X"E0",X"A8",X"AF",X"9A",X"80",X"BE",X"79",X"07",X"A1",X"69",X"AF",
X"9A",X"59",X"98",X"96",X"76",X"56",X"F4",X"3F",X"79",X"4B",X"D0",X"F4",X"AD",X"0B",X"E0",X"3F",
X"3E",X"12",X"B4",X"2E",X"0B",X"83",X"F4",X"3F",X"8A",X"82",X"F0",X"3F",X"03",X"B4",X"AC",X"2F",
X"D0",X"BC",X"2D",X"4B",X"C0",X"B8",X"A8",X"3F",X"29",X"8D",X"67",X"99",X"8A",X"A0",X"B8",X"2F",
X"2A",X"25",X"9A",X"98",X"67",X"A1",X"E9",X"2F",X"66",X"62",X"66",X"67",X"66",X"79",X"99",X"9E",
X"98",X"A6",X"26",X"97",X"35",X"CD",X"89",X"D8",X"A2",X"8D",X"73",X"28",X"D7",X"35",X"A6",X"28",
X"9C",X"D7",X"29",X"73",X"29",X"73",X"28",X"CD",X"8C",X"9D",X"68",X"A3",X"32",X"98",X"A3",X"5C",
X"73",X"59",X"9D",X"8A",X"86",X"69",X"66",X"98",X"9D",X"8A",X"35",X"D7",X"63",X"28",X"CA",X"65",
X"A3",X"62",X"75",X"A3",X"29",X"68",X"A5",X"D7",X"35",X"CA",X"32",X"8A",X"29",X"8A",X"65",X"CA",
X"69",X"8C",X"9A",X"5C",X"A3",X"63",X"5A",X"5D",X"73",X"5C",X"D7",X"32",X"8A",X"35",X"9A",X"29",
X"8A",X"35",X"C9",X"A3",X"32",X"8A",X"36",X"28",X"D7",X"32",X"8C",X"A3",X"5C",X"D7",X"35",X"D7",
X"66",X"77",X"59",X"66",X"72",X"61",X"7A",X"AE",X"C1",X"A9",X"EA",X"43",X"E0",X"B0",X"3E",X"3F",
X"C5",X"D4",X"BE",X"1C",X"46",X"F4",X"2E",X"2F",X"D0",X"F9",X"A4",X"3F",X"02",X"E4",X"B8",X"3F",
X"C4",X"F8",X"2B",X"42",X"F0",X"A5",X"F5",X"2F",X"99",X"67",X"17",X"98",X"9D",X"D5",X"F5",X"2F",
X"66",X"66",X"56",X"99",X"D9",X"A5",X"A7",X"7A",X"5D",X"97",X"56",X"99",X"E5",X"A6",X"69",X"DD",
X"67",X"99",X"85",X"96",X"A6",X"68",X"7A",X"3B",X"89",X"8A",X"A2",X"85",X"E5",X"A4",X"7A",X"7F",
X"98",X"5E",X"8E",X"C0",X"F4",X"B4",X"2E",X"7F",X"C0",X"FC",X"68",X"2F",X"03",X"E0",X"B8",X"3F",
X"75",X"A9",X"3D",X"0F",X"57",X"83",X"F4",X"3F",X"A1",X"A5",X"B4",X"7D",X"1F",X"42",X"F4",X"2F",
X"A8",X"2E",X"1A",X"0E",X"D0",X"7F",X"43",X"F0",X"9E",X"4A",X"E0",X"1F",X"81",X"F4",X"EC",X"2F",
X"3F",X"06",X"A8",X"0B",X"82",X"A5",X"F8",X"2F",X"9D",X"D8",X"2E",X"07",X"93",X"C3",X"F4",X"3F",
X"2E",X"47",X"D0",X"B8",X"2D",X"6D",X"1F",X"C2",X"2E",X"0A",X"D0",X"EC",X"2A",X"2B",X"0B",X"C3",
X"99",X"D1",X"F4",X"6D",X"2D",X"3E",X"0B",X"D0",X"3D",X"0F",X"82",X"B0",X"B4",X"F0",X"F8",X"3D",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",
X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF",X"FF");
begin
process(clk)
begin
if rising_edge(clk) then
data <= rom_data(to_integer(unsigned(addr)));
end if;
end process;
end architecture;

View File

@@ -0,0 +1,35 @@
# ================================================================================
#
# Build ID Verilog Module Script
# Jeff Wiencrot - 8/1/2011
#
# Generates a Verilog module that contains a timestamp,
# from the current build. These values are available from the build_date, build_time,
# physical_address, and host_name output ports of the build_id module in the build_id.v
# Verilog source file.
#
# ================================================================================
proc generateBuildID_Verilog {} {
# Get the timestamp (see: http://www.altera.com/support/examples/tcl/tcl-date-time-stamp.html)
set buildDate [ clock format [ clock seconds ] -format %y%m%d ]
set buildTime [ clock format [ clock seconds ] -format %H%M%S ]
# Create a Verilog file for output
set outputFileName "rtl/build_id.v"
set outputFile [open $outputFileName "w"]
# Output the Verilog source
puts $outputFile "`define BUILD_DATE \"$buildDate\""
puts $outputFile "`define BUILD_TIME \"$buildTime\""
close $outputFile
# Send confirmation message to the Messages window
post_message "Generated build identification Verilog module: [pwd]/$outputFileName"
post_message "Date: $buildDate"
post_message "Time: $buildTime"
}
# Comment out this line to prevent the process from automatically executing when the file is sourced:
generateBuildID_Verilog

View File

@@ -0,0 +1,2 @@
`define BUILD_DATE "180708"
`define BUILD_TIME "072736"

View File

@@ -0,0 +1,71 @@
-------------------------------------------------------------------------------
--
-- Delta-Sigma DAC
--
-- $Id: dac.vhd,v 1.1 2005/10/25 21:09:42 arnim Exp $
--
-- Refer to Xilinx Application Note XAPP154.
--
-- This DAC requires an external RC low-pass filter:
--
-- dac_o 0---XXXXX---+---0 analog audio
-- 3k3 |
-- === 4n7
-- |
-- GND
--
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity dac is
generic (
msbi_g : integer := 12
);
port (
clk_i : in std_logic;
res_n_i : in std_logic;
dac_i : in std_logic_vector(msbi_g downto 0);
dac_o : out std_logic
);
end dac;
library ieee;
use ieee.numeric_std.all;
architecture rtl of dac is
signal DACout_q : std_logic;
signal DeltaAdder_s,
SigmaAdder_s,
SigmaLatch_q,
DeltaB_s : unsigned(msbi_g+2 downto 0);
begin
DeltaB_s(msbi_g+2 downto msbi_g+1) <= SigmaLatch_q(msbi_g+2) &
SigmaLatch_q(msbi_g+2);
DeltaB_s(msbi_g downto 0) <= (others => '0');
DeltaAdder_s <= unsigned('0' & '0' & dac_i) + DeltaB_s;
SigmaAdder_s <= DeltaAdder_s + SigmaLatch_q;
seq: process (clk_i, res_n_i)
begin
if res_n_i = '0' then
SigmaLatch_q <= to_unsigned(2**(msbi_g+1), SigmaLatch_q'length);
DACout_q <= '0';
elsif clk_i'event and clk_i = '1' then
SigmaLatch_q <= SigmaAdder_s;
DACout_q <= SigmaLatch_q(msbi_g+2);
end if;
end process seq;
dac_o <= DACout_q;
end rtl;

View File

@@ -0,0 +1,84 @@
-- -----------------------------------------------------------------------
--
-- Syntiac's generic VHDL support files.
--
-- -----------------------------------------------------------------------
-- Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com)
-- http://www.syntiac.com/fpga64.html
--
-- Modified April 2016 by Dar (darfpga@aol.fr)
-- http://darfpga.blogspot.fr
-- Remove address register when writing
--
-- -----------------------------------------------------------------------
--
-- gen_rwram.vhd
--
-- -----------------------------------------------------------------------
--
-- generic ram.
--
-- -----------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.ALL;
-- -----------------------------------------------------------------------
entity gen_ram is
generic (
dWidth : integer := 8;
aWidth : integer := 10
);
port (
clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector((aWidth-1) downto 0);
d : in std_logic_vector((dWidth-1) downto 0);
q : out std_logic_vector((dWidth-1) downto 0)
);
end entity;
-- -----------------------------------------------------------------------
architecture rtl of gen_ram is
subtype addressRange is integer range 0 to ((2**aWidth)-1);
type ramDef is array(addressRange) of std_logic_vector((dWidth-1) downto 0);
signal ram: ramDef;
signal rAddrReg : std_logic_vector((aWidth-1) downto 0);
signal qReg : std_logic_vector((dWidth-1) downto 0);
begin
-- -----------------------------------------------------------------------
-- Signals to entity interface
-- -----------------------------------------------------------------------
-- q <= qReg;
-- -----------------------------------------------------------------------
-- Memory write
-- -----------------------------------------------------------------------
process(clk)
begin
if rising_edge(clk) then
if we = '1' then
ram(to_integer(unsigned(addr))) <= d;
end if;
end if;
end process;
-- -----------------------------------------------------------------------
-- Memory read
-- -----------------------------------------------------------------------
process(clk)
begin
if rising_edge(clk) then
-- qReg <= ram(to_integer(unsigned(rAddrReg)));
-- rAddrReg <= addr;
---- qReg <= ram(to_integer(unsigned(addr)));
q <= ram(to_integer(unsigned(addr)));
end if;
end process;
--q <= ram(to_integer(unsigned(addr)));
end architecture;

View File

@@ -0,0 +1,454 @@
//
//
// Copyright (c) 2012-2013 Ludvig Strigeus
// Copyright (c) 2017 Sorgelig
//
// This program is GPL Licensed. See COPYING for the full license.
//
//
////////////////////////////////////////////////////////////////////////////////////////////////////////
// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
`define BITS_TO_FIT(N) ( \
N <= 2 ? 0 : \
N <= 4 ? 1 : \
N <= 8 ? 2 : \
N <= 16 ? 3 : \
N <= 32 ? 4 : \
N <= 64 ? 5 : \
N <= 128 ? 6 : \
N <= 256 ? 7 : \
N <= 512 ? 8 : \
N <=1024 ? 9 : 10 )
module hq2x_in #(parameter LENGTH, parameter DWIDTH)
(
input clk,
input [AWIDTH:0] rdaddr,
input rdbuf,
output[DWIDTH:0] q,
input [AWIDTH:0] wraddr,
input wrbuf,
input [DWIDTH:0] data,
input wren
);
localparam AWIDTH = `BITS_TO_FIT(LENGTH);
wire [DWIDTH:0] out[2];
assign q = out[rdbuf];
hq2x_buf #(.NUMWORDS(LENGTH), .AWIDTH(AWIDTH), .DWIDTH(DWIDTH)) buf0(clk,data,rdaddr,wraddr,wren && (wrbuf == 0),out[0]);
hq2x_buf #(.NUMWORDS(LENGTH), .AWIDTH(AWIDTH), .DWIDTH(DWIDTH)) buf1(clk,data,rdaddr,wraddr,wren && (wrbuf == 1),out[1]);
endmodule
module hq2x_out #(parameter LENGTH, parameter DWIDTH)
(
input clk,
input [AWIDTH:0] rdaddr,
input [1:0] rdbuf,
output[DWIDTH:0] q,
input [AWIDTH:0] wraddr,
input [1:0] wrbuf,
input [DWIDTH:0] data,
input wren
);
localparam AWIDTH = `BITS_TO_FIT(LENGTH*2);
wire [DWIDTH:0] out[4];
assign q = out[rdbuf];
hq2x_buf #(.NUMWORDS(LENGTH*2), .AWIDTH(AWIDTH), .DWIDTH(DWIDTH)) buf0(clk,data,rdaddr,wraddr,wren && (wrbuf == 0),out[0]);
hq2x_buf #(.NUMWORDS(LENGTH*2), .AWIDTH(AWIDTH), .DWIDTH(DWIDTH)) buf1(clk,data,rdaddr,wraddr,wren && (wrbuf == 1),out[1]);
hq2x_buf #(.NUMWORDS(LENGTH*2), .AWIDTH(AWIDTH), .DWIDTH(DWIDTH)) buf2(clk,data,rdaddr,wraddr,wren && (wrbuf == 2),out[2]);
hq2x_buf #(.NUMWORDS(LENGTH*2), .AWIDTH(AWIDTH), .DWIDTH(DWIDTH)) buf3(clk,data,rdaddr,wraddr,wren && (wrbuf == 3),out[3]);
endmodule
module hq2x_buf #(parameter NUMWORDS, parameter AWIDTH, parameter DWIDTH)
(
input clock,
input [DWIDTH:0] data,
input [AWIDTH:0] rdaddress,
input [AWIDTH:0] wraddress,
input wren,
output [DWIDTH:0] q
);
altsyncram altsyncram_component (
.address_a (wraddress),
.clock0 (clock),
.data_a (data),
.wren_a (wren),
.address_b (rdaddress),
.q_b(q),
.aclr0 (1'b0),
.aclr1 (1'b0),
.addressstall_a (1'b0),
.addressstall_b (1'b0),
.byteena_a (1'b1),
.byteena_b (1'b1),
.clock1 (1'b1),
.clocken0 (1'b1),
.clocken1 (1'b1),
.clocken2 (1'b1),
.clocken3 (1'b1),
.data_b ({(DWIDTH+1){1'b1}}),
.eccstatus (),
.q_a (),
.rden_a (1'b1),
.rden_b (1'b1),
.wren_b (1'b0));
defparam
altsyncram_component.address_aclr_b = "NONE",
altsyncram_component.address_reg_b = "CLOCK0",
altsyncram_component.clock_enable_input_a = "BYPASS",
altsyncram_component.clock_enable_input_b = "BYPASS",
altsyncram_component.clock_enable_output_b = "BYPASS",
altsyncram_component.intended_device_family = "Cyclone III",
altsyncram_component.lpm_type = "altsyncram",
altsyncram_component.numwords_a = NUMWORDS,
altsyncram_component.numwords_b = NUMWORDS,
altsyncram_component.operation_mode = "DUAL_PORT",
altsyncram_component.outdata_aclr_b = "NONE",
altsyncram_component.outdata_reg_b = "UNREGISTERED",
altsyncram_component.power_up_uninitialized = "FALSE",
altsyncram_component.read_during_write_mode_mixed_ports = "DONT_CARE",
altsyncram_component.widthad_a = AWIDTH+1,
altsyncram_component.widthad_b = AWIDTH+1,
altsyncram_component.width_a = DWIDTH+1,
altsyncram_component.width_b = DWIDTH+1,
altsyncram_component.width_byteena_a = 1;
endmodule
////////////////////////////////////////////////////////////////////////////////////////////////////////
module DiffCheck
(
input [17:0] rgb1,
input [17:0] rgb2,
output result
);
wire [5:0] r = rgb1[5:1] - rgb2[5:1];
wire [5:0] g = rgb1[11:7] - rgb2[11:7];
wire [5:0] b = rgb1[17:13] - rgb2[17:13];
wire [6:0] t = $signed(r) + $signed(b);
wire [6:0] gx = {g[5], g};
wire [7:0] y = $signed(t) + $signed(gx);
wire [6:0] u = $signed(r) - $signed(b);
wire [7:0] v = $signed({g, 1'b0}) - $signed(t);
// if y is inside (-24..24)
wire y_inside = (y < 8'h18 || y >= 8'he8);
// if u is inside (-4, 4)
wire u_inside = (u < 7'h4 || u >= 7'h7c);
// if v is inside (-6, 6)
wire v_inside = (v < 8'h6 || v >= 8'hfA);
assign result = !(y_inside && u_inside && v_inside);
endmodule
module InnerBlend
(
input [8:0] Op,
input [5:0] A,
input [5:0] B,
input [5:0] C,
output [5:0] O
);
function [8:0] mul6x3;
input [5:0] op1;
input [2:0] op2;
begin
mul6x3 = 9'd0;
if(op2[0]) mul6x3 = mul6x3 + op1;
if(op2[1]) mul6x3 = mul6x3 + {op1, 1'b0};
if(op2[2]) mul6x3 = mul6x3 + {op1, 2'b00};
end
endfunction
wire OpOnes = Op[4];
wire [8:0] Amul = mul6x3(A, Op[7:5]);
wire [8:0] Bmul = mul6x3(B, {Op[3:2], 1'b0});
wire [8:0] Cmul = mul6x3(C, {Op[1:0], 1'b0});
wire [8:0] At = Amul;
wire [8:0] Bt = (OpOnes == 0) ? Bmul : {3'b0, B};
wire [8:0] Ct = (OpOnes == 0) ? Cmul : {3'b0, C};
wire [9:0] Res = {At, 1'b0} + Bt + Ct;
assign O = Op[8] ? A : Res[9:4];
endmodule
module Blend
(
input [5:0] rule,
input disable_hq2x,
input [17:0] E,
input [17:0] A,
input [17:0] B,
input [17:0] D,
input [17:0] F,
input [17:0] H,
output [17:0] Result
);
reg [1:0] input_ctrl;
reg [8:0] op;
localparam BLEND0 = 9'b1_xxx_x_xx_xx; // 0: A
localparam BLEND1 = 9'b0_110_0_10_00; // 1: (A * 12 + B * 4) >> 4
localparam BLEND2 = 9'b0_100_0_10_10; // 2: (A * 8 + B * 4 + C * 4) >> 4
localparam BLEND3 = 9'b0_101_0_10_01; // 3: (A * 10 + B * 4 + C * 2) >> 4
localparam BLEND4 = 9'b0_110_0_01_01; // 4: (A * 12 + B * 2 + C * 2) >> 4
localparam BLEND5 = 9'b0_010_0_11_11; // 5: (A * 4 + (B + C) * 6) >> 4
localparam BLEND6 = 9'b0_111_1_xx_xx; // 6: (A * 14 + B + C) >> 4
localparam AB = 2'b00;
localparam AD = 2'b01;
localparam DB = 2'b10;
localparam BD = 2'b11;
wire is_diff;
DiffCheck diff_checker(rule[1] ? B : H, rule[0] ? D : F, is_diff);
always @* begin
case({!is_diff, rule[5:2]})
1,17: {op, input_ctrl} = {BLEND1, AB};
2,18: {op, input_ctrl} = {BLEND1, DB};
3,19: {op, input_ctrl} = {BLEND1, BD};
4,20: {op, input_ctrl} = {BLEND2, DB};
5,21: {op, input_ctrl} = {BLEND2, AB};
6,22: {op, input_ctrl} = {BLEND2, AD};
8: {op, input_ctrl} = {BLEND0, 2'bxx};
9: {op, input_ctrl} = {BLEND0, 2'bxx};
10: {op, input_ctrl} = {BLEND0, 2'bxx};
11: {op, input_ctrl} = {BLEND1, AB};
12: {op, input_ctrl} = {BLEND1, AB};
13: {op, input_ctrl} = {BLEND1, AB};
14: {op, input_ctrl} = {BLEND1, DB};
15: {op, input_ctrl} = {BLEND1, BD};
24: {op, input_ctrl} = {BLEND2, DB};
25: {op, input_ctrl} = {BLEND5, DB};
26: {op, input_ctrl} = {BLEND6, DB};
27: {op, input_ctrl} = {BLEND2, DB};
28: {op, input_ctrl} = {BLEND4, DB};
29: {op, input_ctrl} = {BLEND5, DB};
30: {op, input_ctrl} = {BLEND3, BD};
31: {op, input_ctrl} = {BLEND3, DB};
default: {op, input_ctrl} = 11'bx;
endcase
// Setting op[8] effectively disables HQ2X because blend will always return E.
if (disable_hq2x) op[8] = 1;
end
// Generate inputs to the inner blender. Valid combinations.
// 00: E A B
// 01: E A D
// 10: E D B
// 11: E B D
wire [17:0] Input1 = E;
wire [17:0] Input2 = !input_ctrl[1] ? A :
!input_ctrl[0] ? D : B;
wire [17:0] Input3 = !input_ctrl[0] ? B : D;
InnerBlend inner_blend1(op, Input1[5:0], Input2[5:0], Input3[5:0], Result[5:0]);
InnerBlend inner_blend2(op, Input1[11:6], Input2[11:6], Input3[11:6], Result[11:6]);
InnerBlend inner_blend3(op, Input1[17:12], Input2[17:12], Input3[17:12], Result[17:12]);
endmodule
////////////////////////////////////////////////////////////////////////////////////////////////////
module Hq2x #(parameter LENGTH, parameter HALF_DEPTH)
(
input clk,
input ce_x4,
input [DWIDTH:0] inputpixel,
input mono,
input disable_hq2x,
input reset_frame,
input reset_line,
input [1:0] read_y,
input [AWIDTH+1:0] read_x,
output [DWIDTH:0] outpixel
);
localparam AWIDTH = `BITS_TO_FIT(LENGTH);
localparam DWIDTH = HALF_DEPTH ? 8 : 17;
wire [5:0] hqTable[256] = '{
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 47, 35, 23, 15, 55, 39,
19, 19, 26, 58, 19, 19, 26, 58, 23, 15, 35, 35, 23, 15, 7, 35,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 55, 39, 23, 15, 51, 43,
19, 19, 26, 58, 19, 19, 26, 58, 23, 15, 51, 35, 23, 15, 7, 43,
19, 19, 26, 11, 19, 19, 26, 11, 23, 61, 35, 35, 23, 61, 51, 35,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 51, 35, 23, 15, 51, 35,
19, 19, 26, 11, 19, 19, 26, 11, 23, 61, 7, 35, 23, 61, 7, 43,
19, 19, 26, 11, 19, 19, 26, 58, 23, 15, 51, 35, 23, 61, 7, 43,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 47, 35, 23, 15, 55, 39,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 51, 35, 23, 15, 51, 35,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 55, 39, 23, 15, 51, 43,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 51, 39, 23, 15, 7, 43,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 51, 35, 23, 15, 51, 39,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 51, 35, 23, 15, 7, 35,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 51, 35, 23, 15, 7, 43,
19, 19, 26, 11, 19, 19, 26, 11, 23, 15, 7, 35, 23, 15, 7, 43
};
reg [17:0] Prev0, Prev1, Prev2, Curr0, Curr1, Next0, Next1, Next2;
reg [17:0] A, B, D, F, G, H;
reg [7:0] pattern, nextpatt;
reg [1:0] i;
reg [7:0] y;
wire curbuf = y[0];
reg prevbuf = 0;
wire iobuf = !curbuf;
wire diff0, diff1;
DiffCheck diffcheck0(Curr1, (i == 0) ? Prev0 : (i == 1) ? Curr0 : (i == 2) ? Prev2 : Next1, diff0);
DiffCheck diffcheck1(Curr1, (i == 0) ? Prev1 : (i == 1) ? Next0 : (i == 2) ? Curr2 : Next2, diff1);
wire [7:0] new_pattern = {diff1, diff0, pattern[7:2]};
wire [17:0] X = (i == 0) ? A : (i == 1) ? Prev1 : (i == 2) ? Next1 : G;
wire [17:0] blend_result;
Blend blender(hqTable[nextpatt], disable_hq2x, Curr0, X, B, D, F, H, blend_result);
reg Curr2_addr1;
reg [AWIDTH:0] Curr2_addr2;
wire [17:0] Curr2 = HALF_DEPTH ? h2rgb(Curr2tmp) : Curr2tmp;
wire [DWIDTH:0] Curr2tmp;
reg [AWIDTH:0] wrin_addr2;
reg [DWIDTH:0] wrpix;
reg wrin_en;
function [17:0] h2rgb;
input [8:0] v;
begin
h2rgb = mono ? {v[5:3],v[2:0], v[5:3],v[2:0], v[5:3],v[2:0]} : {v[8:6],v[8:6],v[5:3],v[5:3],v[2:0],v[2:0]};
end
endfunction
function [8:0] rgb2h;
input [17:0] v;
begin
rgb2h = mono ? {3'b000, v[17:15], v[14:12]} : {v[17:15], v[11:9], v[5:3]};
end
endfunction
hq2x_in #(.LENGTH(LENGTH), .DWIDTH(DWIDTH)) hq2x_in
(
.clk(clk),
.rdaddr(Curr2_addr2),
.rdbuf(Curr2_addr1),
.q(Curr2tmp),
.wraddr(wrin_addr2),
.wrbuf(iobuf),
.data(wrpix),
.wren(wrin_en)
);
reg [1:0] wrout_addr1;
reg [AWIDTH+1:0] wrout_addr2;
reg wrout_en;
reg [DWIDTH:0] wrdata;
hq2x_out #(.LENGTH(LENGTH), .DWIDTH(DWIDTH)) hq2x_out
(
.clk(clk),
.rdaddr(read_x),
.rdbuf(read_y),
.q(outpixel),
.wraddr(wrout_addr2),
.wrbuf(wrout_addr1),
.data(wrdata),
.wren(wrout_en)
);
always @(posedge clk) begin
reg [AWIDTH:0] offs;
reg old_reset_line;
reg old_reset_frame;
wrout_en <= 0;
wrin_en <= 0;
if(ce_x4) begin
pattern <= new_pattern;
if(~&offs) begin
if (i == 0) begin
Curr2_addr1 <= prevbuf;
Curr2_addr2 <= offs;
end
if (i == 1) begin
Prev2 <= Curr2;
Curr2_addr1 <= curbuf;
Curr2_addr2 <= offs;
end
if (i == 2) begin
Next2 <= HALF_DEPTH ? h2rgb(inputpixel) : inputpixel;
wrpix <= inputpixel;
wrin_addr2 <= offs;
wrin_en <= 1;
end
if (i == 3) begin
offs <= offs + 1'd1;
end
if(HALF_DEPTH) wrdata <= rgb2h(blend_result);
else wrdata <= blend_result;
wrout_addr1 <= {curbuf, i[1]};
wrout_addr2 <= {offs, i[1]^i[0]};
wrout_en <= 1;
end
if(i==3) begin
nextpatt <= {new_pattern[7:6], new_pattern[3], new_pattern[5], new_pattern[2], new_pattern[4], new_pattern[1:0]};
{A, G} <= {Prev0, Next0};
{B, F, H, D} <= {Prev1, Curr2, Next1, Curr0};
{Prev0, Prev1} <= {Prev1, Prev2};
{Curr0, Curr1} <= {Curr1, Curr2};
{Next0, Next1} <= {Next1, Next2};
end else begin
nextpatt <= {nextpatt[5], nextpatt[3], nextpatt[0], nextpatt[6], nextpatt[1], nextpatt[7], nextpatt[4], nextpatt[2]};
{B, F, H, D} <= {F, H, D, B};
end
i <= i + 1'b1;
if(old_reset_line && ~reset_line) begin
old_reset_frame <= reset_frame;
offs <= 0;
i <= 0;
y <= y + 1'd1;
prevbuf <= curbuf;
if(old_reset_frame & ~reset_frame) begin
y <= 0;
prevbuf <= 0;
end
end
old_reset_line <= reset_line;
end
end
endmodule // Hq2x

View File

@@ -0,0 +1,82 @@
module keyboard
(
input clk,
input reset,
input ps2_kbd_clk,
input ps2_kbd_data,
output reg[7:0] joystick
);
reg [11:0] shift_reg = 12'hFFF;
wire[11:0] kdata = {ps2_kbd_data,shift_reg[11:1]};
wire [7:0] kcode = kdata[9:2];
reg release_btn = 0;
reg [7:0] code;
reg input_strobe = 0;
always @(negedge clk) begin
reg old_reset = 0;
old_reset <= reset;
if(~old_reset & reset)begin
joystick <= 0;
end
if(input_strobe) begin
case(code)
'h16: joystick[1] <= ~release_btn; // 1
'h1E: joystick[2] <= ~release_btn; // 2
'h75: joystick[4] <= ~release_btn; // arrow up
'h72: joystick[5] <= ~release_btn; // arrow down
'h6B: joystick[6] <= ~release_btn; // arrow left
'h74: joystick[7] <= ~release_btn; // arrow right
'h29: joystick[0] <= ~release_btn; // Space
'h11: joystick[1] <= ~release_btn; // Left Alt
'h0d: joystick[2] <= ~release_btn; // Tab
'h76: joystick[3] <= ~release_btn; // Escape
endcase
end
end
always @(posedge clk) begin
reg [3:0] prev_clk = 0;
reg old_reset = 0;
reg action = 0;
old_reset <= reset;
input_strobe <= 0;
if(~old_reset & reset)begin
prev_clk <= 0;
shift_reg <= 12'hFFF;
end else begin
prev_clk <= {ps2_kbd_clk,prev_clk[3:1]};
if(prev_clk == 1) begin
if (kdata[11] & ^kdata[10:2] & ~kdata[1] & kdata[0]) begin
shift_reg <= 12'hFFF;
if (kcode == 8'he0) ;
// Extended key code follows
else if (kcode == 8'hf0)
// Release code follows
action <= 1;
else begin
// Cancel extended/release flags for next time
action <= 0;
release_btn <= action;
code <= kcode;
input_strobe <= 1;
end
end else begin
shift_reg <= kdata;
end
end
end
end
endmodule

View File

@@ -0,0 +1,104 @@
---------------------------------------------------------------------------------
-- Line doubler - Dar - Feb 2014
---------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all,ieee.numeric_std.all;
entity line_doubler is
port(
clock : in std_logic;
video_i : in std_logic_vector(3 downto 0);
hsync_i : in std_logic;
vsync_i : in std_logic;
video_o : out std_logic_vector(3 downto 0);
hsync_o : out std_logic;
vsync_o : out std_logic
);
end line_doubler;
architecture struct of line_doubler is
signal hsync_i_reg : std_logic;
signal vsync_i_reg : std_logic;
signal hcnt_i : integer range 0 to 1023;
signal vcnt_i : integer range 0 to 511;
signal hcnt_o : integer range 0 to 511;
signal flip_flop : std_logic;
signal blank : std_logic;
type ram_1024x8 is array(0 to 1023) of std_logic_vector(3 downto 0);
signal ram1 : ram_1024x8;
signal ram2 : ram_1024x8;
signal video : std_logic_vector(3 downto 0);
begin
process(clock)
begin
if rising_edge(clock) then
hsync_i_reg <= hsync_i;
vsync_i_reg <= vsync_i;
if (vsync_i = '0' and vsync_i_reg = '1') then
vcnt_i <= 0;
else
if (hsync_i = '0' and hsync_i_reg = '1') then
vcnt_i <= vcnt_i + 1;
end if;
end if;
if (hsync_i = '0' and hsync_i_reg = '1') then
flip_flop <= not flip_flop;
hcnt_i <= 0;
else
hcnt_i <= hcnt_i + 1;
end if;
if (hsync_i = '0' and hsync_i_reg = '1') or hcnt_o = 319 then
hcnt_o <= 0;
else
hcnt_o <= hcnt_o + 1;
end if;
-- if hcnt_o = 0 then hsync_o <= '0';
-- elsif hcnt_o = 4 then hsync_o <= '1';
-- end if;
if hcnt_o = 319-2-4 then hsync_o <= '0';
elsif hcnt_o = 319-2 then hsync_o <= '1';
end if;
if hcnt_o = 54 then blank <= '0';
elsif hcnt_o = 308 then blank <= '1';
end if;
if vcnt_i = 0 then vsync_o <= '0';
elsif vcnt_i = 4 then vsync_o <= '1';
end if;
end if;
end process;
process(clock)
begin
if rising_edge(clock) then
if flip_flop = '0' then
ram1(hcnt_i/2) <= video_i;
video <= ram2(hcnt_o);
else
ram2(hcnt_i/2) <= video_i;
video <= ram1(hcnt_o);
end if;
end if;
if blank = '0' then
video_o <= video;
else
video_o <= (others => '0');
end if;
end process;
end architecture;

View File

@@ -0,0 +1,532 @@
//
// mist_io.v
//
// mist_io for the MiST board
// http://code.google.com/p/mist-board/
//
// Copyright (c) 2014 Till Harbaum <till@harbaum.org>
//
// This source file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This source file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////
//
// Use buffer to access SD card. It's time-critical part.
// Made module synchroneous with 2 clock domains: clk_sys and SPI_SCK
// (Sorgelig)
//
// for synchronous projects default value for PS2DIV is fine for any frequency of system clock.
// clk_ps2 = clk_sys/(PS2DIV*2)
//
module mist_io #(parameter STRLEN=0, parameter PS2DIV=100)
(
// parameter STRLEN and the actual length of conf_str have to match
input [(8*STRLEN)-1:0] conf_str,
// Global clock. It should be around 100MHz (higher is better).
input clk_sys,
// Global SPI clock from ARM. 24MHz
input SPI_SCK,
input CONF_DATA0,
input SPI_SS2,
output SPI_DO,
input SPI_DI,
output reg [7:0] joystick_0,
output reg [7:0] joystick_1,
output reg [15:0] joystick_analog_0,
output reg [15:0] joystick_analog_1,
output [1:0] buttons,
output [1:0] switches,
output scandoubler_disable,
output ypbpr,
output reg [31:0] status,
// SD config
input sd_conf,
input sd_sdhc,
output img_mounted, // signaling that new image has been mounted
output reg [31:0] img_size, // size of image in bytes
// SD block level access
input [31:0] sd_lba,
input sd_rd,
input sd_wr,
output reg sd_ack,
output reg sd_ack_conf,
// SD byte level access. Signals for 2-PORT altsyncram.
output reg [8:0] sd_buff_addr,
output reg [7:0] sd_buff_dout,
input [7:0] sd_buff_din,
output reg sd_buff_wr,
// ps2 keyboard emulation
output ps2_kbd_clk,
output reg ps2_kbd_data,
output ps2_mouse_clk,
output reg ps2_mouse_data,
// ARM -> FPGA download
input ioctl_force_erase,
output reg ioctl_download = 0, // signal indicating an active download
output reg ioctl_erasing = 0, // signal indicating an active erase
output reg [7:0] ioctl_index, // menu index used to upload the file
output reg ioctl_wr = 0,
output reg [24:0] ioctl_addr,
output reg [7:0] ioctl_dout
);
reg [7:0] b_data;
reg [6:0] sbuf;
reg [7:0] cmd;
reg [2:0] bit_cnt; // counts bits 0-7 0-7 ...
reg [7:0] byte_cnt; // counts bytes
reg [7:0] but_sw;
reg [2:0] stick_idx;
reg mount_strobe = 0;
assign img_mounted = mount_strobe;
assign buttons = but_sw[1:0];
assign switches = but_sw[3:2];
assign scandoubler_disable = but_sw[4];
assign ypbpr = but_sw[5];
wire [7:0] spi_dout = { sbuf, SPI_DI};
// this variant of user_io is for 8 bit cores (type == a4) only
wire [7:0] core_type = 8'ha4;
// command byte read by the io controller
wire [7:0] sd_cmd = { 4'h5, sd_conf, sd_sdhc, sd_wr, sd_rd };
reg spi_do;
assign SPI_DO = CONF_DATA0 ? 1'bZ : spi_do;
// drive MISO only when transmitting core id
always@(negedge SPI_SCK) begin
if(!CONF_DATA0) begin
// first byte returned is always core type, further bytes are
// command dependent
if(byte_cnt == 0) begin
spi_do <= core_type[~bit_cnt];
end else begin
case(cmd)
// reading config string
8'h14: begin
// returning a byte from string
if(byte_cnt < STRLEN + 1) spi_do <= conf_str[{STRLEN - byte_cnt,~bit_cnt}];
else spi_do <= 0;
end
// reading sd card status
8'h16: begin
if(byte_cnt == 1) spi_do <= sd_cmd[~bit_cnt];
else if((byte_cnt >= 2) && (byte_cnt < 6)) spi_do <= sd_lba[{5-byte_cnt, ~bit_cnt}];
else spi_do <= 0;
end
// reading sd card write data
8'h18:
spi_do <= b_data[~bit_cnt];
default:
spi_do <= 0;
endcase
end
end
end
reg b_wr2,b_wr3;
always @(negedge clk_sys) begin
b_wr3 <= b_wr2;
sd_buff_wr <= b_wr3;
end
// SPI receiver
always@(posedge SPI_SCK or posedge CONF_DATA0) begin
if(CONF_DATA0) begin
b_wr2 <= 0;
bit_cnt <= 0;
byte_cnt <= 0;
sd_ack <= 0;
sd_ack_conf <= 0;
end else begin
b_wr2 <= 0;
sbuf <= spi_dout[6:0];
bit_cnt <= bit_cnt + 1'd1;
if(bit_cnt == 5) begin
if (byte_cnt == 0) sd_buff_addr <= 0;
if((byte_cnt != 0) & (sd_buff_addr != 511)) sd_buff_addr <= sd_buff_addr + 1'b1;
if((byte_cnt == 1) & ((cmd == 8'h17) | (cmd == 8'h19))) sd_buff_addr <= 0;
end
// finished reading command byte
if(bit_cnt == 7) begin
if(~&byte_cnt) byte_cnt <= byte_cnt + 8'd1;
if(byte_cnt == 0) begin
cmd <= spi_dout;
if(spi_dout == 8'h19) begin
sd_ack_conf <= 1;
sd_buff_addr <= 0;
end
if((spi_dout == 8'h17) || (spi_dout == 8'h18)) begin
sd_ack <= 1;
sd_buff_addr <= 0;
end
if(spi_dout == 8'h18) b_data <= sd_buff_din;
mount_strobe <= 0;
end else begin
case(cmd)
// buttons and switches
8'h01: but_sw <= spi_dout;
8'h02: joystick_0 <= spi_dout;
8'h03: joystick_1 <= spi_dout;
// store incoming ps2 mouse bytes
8'h04: begin
ps2_mouse_fifo[ps2_mouse_wptr] <= spi_dout;
ps2_mouse_wptr <= ps2_mouse_wptr + 1'd1;
end
// store incoming ps2 keyboard bytes
8'h05: begin
ps2_kbd_fifo[ps2_kbd_wptr] <= spi_dout;
ps2_kbd_wptr <= ps2_kbd_wptr + 1'd1;
end
8'h15: status[7:0] <= spi_dout;
// send SD config IO -> FPGA
// flag that download begins
// sd card knows data is config if sd_dout_strobe is asserted
// with sd_ack still being inactive (low)
8'h19,
// send sector IO -> FPGA
// flag that download begins
8'h17: begin
sd_buff_dout <= spi_dout;
b_wr2 <= 1;
end
8'h18: b_data <= sd_buff_din;
// joystick analog
8'h1a: begin
// first byte is joystick index
if(byte_cnt == 1) stick_idx <= spi_dout[2:0];
else if(byte_cnt == 2) begin
// second byte is x axis
if(stick_idx == 0) joystick_analog_0[15:8] <= spi_dout;
else if(stick_idx == 1) joystick_analog_1[15:8] <= spi_dout;
end else if(byte_cnt == 3) begin
// third byte is y axis
if(stick_idx == 0) joystick_analog_0[7:0] <= spi_dout;
else if(stick_idx == 1) joystick_analog_1[7:0] <= spi_dout;
end
end
// notify image selection
8'h1c: mount_strobe <= 1;
// send image info
8'h1d: if(byte_cnt<5) img_size[(byte_cnt-1)<<3 +:8] <= spi_dout;
// status, 32bit version
8'h1e: if(byte_cnt<5) status[(byte_cnt-1)<<3 +:8] <= spi_dout;
default: ;
endcase
end
end
end
end
/////////////////////////////// PS2 ///////////////////////////////
// 8 byte fifos to store ps2 bytes
localparam PS2_FIFO_BITS = 3;
reg clk_ps2;
always @(negedge clk_sys) begin
integer cnt;
cnt <= cnt + 1'd1;
if(cnt == PS2DIV) begin
clk_ps2 <= ~clk_ps2;
cnt <= 0;
end
end
// keyboard
reg [7:0] ps2_kbd_fifo[1<<PS2_FIFO_BITS];
reg [PS2_FIFO_BITS-1:0] ps2_kbd_wptr;
reg [PS2_FIFO_BITS-1:0] ps2_kbd_rptr;
// ps2 transmitter state machine
reg [3:0] ps2_kbd_tx_state;
reg [7:0] ps2_kbd_tx_byte;
reg ps2_kbd_parity;
assign ps2_kbd_clk = clk_ps2 || (ps2_kbd_tx_state == 0);
// ps2 transmitter
// Takes a byte from the FIFO and sends it in a ps2 compliant serial format.
reg ps2_kbd_r_inc;
always@(posedge clk_sys) begin
reg old_clk;
old_clk <= clk_ps2;
if(~old_clk & clk_ps2) begin
ps2_kbd_r_inc <= 0;
if(ps2_kbd_r_inc) ps2_kbd_rptr <= ps2_kbd_rptr + 1'd1;
// transmitter is idle?
if(ps2_kbd_tx_state == 0) begin
// data in fifo present?
if(ps2_kbd_wptr != ps2_kbd_rptr) begin
// load tx register from fifo
ps2_kbd_tx_byte <= ps2_kbd_fifo[ps2_kbd_rptr];
ps2_kbd_r_inc <= 1;
// reset parity
ps2_kbd_parity <= 1;
// start transmitter
ps2_kbd_tx_state <= 1;
// put start bit on data line
ps2_kbd_data <= 0; // start bit is 0
end
end else begin
// transmission of 8 data bits
if((ps2_kbd_tx_state >= 1)&&(ps2_kbd_tx_state < 9)) begin
ps2_kbd_data <= ps2_kbd_tx_byte[0]; // data bits
ps2_kbd_tx_byte[6:0] <= ps2_kbd_tx_byte[7:1]; // shift down
if(ps2_kbd_tx_byte[0])
ps2_kbd_parity <= !ps2_kbd_parity;
end
// transmission of parity
if(ps2_kbd_tx_state == 9) ps2_kbd_data <= ps2_kbd_parity;
// transmission of stop bit
if(ps2_kbd_tx_state == 10) ps2_kbd_data <= 1; // stop bit is 1
// advance state machine
if(ps2_kbd_tx_state < 11) ps2_kbd_tx_state <= ps2_kbd_tx_state + 1'd1;
else ps2_kbd_tx_state <= 0;
end
end
end
// mouse
reg [7:0] ps2_mouse_fifo[1<<PS2_FIFO_BITS];
reg [PS2_FIFO_BITS-1:0] ps2_mouse_wptr;
reg [PS2_FIFO_BITS-1:0] ps2_mouse_rptr;
// ps2 transmitter state machine
reg [3:0] ps2_mouse_tx_state;
reg [7:0] ps2_mouse_tx_byte;
reg ps2_mouse_parity;
assign ps2_mouse_clk = clk_ps2 || (ps2_mouse_tx_state == 0);
// ps2 transmitter
// Takes a byte from the FIFO and sends it in a ps2 compliant serial format.
reg ps2_mouse_r_inc;
always@(posedge clk_sys) begin
reg old_clk;
old_clk <= clk_ps2;
if(~old_clk & clk_ps2) begin
ps2_mouse_r_inc <= 0;
if(ps2_mouse_r_inc) ps2_mouse_rptr <= ps2_mouse_rptr + 1'd1;
// transmitter is idle?
if(ps2_mouse_tx_state == 0) begin
// data in fifo present?
if(ps2_mouse_wptr != ps2_mouse_rptr) begin
// load tx register from fifo
ps2_mouse_tx_byte <= ps2_mouse_fifo[ps2_mouse_rptr];
ps2_mouse_r_inc <= 1;
// reset parity
ps2_mouse_parity <= 1;
// start transmitter
ps2_mouse_tx_state <= 1;
// put start bit on data line
ps2_mouse_data <= 0; // start bit is 0
end
end else begin
// transmission of 8 data bits
if((ps2_mouse_tx_state >= 1)&&(ps2_mouse_tx_state < 9)) begin
ps2_mouse_data <= ps2_mouse_tx_byte[0]; // data bits
ps2_mouse_tx_byte[6:0] <= ps2_mouse_tx_byte[7:1]; // shift down
if(ps2_mouse_tx_byte[0])
ps2_mouse_parity <= !ps2_mouse_parity;
end
// transmission of parity
if(ps2_mouse_tx_state == 9) ps2_mouse_data <= ps2_mouse_parity;
// transmission of stop bit
if(ps2_mouse_tx_state == 10) ps2_mouse_data <= 1; // stop bit is 1
// advance state machine
if(ps2_mouse_tx_state < 11) ps2_mouse_tx_state <= ps2_mouse_tx_state + 1'd1;
else ps2_mouse_tx_state <= 0;
end
end
end
/////////////////////////////// DOWNLOADING ///////////////////////////////
reg [7:0] data_w;
reg [24:0] addr_w;
reg rclk = 0;
localparam UIO_FILE_TX = 8'h53;
localparam UIO_FILE_TX_DAT = 8'h54;
localparam UIO_FILE_INDEX = 8'h55;
// data_io has its own SPI interface to the io controller
always@(posedge SPI_SCK, posedge SPI_SS2) begin
reg [6:0] sbuf;
reg [7:0] cmd;
reg [4:0] cnt;
reg [24:0] addr;
if(SPI_SS2) cnt <= 0;
else begin
rclk <= 0;
// don't shift in last bit. It is evaluated directly
// when writing to ram
if(cnt != 15) sbuf <= { sbuf[5:0], SPI_DI};
// increase target address after write
if(rclk) addr <= addr + 1'd1;
// count 0-7 8-15 8-15 ...
if(cnt < 15) cnt <= cnt + 1'd1;
else cnt <= 8;
// finished command byte
if(cnt == 7) cmd <= {sbuf, SPI_DI};
// prepare/end transmission
if((cmd == UIO_FILE_TX) && (cnt == 15)) begin
// prepare
if(SPI_DI) begin
case(ioctl_index)
0: addr <= 'h080000; // BOOT ROM
'h01: addr <= 'h000100; // ROM file
'h41: addr <= 'h000100; // COM file
'h81: addr <= 'h000000; // C00 file
'hC1: addr <= 'h010000; // EDD file
default: addr <= 'h100000; // FDD file
endcase
ioctl_download <= 1;
end else begin
addr_w <= addr;
ioctl_download <= 0;
end
end
// command 0x54: UIO_FILE_TX
if((cmd == UIO_FILE_TX_DAT) && (cnt == 15)) begin
addr_w <= addr;
data_w <= {sbuf, SPI_DI};
rclk <= 1;
end
// expose file (menu) index
if((cmd == UIO_FILE_INDEX) && (cnt == 15)) ioctl_index <= {sbuf, SPI_DI};
end
end
reg [24:0] erase_mask;
wire [24:0] next_erase = (ioctl_addr + 1'd1) & erase_mask;
always@(posedge clk_sys) begin
reg rclkD, rclkD2;
reg old_force = 0;
reg [5:0] erase_clk_div;
reg [24:0] end_addr;
reg erase_trigger = 0;
rclkD <= rclk;
rclkD2 <= rclkD;
ioctl_wr <= 0;
if(rclkD & ~rclkD2) begin
ioctl_dout <= data_w;
ioctl_addr <= addr_w;
ioctl_wr <= 1;
end
if(ioctl_download) begin
old_force <= 0;
ioctl_erasing <= 0;
erase_trigger <= (ioctl_index == 1);
end else begin
old_force <= ioctl_force_erase;
// start erasing
if(erase_trigger) begin
erase_trigger <= 0;
erase_mask <= 'hFFFF;
end_addr <= 'h0100;
erase_clk_div <= 1;
ioctl_erasing <= 1;
end else if((ioctl_force_erase & ~old_force)) begin
erase_trigger <= 0;
ioctl_addr <= 'h1FFFFFF;
erase_mask <= 'h1FFFFFF;
end_addr <= 'h0050000;
erase_clk_div <= 1;
ioctl_erasing <= 1;
end else if(ioctl_erasing) begin
erase_clk_div <= erase_clk_div + 1'd1;
if(!erase_clk_div) begin
if(next_erase == end_addr) ioctl_erasing <= 0;
else begin
ioctl_addr <= next_erase;
ioctl_dout <= 0;
ioctl_wr <= 1;
end
end
end
end
end
endmodule

View File

@@ -0,0 +1,179 @@
// A simple OSD implementation. Can be hooked up between a cores
// VGA output and the physical VGA pins
module osd (
// OSDs pixel clock, should be synchronous to cores pixel clock to
// avoid jitter.
input clk_sys,
// SPI interface
input SPI_SCK,
input SPI_SS3,
input SPI_DI,
// VGA signals coming from core
input [5:0] R_in,
input [5:0] G_in,
input [5:0] B_in,
input HSync,
input VSync,
// VGA signals going to video connector
output [5:0] R_out,
output [5:0] G_out,
output [5:0] B_out
);
parameter OSD_X_OFFSET = 10'd0;
parameter OSD_Y_OFFSET = 10'd0;
parameter OSD_COLOR = 3'd0;
localparam OSD_WIDTH = 10'd256;
localparam OSD_HEIGHT = 10'd128;
// *********************************************************************************
// spi client
// *********************************************************************************
// this core supports only the display related OSD commands
// of the minimig
reg osd_enable;
(* ramstyle = "no_rw_check" *) reg [7:0] osd_buffer[2047:0]; // the OSD buffer itself
// the OSD has its own SPI interface to the io controller
always@(posedge SPI_SCK, posedge SPI_SS3) begin
reg [4:0] cnt;
reg [10:0] bcnt;
reg [7:0] sbuf;
reg [7:0] cmd;
if(SPI_SS3) begin
cnt <= 0;
bcnt <= 0;
end else begin
sbuf <= {sbuf[6:0], SPI_DI};
// 0:7 is command, rest payload
if(cnt < 15) cnt <= cnt + 1'd1;
else cnt <= 8;
if(cnt == 7) begin
cmd <= {sbuf[6:0], SPI_DI};
// lower three command bits are line address
bcnt <= {sbuf[1:0], SPI_DI, 8'h00};
// command 0x40: OSDCMDENABLE, OSDCMDDISABLE
if(sbuf[6:3] == 4'b0100) osd_enable <= SPI_DI;
end
// command 0x20: OSDCMDWRITE
if((cmd[7:3] == 5'b00100) && (cnt == 15)) begin
osd_buffer[bcnt] <= {sbuf[6:0], SPI_DI};
bcnt <= bcnt + 1'd1;
end
end
end
// *********************************************************************************
// video timing and sync polarity anaylsis
// *********************************************************************************
// horizontal counter
reg [9:0] h_cnt;
reg [9:0] hs_low, hs_high;
wire hs_pol = hs_high < hs_low;
wire [9:0] dsp_width = hs_pol ? hs_low : hs_high;
// vertical counter
reg [9:0] v_cnt;
reg [9:0] vs_low, vs_high;
wire vs_pol = vs_high < vs_low;
wire [9:0] dsp_height = vs_pol ? vs_low : vs_high;
wire doublescan = (dsp_height>350);
reg ce_pix;
always @(negedge clk_sys) begin
integer cnt = 0;
integer pixsz, pixcnt;
reg hs;
cnt <= cnt + 1;
hs <= HSync;
pixcnt <= pixcnt + 1;
if(pixcnt == pixsz) pixcnt <= 0;
ce_pix <= !pixcnt;
if(hs && ~HSync) begin
cnt <= 0;
pixsz <= (cnt >> 9) - 1;
pixcnt <= 0;
ce_pix <= 1;
end
end
always @(posedge clk_sys) begin
reg hsD, hsD2;
reg vsD, vsD2;
if(ce_pix) begin
// bring hsync into local clock domain
hsD <= HSync;
hsD2 <= hsD;
// falling edge of HSync
if(!hsD && hsD2) begin
h_cnt <= 0;
hs_high <= h_cnt;
end
// rising edge of HSync
else if(hsD && !hsD2) begin
h_cnt <= 0;
hs_low <= h_cnt;
v_cnt <= v_cnt + 1'd1;
end else begin
h_cnt <= h_cnt + 1'd1;
end
vsD <= VSync;
vsD2 <= vsD;
// falling edge of VSync
if(!vsD && vsD2) begin
v_cnt <= 0;
vs_high <= v_cnt;
end
// rising edge of VSync
else if(vsD && !vsD2) begin
v_cnt <= 0;
vs_low <= v_cnt;
end
end
end
// area in which OSD is being displayed
wire [9:0] h_osd_start = ((dsp_width - OSD_WIDTH)>> 1) + OSD_X_OFFSET;
wire [9:0] h_osd_end = h_osd_start + OSD_WIDTH;
wire [9:0] v_osd_start = ((dsp_height- (OSD_HEIGHT<<doublescan))>> 1) + OSD_Y_OFFSET;
wire [9:0] v_osd_end = v_osd_start + (OSD_HEIGHT<<doublescan);
wire [9:0] osd_hcnt = h_cnt - h_osd_start + 1'd1; // one pixel offset for osd_byte register
wire [9:0] osd_vcnt = v_cnt - v_osd_start;
wire osd_de = osd_enable &&
(HSync != hs_pol) && (h_cnt >= h_osd_start) && (h_cnt < h_osd_end) &&
(VSync != vs_pol) && (v_cnt >= v_osd_start) && (v_cnt < v_osd_end);
reg [7:0] osd_byte;
always @(posedge clk_sys) if(ce_pix) osd_byte <= osd_buffer[{doublescan ? osd_vcnt[7:5] : osd_vcnt[6:4], osd_hcnt[7:0]}];
wire osd_pixel = osd_byte[doublescan ? osd_vcnt[4:2] : osd_vcnt[3:1]];
assign R_out = !osd_de ? R_in : {osd_pixel, osd_pixel, OSD_COLOR[2], R_in[5:3]};
assign G_out = !osd_de ? G_in : {osd_pixel, osd_pixel, OSD_COLOR[1], G_in[5:3]};
assign B_out = !osd_de ? B_in : {osd_pixel, osd_pixel, OSD_COLOR[0], B_in[5:3]};
endmodule

View File

@@ -0,0 +1,4 @@
set_global_assignment -name IP_TOOL_NAME "ALTPLL"
set_global_assignment -name IP_TOOL_VERSION "13.0"
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "pll.v"]
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll.ppf"]

View File

@@ -0,0 +1,348 @@
// megafunction wizard: %ALTPLL%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altpll
// ============================================================
// File Name: pll.v
// Megafunction Name(s):
// altpll
//
// Simulation Library Files(s):
// altera_mf
// ============================================================
// ************************************************************
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
//
// 13.0.1 Build 232 06/12/2013 SP 1 SJ Full Version
// ************************************************************
//Copyright (C) 1991-2013 Altera Corporation
//Your use of Altera Corporation's design tools, logic functions
//and other software and tools, and its AMPP partner logic
//functions, and any output files from any of the foregoing
//(including device programming or simulation files), and any
//associated documentation or information are expressly subject
//to the terms and conditions of the Altera Program License
//Subscription Agreement, Altera MegaCore Function License
//Agreement, or other applicable license agreement, including,
//without limitation, that your use is for the sole purpose of
//programming logic devices manufactured by Altera and sold by
//Altera or its authorized distributors. Please refer to the
//applicable agreement for further details.
// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
module pll (
areset,
inclk0,
c0,
c1,
locked);
input areset;
input inclk0;
output c0;
output c1;
output locked;
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_off
`endif
tri0 areset;
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_on
`endif
wire [4:0] sub_wire0;
wire sub_wire2;
wire [0:0] sub_wire6 = 1'h0;
wire [0:0] sub_wire3 = sub_wire0[0:0];
wire [1:1] sub_wire1 = sub_wire0[1:1];
wire c1 = sub_wire1;
wire locked = sub_wire2;
wire c0 = sub_wire3;
wire sub_wire4 = inclk0;
wire [1:0] sub_wire5 = {sub_wire6, sub_wire4};
altpll altpll_component (
.areset (areset),
.inclk (sub_wire5),
.clk (sub_wire0),
.locked (sub_wire2),
.activeclock (),
.clkbad (),
.clkena ({6{1'b1}}),
.clkloss (),
.clkswitch (1'b0),
.configupdate (1'b0),
.enable0 (),
.enable1 (),
.extclk (),
.extclkena ({4{1'b1}}),
.fbin (1'b1),
.fbmimicbidir (),
.fbout (),
.fref (),
.icdrclk (),
.pfdena (1'b1),
.phasecounterselect ({4{1'b1}}),
.phasedone (),
.phasestep (1'b1),
.phaseupdown (1'b1),
.pllena (1'b1),
.scanaclr (1'b0),
.scanclk (1'b0),
.scanclkena (1'b1),
.scandata (1'b0),
.scandataout (),
.scandone (),
.scanread (1'b0),
.scanwrite (1'b0),
.sclkout0 (),
.sclkout1 (),
.vcooverrange (),
.vcounderrange ());
defparam
altpll_component.bandwidth_type = "AUTO",
altpll_component.clk0_divide_by = 27,
altpll_component.clk0_duty_cycle = 50,
altpll_component.clk0_multiply_by = 40,
altpll_component.clk0_phase_shift = "0",
altpll_component.clk1_divide_by = 27,
altpll_component.clk1_duty_cycle = 50,
altpll_component.clk1_multiply_by = 10,
altpll_component.clk1_phase_shift = "0",
altpll_component.compensate_clock = "CLK0",
altpll_component.inclk0_input_frequency = 37037,
altpll_component.intended_device_family = "Cyclone III",
altpll_component.lpm_hint = "CBX_MODULE_PREFIX=pll",
altpll_component.lpm_type = "altpll",
altpll_component.operation_mode = "NORMAL",
altpll_component.pll_type = "AUTO",
altpll_component.port_activeclock = "PORT_UNUSED",
altpll_component.port_areset = "PORT_USED",
altpll_component.port_clkbad0 = "PORT_UNUSED",
altpll_component.port_clkbad1 = "PORT_UNUSED",
altpll_component.port_clkloss = "PORT_UNUSED",
altpll_component.port_clkswitch = "PORT_UNUSED",
altpll_component.port_configupdate = "PORT_UNUSED",
altpll_component.port_fbin = "PORT_UNUSED",
altpll_component.port_inclk0 = "PORT_USED",
altpll_component.port_inclk1 = "PORT_UNUSED",
altpll_component.port_locked = "PORT_USED",
altpll_component.port_pfdena = "PORT_UNUSED",
altpll_component.port_phasecounterselect = "PORT_UNUSED",
altpll_component.port_phasedone = "PORT_UNUSED",
altpll_component.port_phasestep = "PORT_UNUSED",
altpll_component.port_phaseupdown = "PORT_UNUSED",
altpll_component.port_pllena = "PORT_UNUSED",
altpll_component.port_scanaclr = "PORT_UNUSED",
altpll_component.port_scanclk = "PORT_UNUSED",
altpll_component.port_scanclkena = "PORT_UNUSED",
altpll_component.port_scandata = "PORT_UNUSED",
altpll_component.port_scandataout = "PORT_UNUSED",
altpll_component.port_scandone = "PORT_UNUSED",
altpll_component.port_scanread = "PORT_UNUSED",
altpll_component.port_scanwrite = "PORT_UNUSED",
altpll_component.port_clk0 = "PORT_USED",
altpll_component.port_clk1 = "PORT_USED",
altpll_component.port_clk2 = "PORT_UNUSED",
altpll_component.port_clk3 = "PORT_UNUSED",
altpll_component.port_clk4 = "PORT_UNUSED",
altpll_component.port_clk5 = "PORT_UNUSED",
altpll_component.port_clkena0 = "PORT_UNUSED",
altpll_component.port_clkena1 = "PORT_UNUSED",
altpll_component.port_clkena2 = "PORT_UNUSED",
altpll_component.port_clkena3 = "PORT_UNUSED",
altpll_component.port_clkena4 = "PORT_UNUSED",
altpll_component.port_clkena5 = "PORT_UNUSED",
altpll_component.port_extclk0 = "PORT_UNUSED",
altpll_component.port_extclk1 = "PORT_UNUSED",
altpll_component.port_extclk2 = "PORT_UNUSED",
altpll_component.port_extclk3 = "PORT_UNUSED",
altpll_component.self_reset_on_loss_lock = "OFF",
altpll_component.width_clock = 5;
endmodule
// ============================================================
// CNX file retrieval info
// ============================================================
// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0"
// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000"
// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1"
// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz"
// Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "Low"
// Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "1"
// Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "0"
// Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0"
// Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0"
// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0"
// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0"
// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0"
// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0"
// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0"
// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0"
// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "8"
// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "27"
// Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "27"
// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000"
// Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000"
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "40.000000"
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE1 STRING "10.000000"
// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0"
// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
// Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "0"
// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0"
// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575"
// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1"
// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "27.000"
// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz"
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000"
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1"
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1"
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz"
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
// Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1"
// Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1"
// Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1"
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg"
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "deg"
// Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any"
// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0"
// Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0"
// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "40"
// Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "10"
// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1"
// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "40.00000000"
// Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "10.00000000"
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0"
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "0"
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz"
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz"
// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1"
// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0"
// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000"
// Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000"
// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0"
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg"
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "deg"
// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1"
// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
// Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0"
// Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0"
// Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0"
// Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0"
// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0"
// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0"
// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0"
// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll.mif"
// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0"
// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1"
// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0"
// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0"
// Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0"
// Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000"
// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz"
// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500"
// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0"
// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1"
// Retrieval info: PRIVATE: STICKY_CLK1 STRING "1"
// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
// Retrieval info: PRIVATE: USE_CLK0 STRING "1"
// Retrieval info: PRIVATE: USE_CLK1 STRING "1"
// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0"
// Retrieval info: PRIVATE: USE_CLKENA1 STRING "0"
// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0"
// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
// Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "AUTO"
// Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "27"
// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50"
// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "40"
// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0"
// Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "27"
// Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50"
// Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "10"
// Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0"
// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0"
// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "37037"
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll"
// Retrieval info: CONSTANT: OPERATION_MODE STRING "NORMAL"
// Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO"
// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_USED"
// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED"
// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED"
// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED"
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED"
// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED"
// Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF"
// Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5"
// Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]"
// Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset"
// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0"
// Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1"
// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
// Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked"
// Retrieval info: CONNECT: @areset 0 0 0 0 areset 0 0 0 0
// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0
// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0
// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0
// Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1
// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0
// Retrieval info: GEN_FILE: TYPE_NORMAL pll.v TRUE
// Retrieval info: GEN_FILE: TYPE_NORMAL pll.ppf TRUE
// Retrieval info: GEN_FILE: TYPE_NORMAL pll.inc FALSE
// Retrieval info: GEN_FILE: TYPE_NORMAL pll.cmp FALSE
// Retrieval info: GEN_FILE: TYPE_NORMAL pll.bsf FALSE
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_inst.v FALSE
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_bb.v FALSE
// Retrieval info: LIB_FILE: altera_mf
// Retrieval info: CBX_MODULE_PREFIX: ON

View File

@@ -0,0 +1,195 @@
//
// scandoubler.v
//
// Copyright (c) 2015 Till Harbaum <till@harbaum.org>
// Copyright (c) 2017 Sorgelig
//
// This source file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This source file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// TODO: Delay vsync one line
`define BITS_TO_FIT(N) ( \
N <= 2 ? 0 : \
N <= 4 ? 1 : \
N <= 8 ? 2 : \
N <= 16 ? 3 : \
N <= 32 ? 4 : \
N <= 64 ? 5 : \
N <= 128 ? 6 : \
N <= 256 ? 7 : \
N <= 512 ? 8 : \
N <=1024 ? 9 : 10 )
module scandoubler #(parameter LENGTH, parameter HALF_DEPTH)
(
// system interface
input clk_sys,
input ce_pix,
input ce_pix_actual,
input hq2x,
// shifter video interface
input hs_in,
input vs_in,
input line_start,
input [DWIDTH:0] r_in,
input [DWIDTH:0] g_in,
input [DWIDTH:0] b_in,
input mono,
// output interface
output reg hs_out,
output vs_out,
output [DWIDTH:0] r_out,
output [DWIDTH:0] g_out,
output [DWIDTH:0] b_out
);
localparam DWIDTH = HALF_DEPTH ? 2 : 5;
assign vs_out = vs_in;
reg [2:0] phase;
reg [2:0] ce_div;
reg [7:0] pix_len = 0;
wire [7:0] pl = pix_len + 1'b1;
reg ce_x1, ce_x4;
reg req_line_reset;
wire ls_in = hs_in | line_start;
always @(negedge clk_sys) begin
reg old_ce;
reg [2:0] ce_cnt;
reg [7:0] pixsz2, pixsz4 = 0;
old_ce <= ce_pix;
if(~&pix_len) pix_len <= pix_len + 1'd1;
ce_x4 <= 0;
ce_x1 <= 0;
// use such odd comparison to place c_x4 evenly if master clock isn't multiple 4.
if((pl == pixsz4) || (pl == pixsz2) || (pl == (pixsz2+pixsz4))) begin
phase <= phase + 1'd1;
ce_x4 <= 1;
end
if(~old_ce & ce_pix) begin
pixsz2 <= {1'b0, pl[7:1]};
pixsz4 <= {2'b00, pl[7:2]};
ce_x1 <= 1;
ce_x4 <= 1;
pix_len <= 0;
phase <= phase + 1'd1;
ce_cnt <= ce_cnt + 1'd1;
if(ce_pix_actual) begin
phase <= 0;
ce_div <= ce_cnt + 1'd1;
ce_cnt <= 0;
req_line_reset <= 0;
end
if(ls_in) req_line_reset <= 1;
end
end
reg ce_sd;
always @(*) begin
case(ce_div)
2: ce_sd = !phase[0];
4: ce_sd = !phase[1:0];
default: ce_sd <= 1;
endcase
end
localparam AWIDTH = `BITS_TO_FIT(LENGTH);
Hq2x #(.LENGTH(LENGTH), .HALF_DEPTH(HALF_DEPTH)) Hq2x
(
.clk(clk_sys),
.ce_x4(ce_x4 & ce_sd),
.inputpixel({b_in,g_in,r_in}),
.mono(mono),
.disable_hq2x(~hq2x),
.reset_frame(vs_in),
.reset_line(req_line_reset),
.read_y(sd_line),
.read_x(sd_h_actual),
.outpixel({b_out,g_out,r_out})
);
reg [10:0] sd_h_actual;
always @(*) begin
case(ce_div)
2: sd_h_actual = sd_h[10:1];
4: sd_h_actual = sd_h[10:2];
default: sd_h_actual = sd_h;
endcase
end
reg [10:0] sd_h;
reg [1:0] sd_line;
always @(posedge clk_sys) begin
reg [11:0] hs_max,hs_rise,hs_ls;
reg [10:0] hcnt;
reg [11:0] sd_hcnt;
reg hs, hs2, vs, ls;
if(ce_x1) begin
hs <= hs_in;
ls <= ls_in;
if(ls && !ls_in) hs_ls <= {hcnt,1'b1};
// falling edge of hsync indicates start of line
if(hs && !hs_in) begin
hs_max <= {hcnt,1'b1};
hcnt <= 0;
if(ls && !ls_in) hs_ls <= {10'd0,1'b1};
end else begin
hcnt <= hcnt + 1'd1;
end
// save position of rising edge
if(!hs && hs_in) hs_rise <= {hcnt,1'b1};
vs <= vs_in;
if(vs && ~vs_in) sd_line <= 0;
end
if(ce_x4) begin
hs2 <= hs_in;
// output counter synchronous to input and at twice the rate
sd_hcnt <= sd_hcnt + 1'd1;
sd_h <= sd_h + 1'd1;
if(hs2 && !hs_in) sd_hcnt <= hs_max;
if(sd_hcnt == hs_max) sd_hcnt <= 0;
// replicate horizontal sync at twice the speed
if(sd_hcnt == hs_max) hs_out <= 0;
if(sd_hcnt == hs_rise) hs_out <= 1;
if(sd_hcnt == hs_ls) sd_h <= 0;
if(sd_hcnt == hs_ls) sd_line <= sd_line + 1'd1;
end
end
endmodule

View File

@@ -0,0 +1,136 @@
---------------------------------------------------------------------------------
-- Berzerk Video generator - Dar - Juin 2018
---------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity video_gen is
port(
clock : in std_logic;
reset : in std_logic;
ena_pixel : in std_logic;
hsync : out std_logic;
vsync : out std_logic;
csync : out std_logic;
blank : out std_logic;
hcnt_o : out std_logic_vector(8 downto 0);
vcnt_o : out std_logic_vector(8 downto 0)
);
end video_gen;
architecture struct of video_gen is
signal hblank : std_logic;
signal vblank : std_logic;
signal vblank_r: std_logic;
signal hcnt : std_logic_vector(8 downto 0);
signal vcnt : std_logic_vector(8 downto 0);
signal hsync0 : std_logic;
signal hsync1 : std_logic;
signal hsync2 : std_logic;
begin
hcnt_o <= hcnt;
vcnt_o <= vcnt;
hsync <= hsync0;
blank <= hblank or vblank_r;
-- Compteur horizontal
-- 1C0..1FF-000..0FF : 64+256 = 320 pixels
-- 448..511-000..255
-- Compteur vertical
-- 1DA..1FF-020..0FF : 38+224 = 262 lignes
-- 474..511-032..255
-- Synchro horizontale : hcnt=[] (xx pixels)
-- Synchro verticale : vcnt=[] ( x lignes)
process(clock,reset)
begin
if reset = '1' then
hcnt <= (others=>'0');
vcnt <= (others=>'0');
else
if rising_edge(clock) then
if ena_pixel = '1' then
if hcnt = std_logic_vector(to_unsigned(511,9)) then -- 511
hcnt <= (others=>'0');
else
if hcnt = std_logic_vector(to_unsigned(255,9)) then -- 255
hcnt <= std_logic_vector(to_unsigned(448,9)); -- 448
else
hcnt <= hcnt + '1';
end if;
end if;
if hcnt = std_logic_vector(to_unsigned(255,9)) then
if vcnt = std_logic_vector(to_unsigned(511,9)) then
vcnt <= std_logic_vector(to_unsigned(32,9));
else
if vcnt = 255 then
vcnt <= std_logic_vector(to_unsigned(474,9));
else
vcnt <= vcnt + '1';
end if;
end if;
end if;
if hcnt = std_logic_vector(to_unsigned(448+16,9)) then
vblank_r <= vblank;
end if;
if hcnt = (466+ 0) then hsync0 <= '0';
elsif hcnt = (466+24) then hsync0 <= '1';
end if;
if hcnt = (466+ 0) then hsync1 <= '0';
elsif hcnt = (466+11) then hsync1 <= '1';
elsif hcnt = (466 +160-512) then hsync1 <= '0';
elsif hcnt = (466+11+160-512) then hsync1 <= '1';
end if;
if hcnt = (466) then hsync2 <= '0';
elsif hcnt = (466-10) then hsync2 <= '1';
end if;
if vcnt = (490-7) then csync <= hsync1;
elsif vcnt = (491-7) then csync <= hsync1;
elsif vcnt = (492-7) then csync <= hsync1;
elsif vcnt = (493-7) then csync <= hsync2;
elsif vcnt = (494-7) then csync <= hsync2;
elsif vcnt = (495-7) then csync <= hsync2;
elsif vcnt = (496-7) then csync <= hsync1;
elsif vcnt = (497-7) then csync <= hsync1;
elsif vcnt = (498-7) then csync <= hsync1;
else csync <= hsync0;
end if;
if vcnt = (490) then vsync <= '0';
elsif vcnt = (498) then vsync <= '1';
end if;
if hcnt = (448+8) then hblank <= '1';
elsif hcnt = (8) then hblank <= '0';
end if;
if vcnt = (474) then vblank <= '1';
elsif vcnt = (032) then vblank <= '0';
end if;
end if;
end if;
end if;
end process;
end architecture;

View File

@@ -0,0 +1,242 @@
//
//
// Copyright (c) 2017 Sorgelig
//
// This program is GPL Licensed. See COPYING for the full license.
//
//
////////////////////////////////////////////////////////////////////////////////////////////////////////
`timescale 1ns / 1ps
//
// LINE_LENGTH: Length of display line in pixels
// Usually it's length from HSync to HSync.
// May be less if line_start is used.
//
// HALF_DEPTH: If =1 then color dept is 3 bits per component
// For half depth 6 bits monochrome is available with
// mono signal enabled and color = {G, R}
module video_mixer
#(
parameter LINE_LENGTH = 768,
parameter HALF_DEPTH = 0,
parameter OSD_COLOR = 3'd7,
parameter OSD_X_OFFSET = 10'd0,
parameter OSD_Y_OFFSET = 10'd0
)
(
// master clock
// it should be multiple by (ce_pix*4).
input clk_sys,
// Pixel clock or clock_enable (both are accepted).
input ce_pix,
// Some systems have multiple resolutions.
// ce_pix_actual should match ce_pix where every second or fourth pulse is enabled,
// thus half or qurter resolutions can be used without brake video sync while switching resolutions.
// For fixed single resolution (or when video sync stability isn't required) ce_pix_actual = ce_pix.
input ce_pix_actual,
// OSD SPI interface
input SPI_SCK,
input SPI_SS3,
input SPI_DI,
// scanlines (00-none 01-25% 10-50% 11-75%)
input [1:0] scanlines,
// 0 = HVSync 31KHz, 1 = CSync 15KHz
input scandoubler_disable,
// High quality 2x scaling
input hq2x,
// YPbPr always uses composite sync
input ypbpr,
// 0 = 16-240 range. 1 = 0-255 range. (only for YPbPr color space)
input ypbpr_full,
// color
input [DWIDTH:0] R,
input [DWIDTH:0] G,
input [DWIDTH:0] B,
// Monochrome mode (for HALF_DEPTH only)
input mono,
// interlace sync. Positive pulses.
input HSync,
input VSync,
// Falling of this signal means start of informative part of line.
// It can be horizontal blank signal.
// This signal can be used to reduce amount of required FPGA RAM for HQ2x scan doubler
// If FPGA RAM is not an issue, then simply set it to 0 for whole line processing.
// Keep in mind: due to algo first and last pixels of line should be black to avoid side artefacts.
// Thus, if blank signal is used to reduce the line, make sure to feed at least one black (or paper) pixel
// before first informative pixel.
input line_start,
// MiST video output signals
output [5:0] VGA_R,
output [5:0] VGA_G,
output [5:0] VGA_B,
output VGA_VS,
output VGA_HS
);
localparam DWIDTH = HALF_DEPTH ? 2 : 5;
wire [DWIDTH:0] R_sd;
wire [DWIDTH:0] G_sd;
wire [DWIDTH:0] B_sd;
wire hs_sd, vs_sd;
scandoubler #(.LENGTH(LINE_LENGTH), .HALF_DEPTH(HALF_DEPTH)) scandoubler
(
.*,
.hs_in(HSync),
.vs_in(VSync),
.r_in(R),
.g_in(G),
.b_in(B),
.hs_out(hs_sd),
.vs_out(vs_sd),
.r_out(R_sd),
.g_out(G_sd),
.b_out(B_sd)
);
wire [DWIDTH:0] rt = (scandoubler_disable ? R : R_sd);
wire [DWIDTH:0] gt = (scandoubler_disable ? G : G_sd);
wire [DWIDTH:0] bt = (scandoubler_disable ? B : B_sd);
generate
if(HALF_DEPTH) begin
wire [5:0] r = mono ? {gt,rt} : {rt,rt};
wire [5:0] g = mono ? {gt,rt} : {gt,gt};
wire [5:0] b = mono ? {gt,rt} : {bt,bt};
end else begin
wire [5:0] r = rt;
wire [5:0] g = gt;
wire [5:0] b = bt;
end
endgenerate
wire hs = (scandoubler_disable ? HSync : hs_sd);
wire vs = (scandoubler_disable ? VSync : vs_sd);
reg scanline = 0;
always @(posedge clk_sys) begin
reg old_hs, old_vs;
old_hs <= hs;
old_vs <= vs;
if(old_hs && ~hs) scanline <= ~scanline;
if(old_vs && ~vs) scanline <= 0;
end
wire [5:0] r_out, g_out, b_out;
always @(*) begin
case(scanlines & {scanline, scanline})
1: begin // reduce 25% = 1/2 + 1/4
r_out = {1'b0, r[5:1]} + {2'b00, r[5:2]};
g_out = {1'b0, g[5:1]} + {2'b00, g[5:2]};
b_out = {1'b0, b[5:1]} + {2'b00, b[5:2]};
end
2: begin // reduce 50% = 1/2
r_out = {1'b0, r[5:1]};
g_out = {1'b0, g[5:1]};
b_out = {1'b0, b[5:1]};
end
3: begin // reduce 75% = 1/4
r_out = {2'b00, r[5:2]};
g_out = {2'b00, g[5:2]};
b_out = {2'b00, b[5:2]};
end
default: begin
r_out = r;
g_out = g;
b_out = b;
end
endcase
end
wire [5:0] red, green, blue;
osd #(OSD_X_OFFSET, OSD_Y_OFFSET, OSD_COLOR) osd
(
.*,
.R_in(r_out),
.G_in(g_out),
.B_in(b_out),
.HSync(hs),
.VSync(vs),
.R_out(red),
.G_out(green),
.B_out(blue)
);
wire [5:0] yuv_full[225] = '{
6'd0, 6'd0, 6'd0, 6'd0, 6'd1, 6'd1, 6'd1, 6'd1,
6'd2, 6'd2, 6'd2, 6'd3, 6'd3, 6'd3, 6'd3, 6'd4,
6'd4, 6'd4, 6'd5, 6'd5, 6'd5, 6'd5, 6'd6, 6'd6,
6'd6, 6'd7, 6'd7, 6'd7, 6'd7, 6'd8, 6'd8, 6'd8,
6'd9, 6'd9, 6'd9, 6'd9, 6'd10, 6'd10, 6'd10, 6'd11,
6'd11, 6'd11, 6'd11, 6'd12, 6'd12, 6'd12, 6'd13, 6'd13,
6'd13, 6'd13, 6'd14, 6'd14, 6'd14, 6'd15, 6'd15, 6'd15,
6'd15, 6'd16, 6'd16, 6'd16, 6'd17, 6'd17, 6'd17, 6'd17,
6'd18, 6'd18, 6'd18, 6'd19, 6'd19, 6'd19, 6'd19, 6'd20,
6'd20, 6'd20, 6'd21, 6'd21, 6'd21, 6'd21, 6'd22, 6'd22,
6'd22, 6'd23, 6'd23, 6'd23, 6'd23, 6'd24, 6'd24, 6'd24,
6'd25, 6'd25, 6'd25, 6'd25, 6'd26, 6'd26, 6'd26, 6'd27,
6'd27, 6'd27, 6'd27, 6'd28, 6'd28, 6'd28, 6'd29, 6'd29,
6'd29, 6'd29, 6'd30, 6'd30, 6'd30, 6'd31, 6'd31, 6'd31,
6'd31, 6'd32, 6'd32, 6'd32, 6'd33, 6'd33, 6'd33, 6'd33,
6'd34, 6'd34, 6'd34, 6'd35, 6'd35, 6'd35, 6'd35, 6'd36,
6'd36, 6'd36, 6'd36, 6'd37, 6'd37, 6'd37, 6'd38, 6'd38,
6'd38, 6'd38, 6'd39, 6'd39, 6'd39, 6'd40, 6'd40, 6'd40,
6'd40, 6'd41, 6'd41, 6'd41, 6'd42, 6'd42, 6'd42, 6'd42,
6'd43, 6'd43, 6'd43, 6'd44, 6'd44, 6'd44, 6'd44, 6'd45,
6'd45, 6'd45, 6'd46, 6'd46, 6'd46, 6'd46, 6'd47, 6'd47,
6'd47, 6'd48, 6'd48, 6'd48, 6'd48, 6'd49, 6'd49, 6'd49,
6'd50, 6'd50, 6'd50, 6'd50, 6'd51, 6'd51, 6'd51, 6'd52,
6'd52, 6'd52, 6'd52, 6'd53, 6'd53, 6'd53, 6'd54, 6'd54,
6'd54, 6'd54, 6'd55, 6'd55, 6'd55, 6'd56, 6'd56, 6'd56,
6'd56, 6'd57, 6'd57, 6'd57, 6'd58, 6'd58, 6'd58, 6'd58,
6'd59, 6'd59, 6'd59, 6'd60, 6'd60, 6'd60, 6'd60, 6'd61,
6'd61, 6'd61, 6'd62, 6'd62, 6'd62, 6'd62, 6'd63, 6'd63,
6'd63
};
// http://marsee101.blog19.fc2.com/blog-entry-2311.html
// Y = 16 + 0.257*R + 0.504*G + 0.098*B (Y = 0.299*R + 0.587*G + 0.114*B)
// Pb = 128 - 0.148*R - 0.291*G + 0.439*B (Pb = -0.169*R - 0.331*G + 0.500*B)
// Pr = 128 + 0.439*R - 0.368*G - 0.071*B (Pr = 0.500*R - 0.419*G - 0.081*B)
wire [18:0] y_8 = 19'd04096 + ({red, 8'd0} + {red, 3'd0}) + ({green, 9'd0} + {green, 2'd0}) + ({blue, 6'd0} + {blue, 5'd0} + {blue, 2'd0});
wire [18:0] pb_8 = 19'd32768 - ({red, 7'd0} + {red, 4'd0} + {red, 3'd0}) - ({green, 8'd0} + {green, 5'd0} + {green, 3'd0}) + ({blue, 8'd0} + {blue, 7'd0} + {blue, 6'd0});
wire [18:0] pr_8 = 19'd32768 + ({red, 8'd0} + {red, 7'd0} + {red, 6'd0}) - ({green, 8'd0} + {green, 6'd0} + {green, 5'd0} + {green, 4'd0} + {green, 3'd0}) - ({blue, 6'd0} + {blue , 3'd0});
wire [7:0] y = ( y_8[17:8] < 16) ? 8'd16 : ( y_8[17:8] > 235) ? 8'd235 : y_8[15:8];
wire [7:0] pb = (pb_8[17:8] < 16) ? 8'd16 : (pb_8[17:8] > 240) ? 8'd240 : pb_8[15:8];
wire [7:0] pr = (pr_8[17:8] < 16) ? 8'd16 : (pr_8[17:8] > 240) ? 8'd240 : pr_8[15:8];
assign VGA_R = ypbpr ? (ypbpr_full ? yuv_full[pr-8'd16] : pr[7:2]) : red;
assign VGA_G = ypbpr ? (ypbpr_full ? yuv_full[y -8'd16] : y[7:2]) : green;
assign VGA_B = ypbpr ? (ypbpr_full ? yuv_full[pb-8'd16] : pb[7:2]) : blue;
assign VGA_VS = (scandoubler_disable | ypbpr) ? 1'b1 : ~vs_sd;
assign VGA_HS = scandoubler_disable ? ~(HSync ^ VSync) : ypbpr ? ~(hs_sd ^ vs_sd) : ~hs_sd;
endmodule

View File

@@ -28,7 +28,7 @@
# ========================
set_global_assignment -name ORIGINAL_QUARTUS_VERSION 13.1
set_global_assignment -name PROJECT_CREATION_TIME_DATE "21:40:24 MAY 17, 2014"
set_global_assignment -name LAST_QUARTUS_VERSION 13.1
set_global_assignment -name LAST_QUARTUS_VERSION "13.0 SP1"
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL

View File

@@ -1,2 +1,2 @@
`define BUILD_DATE "171120"
`define BUILD_TIME "173612"
`define BUILD_DATE "180708"
`define BUILD_TIME "052311"