repo_name
stringlengths 6
79
| path
stringlengths 6
236
| copies
int64 1
472
| size
int64 137
1.04M
| content
stringlengths 137
1.04M
| license
stringclasses 15
values | hash
stringlengths 32
32
| alpha_frac
float64 0.25
0.96
| ratio
float64 1.51
17.5
| autogenerated
bool 1
class | config_or_test
bool 2
classes | has_no_keywords
bool 1
class | has_few_assignments
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|
chiggs/nvc | test/sem/record.vhd | 1 | 2,681 | package p is
type r1 is record -- OK
x : integer;
y : integer;
end record;
type r2 is record -- Error
x, x : integer;
end record;
type r3;
type r3 is record -- Error
x : r3;
end record;
type r4 is record
x, y, z : integer;
end record;
type r5 is record
x : r1;
y : integer;
end record;
type r1_vec is array (integer range <>) of r1;
type r6 is record
x : r1_vec; -- Error
end record;
end package;
package body p is
procedure p1 is
variable v1 : r1 := (1, 2);
variable v2 : r4 := (1, 2); -- Error
variable v3 : r1 := (1, v1); -- Error
variable v4 : r1 := (x => 1, y => 2);
variable v5 : r1 := (x => 1); -- Error
variable v6 : r1 := (x => 1, y => 2, q => 1); -- Error
variable v7 : r1 := (x => 1, y => v1); -- Error
variable v8 : r1 := (others => 9);
variable v9 : r1 := (x => 1, others => 2);
variable v10 : r1 := (x => 1, x => 2, y => 3); -- Error
variable v11 : r1 := (1, x => 4, y => 2); -- Error
variable v12 : r1 := (1, y => 4);
variable v13 : r1;
begin
end procedure;
procedure p2 is
variable v1 : r1;
variable v2 : r5;
begin
v1.x := 2;
v1.y := v1.x + 5;
v2.x.x := 3;
end procedure;
procedure p3 is
variable a1 : r1_vec; -- Error
begin
end procedure;
procedure p4 is
variable a2 : r1_vec(0 to 3); -- OK
begin
a2(2).x := 5; -- OK
a2(1).f := 2; -- Error
a2(0).x := a2(1).y; -- OK
end procedure;
procedure p5 is
subtype r1_sub is r1; -- OK
variable a : r1_sub; -- OK
begin
a.x := 5; -- OK
a.y := a.x + 2; -- OK
a.z := 2; -- Error
end procedure;
procedure p6 is
subtype r1_bad is r1(1 to 3); -- Error
begin
end procedure;
procedure p7 is
type rec is record
vec : bit_vector(1 to 3);
end record;
variable a : rec;
begin
assert a.vec'length = 3; -- OK
end procedure;
procedure p8 is
function make_r1 return r1 is
begin
return (x => 1, y => 2);
end function;
begin
assert make_r1.x = 1; -- OK
assert make_r1.z = 2; -- Error
end procedure;
end package body;
| gpl-3.0 | 98bff1d0cd2886d42097ab4999cf6dbb | 0.420739 | 3.495437 | false | false | false | false |
armandas/Arcade | level_info.vhd | 2 | 2,903 | library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity level_info is
port(
clk, not_reset: in std_logic;
px_x, px_y: in std_logic_vector(9 downto 0);
level: in std_logic_vector(8 downto 0);
rgb_pixel: out std_logic_vector(0 to 2)
);
end level_info;
architecture display of level_info is
constant WIDTH: integer := 48;
constant HEIGHT: integer := 8;
signal font_addr: std_logic_vector(8 downto 0);
signal font_data: std_logic_vector(0 to 7);
signal font_pixel: std_logic;
signal text_font_addr: std_logic_vector(8 downto 0);
signal number_font_addr: std_logic_vector(8 downto 0);
signal text_enable: std_logic;
signal number_enable: std_logic;
signal bcd: std_logic_vector(3 downto 0);
signal bcd0, bcd1, bcd2: std_logic_vector(3 downto 0);
begin
text_enable <= '1' when (px_x >= 0 and
px_x < WIDTH and
px_y >= 0 and
px_y < HEIGHT) else
'0';
-- +16 and +40 used to right-align the level with score
number_enable <= '1' when (px_x >= WIDTH + 16 and
px_x < WIDTH + 40 and
px_y >= 0 and
px_y < HEIGHT) else
'0';
with px_x(9 downto 3) select
text_font_addr <= "101100000" when "0000000", -- L
"100101000" when "0000001", -- E
"110110000" when "0000010", -- V
"100101000" when "0000011", -- E
"101100000" when "0000100", -- L
"000000000" when others; -- space
bcd <= bcd0 when px_x(9 downto 3) = 10 else
bcd1 when px_x(9 downto 3) = 9 else
bcd2 when px_x(9 downto 3) = 8 else
(others => '0');
-- numbers start at memory location 128
-- '1' starts at 136, '2' at 144 and so on
-- bcd is multiplied by 8 to get the right digit
number_font_addr <= conv_std_logic_vector(128, 9) + (bcd & "000");
font_addr <= px_y(2 downto 0) + text_font_addr when text_enable = '1' else
px_y(2 downto 0) + number_font_addr when number_enable = '1' else
(others => '0');
font_pixel <= font_data(conv_integer(px_x(2 downto 0)));
rgb_pixel <= "111" when font_pixel = '1' else "000";
bin_to_bcd:
entity work.bin2bcd(behaviour)
generic map(N_BIN => 9)
port map(
clk => clk, not_reset => not_reset,
binary_in => level,
bcd0 => bcd0, bcd1 => bcd1, bcd2 => bcd2,
bcd3 => open, bcd4 => open
);
codepage:
entity work.codepage_rom(content)
port map(addr => font_addr, data => font_data);
end display;
| bsd-2-clause | 9061b63b08eddd4567e9c72acd70f480 | 0.522907 | 3.646985 | false | false | false | false |
ntb-ch/cb20 | FPGA_Designs/watchdog/cb20/synthesis/cb20_gpio_block_0_avalon_slave_0_translator.vhd | 1 | 14,661 | -- cb20_gpio_block_0_avalon_slave_0_translator.vhd
-- Generated using ACDS version 13.0sp1 232 at 2020.06.03.16:36:13
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity cb20_gpio_block_0_avalon_slave_0_translator is
generic (
AV_ADDRESS_W : integer := 4;
AV_DATA_W : integer := 32;
UAV_DATA_W : integer := 32;
AV_BURSTCOUNT_W : integer := 1;
AV_BYTEENABLE_W : integer := 4;
UAV_BYTEENABLE_W : integer := 4;
UAV_ADDRESS_W : integer := 17;
UAV_BURSTCOUNT_W : integer := 3;
AV_READLATENCY : integer := 0;
USE_READDATAVALID : integer := 0;
USE_WAITREQUEST : integer := 1;
USE_UAV_CLKEN : integer := 0;
USE_READRESPONSE : integer := 0;
USE_WRITERESPONSE : integer := 0;
AV_SYMBOLS_PER_WORD : integer := 4;
AV_ADDRESS_SYMBOLS : integer := 0;
AV_BURSTCOUNT_SYMBOLS : integer := 0;
AV_CONSTANT_BURST_BEHAVIOR : integer := 0;
UAV_CONSTANT_BURST_BEHAVIOR : integer := 0;
AV_REQUIRE_UNALIGNED_ADDRESSES : integer := 0;
CHIPSELECT_THROUGH_READLATENCY : integer := 0;
AV_READ_WAIT_CYCLES : integer := 1;
AV_WRITE_WAIT_CYCLES : integer := 0;
AV_SETUP_WAIT_CYCLES : integer := 0;
AV_DATA_HOLD_CYCLES : integer := 0
);
port (
clk : in std_logic := '0'; -- clk.clk
reset : in std_logic := '0'; -- reset.reset
uav_address : in std_logic_vector(16 downto 0) := (others => '0'); -- avalon_universal_slave_0.address
uav_burstcount : in std_logic_vector(2 downto 0) := (others => '0'); -- .burstcount
uav_read : in std_logic := '0'; -- .read
uav_write : in std_logic := '0'; -- .write
uav_waitrequest : out std_logic; -- .waitrequest
uav_readdatavalid : out std_logic; -- .readdatavalid
uav_byteenable : in std_logic_vector(3 downto 0) := (others => '0'); -- .byteenable
uav_readdata : out std_logic_vector(31 downto 0); -- .readdata
uav_writedata : in std_logic_vector(31 downto 0) := (others => '0'); -- .writedata
uav_lock : in std_logic := '0'; -- .lock
uav_debugaccess : in std_logic := '0'; -- .debugaccess
av_address : out std_logic_vector(3 downto 0); -- avalon_anti_slave_0.address
av_write : out std_logic; -- .write
av_read : out std_logic; -- .read
av_readdata : in std_logic_vector(31 downto 0) := (others => '0'); -- .readdata
av_writedata : out std_logic_vector(31 downto 0); -- .writedata
av_byteenable : out std_logic_vector(3 downto 0); -- .byteenable
av_waitrequest : in std_logic := '0'; -- .waitrequest
av_beginbursttransfer : out std_logic;
av_begintransfer : out std_logic;
av_burstcount : out std_logic_vector(0 downto 0);
av_chipselect : out std_logic;
av_clken : out std_logic;
av_debugaccess : out std_logic;
av_lock : out std_logic;
av_outputenable : out std_logic;
av_readdatavalid : in std_logic := '0';
av_response : in std_logic_vector(1 downto 0) := (others => '0');
av_writebyteenable : out std_logic_vector(3 downto 0);
av_writeresponserequest : out std_logic;
av_writeresponsevalid : in std_logic := '0';
uav_clken : in std_logic := '0';
uav_response : out std_logic_vector(1 downto 0);
uav_writeresponserequest : in std_logic := '0';
uav_writeresponsevalid : out std_logic
);
end entity cb20_gpio_block_0_avalon_slave_0_translator;
architecture rtl of cb20_gpio_block_0_avalon_slave_0_translator is
component altera_merlin_slave_translator is
generic (
AV_ADDRESS_W : integer := 30;
AV_DATA_W : integer := 32;
UAV_DATA_W : integer := 32;
AV_BURSTCOUNT_W : integer := 4;
AV_BYTEENABLE_W : integer := 4;
UAV_BYTEENABLE_W : integer := 4;
UAV_ADDRESS_W : integer := 32;
UAV_BURSTCOUNT_W : integer := 4;
AV_READLATENCY : integer := 0;
USE_READDATAVALID : integer := 1;
USE_WAITREQUEST : integer := 1;
USE_UAV_CLKEN : integer := 0;
USE_READRESPONSE : integer := 0;
USE_WRITERESPONSE : integer := 0;
AV_SYMBOLS_PER_WORD : integer := 4;
AV_ADDRESS_SYMBOLS : integer := 0;
AV_BURSTCOUNT_SYMBOLS : integer := 0;
AV_CONSTANT_BURST_BEHAVIOR : integer := 0;
UAV_CONSTANT_BURST_BEHAVIOR : integer := 0;
AV_REQUIRE_UNALIGNED_ADDRESSES : integer := 0;
CHIPSELECT_THROUGH_READLATENCY : integer := 0;
AV_READ_WAIT_CYCLES : integer := 0;
AV_WRITE_WAIT_CYCLES : integer := 0;
AV_SETUP_WAIT_CYCLES : integer := 0;
AV_DATA_HOLD_CYCLES : integer := 0
);
port (
clk : in std_logic := 'X'; -- clk
reset : in std_logic := 'X'; -- reset
uav_address : in std_logic_vector(16 downto 0) := (others => 'X'); -- address
uav_burstcount : in std_logic_vector(2 downto 0) := (others => 'X'); -- burstcount
uav_read : in std_logic := 'X'; -- read
uav_write : in std_logic := 'X'; -- write
uav_waitrequest : out std_logic; -- waitrequest
uav_readdatavalid : out std_logic; -- readdatavalid
uav_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
uav_readdata : out std_logic_vector(31 downto 0); -- readdata
uav_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
uav_lock : in std_logic := 'X'; -- lock
uav_debugaccess : in std_logic := 'X'; -- debugaccess
av_address : out std_logic_vector(3 downto 0); -- address
av_write : out std_logic; -- write
av_read : out std_logic; -- read
av_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
av_writedata : out std_logic_vector(31 downto 0); -- writedata
av_byteenable : out std_logic_vector(3 downto 0); -- byteenable
av_waitrequest : in std_logic := 'X'; -- waitrequest
av_begintransfer : out std_logic; -- begintransfer
av_beginbursttransfer : out std_logic; -- beginbursttransfer
av_burstcount : out std_logic_vector(0 downto 0); -- burstcount
av_readdatavalid : in std_logic := 'X'; -- readdatavalid
av_writebyteenable : out std_logic_vector(3 downto 0); -- writebyteenable
av_lock : out std_logic; -- lock
av_chipselect : out std_logic; -- chipselect
av_clken : out std_logic; -- clken
uav_clken : in std_logic := 'X'; -- clken
av_debugaccess : out std_logic; -- debugaccess
av_outputenable : out std_logic; -- outputenable
uav_response : out std_logic_vector(1 downto 0); -- response
av_response : in std_logic_vector(1 downto 0) := (others => 'X'); -- response
uav_writeresponserequest : in std_logic := 'X'; -- writeresponserequest
uav_writeresponsevalid : out std_logic; -- writeresponsevalid
av_writeresponserequest : out std_logic; -- writeresponserequest
av_writeresponsevalid : in std_logic := 'X' -- writeresponsevalid
);
end component altera_merlin_slave_translator;
begin
gpio_block_0_avalon_slave_0_translator : component altera_merlin_slave_translator
generic map (
AV_ADDRESS_W => AV_ADDRESS_W,
AV_DATA_W => AV_DATA_W,
UAV_DATA_W => UAV_DATA_W,
AV_BURSTCOUNT_W => AV_BURSTCOUNT_W,
AV_BYTEENABLE_W => AV_BYTEENABLE_W,
UAV_BYTEENABLE_W => UAV_BYTEENABLE_W,
UAV_ADDRESS_W => UAV_ADDRESS_W,
UAV_BURSTCOUNT_W => UAV_BURSTCOUNT_W,
AV_READLATENCY => AV_READLATENCY,
USE_READDATAVALID => USE_READDATAVALID,
USE_WAITREQUEST => USE_WAITREQUEST,
USE_UAV_CLKEN => USE_UAV_CLKEN,
USE_READRESPONSE => USE_READRESPONSE,
USE_WRITERESPONSE => USE_WRITERESPONSE,
AV_SYMBOLS_PER_WORD => AV_SYMBOLS_PER_WORD,
AV_ADDRESS_SYMBOLS => AV_ADDRESS_SYMBOLS,
AV_BURSTCOUNT_SYMBOLS => AV_BURSTCOUNT_SYMBOLS,
AV_CONSTANT_BURST_BEHAVIOR => AV_CONSTANT_BURST_BEHAVIOR,
UAV_CONSTANT_BURST_BEHAVIOR => UAV_CONSTANT_BURST_BEHAVIOR,
AV_REQUIRE_UNALIGNED_ADDRESSES => AV_REQUIRE_UNALIGNED_ADDRESSES,
CHIPSELECT_THROUGH_READLATENCY => CHIPSELECT_THROUGH_READLATENCY,
AV_READ_WAIT_CYCLES => AV_READ_WAIT_CYCLES,
AV_WRITE_WAIT_CYCLES => AV_WRITE_WAIT_CYCLES,
AV_SETUP_WAIT_CYCLES => AV_SETUP_WAIT_CYCLES,
AV_DATA_HOLD_CYCLES => AV_DATA_HOLD_CYCLES
)
port map (
clk => clk, -- clk.clk
reset => reset, -- reset.reset
uav_address => uav_address, -- avalon_universal_slave_0.address
uav_burstcount => uav_burstcount, -- .burstcount
uav_read => uav_read, -- .read
uav_write => uav_write, -- .write
uav_waitrequest => uav_waitrequest, -- .waitrequest
uav_readdatavalid => uav_readdatavalid, -- .readdatavalid
uav_byteenable => uav_byteenable, -- .byteenable
uav_readdata => uav_readdata, -- .readdata
uav_writedata => uav_writedata, -- .writedata
uav_lock => uav_lock, -- .lock
uav_debugaccess => uav_debugaccess, -- .debugaccess
av_address => av_address, -- avalon_anti_slave_0.address
av_write => av_write, -- .write
av_read => av_read, -- .read
av_readdata => av_readdata, -- .readdata
av_writedata => av_writedata, -- .writedata
av_byteenable => av_byteenable, -- .byteenable
av_waitrequest => av_waitrequest, -- .waitrequest
av_begintransfer => open, -- (terminated)
av_beginbursttransfer => open, -- (terminated)
av_burstcount => open, -- (terminated)
av_readdatavalid => '0', -- (terminated)
av_writebyteenable => open, -- (terminated)
av_lock => open, -- (terminated)
av_chipselect => open, -- (terminated)
av_clken => open, -- (terminated)
uav_clken => '0', -- (terminated)
av_debugaccess => open, -- (terminated)
av_outputenable => open, -- (terminated)
uav_response => open, -- (terminated)
av_response => "00", -- (terminated)
uav_writeresponserequest => '0', -- (terminated)
uav_writeresponsevalid => open, -- (terminated)
av_writeresponserequest => open, -- (terminated)
av_writeresponsevalid => '0' -- (terminated)
);
end architecture rtl; -- of cb20_gpio_block_0_avalon_slave_0_translator
| apache-2.0 | 656cfe8cc404b7aba1139cf29146be12 | 0.429711 | 4.335009 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb/vhdl_sim/token_crc_tb.vhd | 2 | 1,527 | -------------------------------------------------------------------------------
-- Title : token_crc.vhd
-------------------------------------------------------------------------------
-- File : token_crc.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: This file is used to calculate the CRC over a USB token
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity token_crc_tb is
end token_crc_tb;
architecture tb of token_crc_tb is
signal clock : std_logic := '0';
signal token_in : std_logic_vector(10 downto 0);
signal crc : std_logic_vector(4 downto 0);
signal total : std_logic_vector(15 downto 0);
begin
i_mut: entity work.usb1_token_crc
port map (
clock => clock,
sync => '1',
token_in => token_in,
crc => crc );
clock <= not clock after 10 ns;
p_test: process
begin
token_in <= "0001" & "0000001"; -- EP=1 / ADDR=1
wait until clock='1';
wait until clock='1';
wait until clock='1';
token_in <= "111" & X"FB";
wait until clock='1';
wait until clock='1';
wait until clock='1';
token_in <= "000" & X"01";
wait;
end process;
total <= crc & token_in;
end tb;
| gpl-3.0 | 5081a63117825895aab61410a650cffd | 0.413229 | 4.375358 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/free_queue/vhdl_sim/free_queue_tb.vhd | 1 | 6,253 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : free_queue_tb
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Quick test bench for free queue
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.io_bus_bfm_pkg.all;
use work.block_bus_pkg.all;
entity free_queue_tb is
end entity;
architecture test of free_queue_tb is
signal clock : std_logic := '0';
signal reset : std_logic;
signal alloc_req : std_logic := '0';
signal alloc_resp : t_alloc_resp;
signal used_req : t_used_req := c_used_req_init;
signal used_resp : std_logic;
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal io_irq : std_logic;
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_mut: entity work.free_queue
port map (
clock => clock,
reset => reset,
alloc_req => alloc_req,
alloc_resp => alloc_resp,
used_req => used_req,
used_resp => used_resp,
io_req => io_req,
io_resp => io_resp,
io_irq => io_irq
);
i_bfm: entity work.io_bus_bfm
generic map ("io")
port map (
clock => clock,
req => io_req,
resp => io_resp
);
process
variable io : p_io_bus_bfm_object;
variable v_id : integer;
variable data : std_logic_vector(7 downto 0);
variable data16 : std_logic_vector(15 downto 0);
procedure io_write_long(variable io : inout p_io_bus_bfm_object; addr : natural; data : std_logic_vector(31 downto 0)) is
begin
io_write(io, to_unsigned(addr+0, 20), data(07 downto 00));
io_write(io, to_unsigned(addr+1, 20), data(15 downto 08));
io_write(io, to_unsigned(addr+2, 20), data(23 downto 16));
io_write(io, to_unsigned(addr+3, 20), data(31 downto 24));
end procedure;
procedure io_write(variable io : inout p_io_bus_bfm_object; addr : natural; data : std_logic_vector(7 downto 0)) is
begin
io_write(io, to_unsigned(addr, 20), data);
end procedure;
procedure io_read(variable io : inout p_io_bus_bfm_object; addr : natural; data : out std_logic_vector(7 downto 0)) is
begin
io_read(io, to_unsigned(addr, 20), data);
end procedure;
procedure io_read_word(variable io : inout p_io_bus_bfm_object; addr : natural; data : out std_logic_vector(15 downto 0)) is
begin
io_read(io, to_unsigned(addr, 20), data(7 downto 0));
io_read(io, to_unsigned(addr+1, 20), data(15 downto 8));
end procedure;
procedure alloc is
begin
wait until clock = '1';
alloc_req <= '1';
wait until clock = '1';
while alloc_resp.done = '0' loop
wait until clock = '1';
end loop;
alloc_req <= '0';
end procedure;
procedure free(id : natural) is
begin
io_write(io, 4, std_logic_vector(to_unsigned(id, 8)));
end procedure;
procedure reset_queue is
begin
io_write(io, 14, X"01");
end procedure;
procedure used(id : natural; size: unsigned(11 downto 0)) is
begin
wait until clock = '1';
used_req.request <= '1';
used_req.id <= to_unsigned(id, 8);
used_req.bytes <= size;
wait until clock = '1';
while used_resp = '0' loop
wait until clock = '1';
end loop;
used_req.request <= '0';
end procedure;
begin
wait until reset = '0';
bind_io_bus_bfm("io", io);
io_write_long(io, 0, X"12345678");
free(17);
alloc;
v_id := to_integer(alloc_resp.id);
assert(v_id = 17) report "Unexpected ID";
assert(to_integer(alloc_resp.address) = (16#2345600# + v_id * 1536)) report "Unexpected address";
used(v_id, X"ABC");
wait until io_irq = '1';
io_read(io, 15, data);
assert data(0) = '1' report "Expected an allocated block to be available";
io_read(io, 8, data);
assert data = X"11" report "Expected allocated block to have ID 11";
io_read_word(io, 10, data16);
assert data16 = X"0ABC" report "Expected length to be 0xABC";
io_write(io, 15, X"00"); -- pop!
io_read(io, 15, data);
assert data(0) = '0' report "Expected no more allocated blocks to be available";
free(0); --add free block 00
alloc;
v_id := to_integer(alloc_resp.id);
assert(v_id = 0) report "Unexpected ID";
assert(to_integer(alloc_resp.address) = (16#2345600# + v_id * 1536)) report "Unexpected address";
alloc;
assert(alloc_resp.error = '1') report "Allocation should now fail";
-- check reset
free(55); --add free block
reset_queue;
alloc;
assert(alloc_resp.error = '1') report "Allocation should now fail";
--for i in 0 to 130 loop -- deliberately overwrite as depth = 128
for i in 0 to 126 loop
free(i);
end loop;
alloc; -- 0
alloc; -- 1
alloc; -- 2
alloc; -- 3
alloc; -- 4
v_id := to_integer(alloc_resp.id);
assert(v_id = 4) report "Unexpected ID";
for i in 0 to 4 loop
free(i);
end loop;
alloc; -- 5
alloc; -- 6
alloc; -- 7
alloc; -- 8
alloc; -- 9
v_id := to_integer(alloc_resp.id);
assert(v_id = 9) report "Unexpected ID";
wait;
end process;
end architecture;
| gpl-3.0 | ab0a1977de72413ff400ff11f7bf7bce | 0.504398 | 3.791995 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/rmii/vhdl_source/rmii_transceiver.vhd | 1 | 9,545 | -------------------------------------------------------------------------------
-- Title : rmii_transceiver
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Receiver / transmitter for RMII
-- TODO: Implement 10 Mbps mode
--
-- NOTE: The receive stream will include the FCS, and also an
-- additional byte, which indicates the correctness of the FCS.
-- This byte will be FF when correct and 00 when incorrect. It
-- coincides with eof. So CRC checking is done, CRC stripping is
-- not. The transmit path appends CRC after receiving the last
-- byte through the stream bus (thus after eof).
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity rmii_transceiver is
port (
clock : in std_logic; -- 50 MHz reference clock
reset : in std_logic;
rmii_crs_dv : in std_logic;
rmii_rxd : in std_logic_vector(1 downto 0);
rmii_tx_en : out std_logic;
rmii_txd : out std_logic_vector(1 downto 0);
-- stream bus alike interface to MAC
eth_rx_data : out std_logic_vector(7 downto 0);
eth_rx_sof : out std_logic;
eth_rx_eof : out std_logic;
eth_rx_valid : out std_logic;
eth_tx_data : in std_logic_vector(7 downto 0);
eth_tx_eof : in std_logic;
eth_tx_valid : in std_logic;
eth_tx_ready : out std_logic;
-- Mode switch
ten_meg_mode : in std_logic );
end entity;
architecture rtl of rmii_transceiver is
type t_state is (idle, preamble, data0, data1, data2, data3, crc, gap);
signal rx_state : t_state;
signal tx_state : t_state;
signal crs_dv : std_logic;
signal rxd : std_logic_vector(1 downto 0);
signal rx_valid : std_logic;
signal rx_first : std_logic;
signal rx_end : std_logic;
signal rx_shift : std_logic_vector(7 downto 0) := (others => '0');
signal bad_carrier : std_logic;
signal rx_crc_sync : std_logic;
signal rx_crc_dav : std_logic;
signal rx_crc_data : std_logic_vector(3 downto 0) := (others => '0');
signal rx_crc : std_logic_vector(31 downto 0);
signal crc_ok : std_logic;
signal tx_count : natural range 0 to 63;
signal tx_crc_dav : std_logic;
signal tx_crc_sync : std_logic;
signal tx_crc_data : std_logic_vector(1 downto 0);
signal tx_crc : std_logic_vector(31 downto 0);
begin
p_receive: process(clock)
begin
if rising_edge(clock) then
-- synchronize
crs_dv <= rmii_crs_dv;
rxd <= rmii_rxd;
bad_carrier <= '0';
rx_valid <= '0';
rx_end <= '0';
rx_crc_dav <= '0';
eth_rx_valid <= '0';
if rx_valid = '1' or rx_end = '1' then
eth_rx_eof <= rx_end;
eth_rx_sof <= rx_first;
if rx_end = '1' then
eth_rx_data <= (others => crc_ok);
else
eth_rx_data <= rx_shift;
end if;
eth_rx_valid <= '1';
rx_first <= '0';
end if;
case rx_state is
when idle =>
if crs_dv = '1' then
if rxd = "01" then
rx_state <= preamble;
elsif rxd = "10" then
bad_carrier <= '1';
end if;
end if;
when preamble =>
rx_first <= '1';
if crs_dv = '0' then
rx_state <= idle;
else -- dv = 1
if rxd = "11" then
rx_state <= data0;
elsif rxd = "01" then
rx_state <= preamble;
else
bad_carrier <= '1';
rx_state <= idle;
end if;
end if;
when data0 => -- crs_dv = CRS
rx_shift(1 downto 0) <= rxd;
rx_state <= data1;
when data1 => -- crs_dv = DV
rx_shift(3 downto 2) <= rxd;
rx_state <= data2;
if crs_dv = '0' then
rx_end <= '1';
rx_state <= idle;
else
rx_crc_dav <= '1';
rx_crc_data <= rxd & rx_shift(1 downto 0);
end if;
when data2 => -- crs_dv = CRS
rx_shift(5 downto 4) <= rxd;
rx_state <= data3;
when data3 => -- crs_dv = DV
rx_shift(7 downto 6) <= rxd;
rx_crc_dav <= '1';
rx_crc_data <= rxd & rx_shift(5 downto 4);
rx_state <= data0;
rx_valid <= '1';
when others =>
null;
end case;
if reset='1' then
eth_rx_sof <= '0';
eth_rx_eof <= '0';
eth_rx_data <= (others => '0');
rx_first <= '0';
rx_state <= idle;
end if;
end if;
end process;
rx_crc_sync <= '1' when rx_state = preamble else '0';
i_receive_crc: entity work.crc32
generic map (
g_data_width => 4
)
port map(
clock => clock,
clock_en => '1',
sync => rx_crc_sync,
data => rx_crc_data,
data_valid => rx_crc_dav,
crc => rx_crc
);
crc_ok <= '1' when (rx_crc = X"2144DF1C") else '0';
p_transmit: process(clock)
begin
if rising_edge(clock) then
case tx_state is
when idle =>
rmii_tx_en <= '0';
rmii_txd <= "00";
if eth_tx_valid = '1' then
tx_state <= preamble;
tx_count <= 13;
end if;
when preamble =>
rmii_tx_en <= '1';
if tx_count = 0 then
rmii_txd <= "11";
tx_state <= data0;
else
rmii_txd <= "01";
tx_count <= tx_count - 1;
end if;
when data0 =>
if eth_tx_valid = '0' then
tx_state <= idle;
rmii_tx_en <= '0';
rmii_txd <= "00";
else
rmii_tx_en <= '1';
rmii_txd <= eth_tx_data(1 downto 0);
tx_state <= data1;
end if;
when data1 =>
rmii_tx_en <= '1';
rmii_txd <= eth_tx_data(3 downto 2);
tx_state <= data2;
when data2 =>
rmii_tx_en <= '1';
rmii_txd <= eth_tx_data(5 downto 4);
tx_state <= data3;
when data3 =>
tx_count <= 15;
rmii_tx_en <= '1';
rmii_txd <= eth_tx_data(7 downto 6);
if eth_tx_eof = '1' then
tx_state <= crc;
else
tx_state <= data0;
end if;
when crc =>
rmii_tx_en <= '1';
rmii_txd <= tx_crc(31 - tx_count*2 downto 30 - tx_count*2);
if tx_count = 0 then
tx_count <= 63;
tx_state <= gap;
else
tx_count <= tx_count - 1;
end if;
when gap =>
rmii_tx_en <= '0';
rmii_txd <= "00";
if tx_count = 0 then
tx_state <= idle;
else
tx_count <= tx_count - 1;
end if;
when others =>
null;
end case;
if reset='1' then
rmii_tx_en <= '0';
rmii_txd <= "00";
tx_state <= idle;
end if;
end if;
end process;
eth_tx_ready <= '1' when tx_state = data3 else '0';
tx_crc_sync <= '1' when tx_state = preamble else '0';
with tx_state select tx_crc_data <=
eth_tx_data(1 downto 0) when data0,
eth_tx_data(3 downto 2) when data1,
eth_tx_data(5 downto 4) when data2,
eth_tx_data(7 downto 6) when data3,
"00" when others;
with tx_state select tx_crc_dav <=
'1' when data0 | data1 | data2 | data3,
'0' when others;
i_transmit_crc: entity work.crc32
generic map (
g_data_width => 2
)
port map(
clock => clock,
clock_en => '1',
sync => tx_crc_sync,
data => tx_crc_data,
data_valid => tx_crc_dav,
crc => tx_crc
);
end architecture;
| gpl-3.0 | 5f80a89c60789a73afbfa8bf8fbfa21a | 0.394866 | 4.159041 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/async_fifo/vhdl_source/async_fifo_ft.vhd | 1 | 12,675 | -------------------------------------------------------------------------------
-- Title : asynchronous fall-through fifo
-- Author : Gideon Zweijtzer ([email protected])
-------------------------------------------------------------------------------
-- Description: Asynchronous fifo for transfer of data between 2 clock domains
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.gray_code_pkg.all;
entity async_fifo_ft is
generic(
g_fast : boolean := true;
g_data_width : integer := 36;
g_depth_bits : integer := 9 -- depth = 2^depth_bits (9 == 512 words)
);
port (
-- write port signals (synchronized to write clock)
wr_clock : in std_logic;
wr_reset : in std_logic;
wr_en : in std_logic;
wr_din : in std_logic_vector(g_data_width-1 downto 0);
wr_full : out std_logic;
-- read port signals (synchronized to read clock)
rd_clock : in std_logic;
rd_reset : in std_logic;
rd_next : in std_logic;
rd_dout : out std_logic_vector(g_data_width-1 downto 0);
rd_valid : out std_logic );
---------------------------------------------------------------------------
-- synthesis attributes to prevent duplication and balancing.
---------------------------------------------------------------------------
-- Xilinx attributes
attribute register_duplication : string;
attribute register_duplication of async_fifo_ft : entity is "no";
-- Altera attributes
attribute dont_replicate : boolean;
attribute dont_replicate of async_fifo_ft : entity is true;
---------------------------------------------------------------------------
end entity;
architecture rtl of async_fifo_ft is
function iif(condition : boolean; if_true : std_logic; if_false : std_logic) return std_logic is
begin
if condition then
return if_true;
else
return if_false;
end if;
end function;
constant c_edge : std_logic := iif(g_fast, '0', '1');
---------------------------------------------------------------------------
-- constants
---------------------------------------------------------------------------
constant c_depth : natural := 2 ** g_depth_bits;
---------------------------------------------------------------------------
-- storage memory for the data
---------------------------------------------------------------------------
type t_mem is array (0 to c_depth-1) of std_logic_vector(g_data_width-1 downto 0);
signal mem : t_mem;
-- ---------------------------------------------------------------------------
-- -- synthesis attributes to for ram style
-- ---------------------------------------------------------------------------
-- -- Xilinx and Altera attributes
-- attribute ram_style : string;
-- attribute ramstyle : string;
-- attribute ram_style of mem : signal is g_storage;
-- attribute ramstyle of mem : signal is g_storage;
---------------------------------------------------------------------------
-- All signals (internal and external) are prefixed with rd or wr.
-- This indicates the clock-domain in which they are generated and used.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
-- Reset
---------------------------------------------------------------------------
signal aclr : std_logic;
signal aclr_wr : std_logic_vector(2 downto 0);
signal aclr_rd : std_logic_vector(2 downto 0);
signal rd_reset_i : std_logic;
signal wr_reset_i : std_logic;
---------------------------------------------------------------------------
-- Read and write pointers, both in both domains.
---------------------------------------------------------------------------
signal wr_head : unsigned(g_depth_bits-1 downto 0) := (others => '0');
signal wr_head_next : unsigned(g_depth_bits-1 downto 0) := (others => '0');
signal wr_tail : unsigned(g_depth_bits-1 downto 0) := (others => '0');
signal rd_tail : unsigned(g_depth_bits-1 downto 0) := (others => '0');
signal rd_tail_next : unsigned(g_depth_bits-1 downto 0) := (others => '0');
signal rd_head : unsigned(g_depth_bits-1 downto 0) := (others => '0');
---------------------------------------------------------------------------
-- temporaries
---------------------------------------------------------------------------
signal wr_head_gray_tig_src : t_gray(g_depth_bits-1 downto 0) := (others => '0');
signal rd_head_gray_tig_dst : t_gray(g_depth_bits-1 downto 0) := (others => '0');
signal rd_head_gray : t_gray(g_depth_bits-1 downto 0) := (others => '0');
signal rd_tail_gray_tig_src : t_gray(g_depth_bits-1 downto 0) := (others => '0');
signal wr_tail_gray_tig_dst : t_gray(g_depth_bits-1 downto 0) := (others => '0');
signal wr_tail_gray : t_gray(g_depth_bits-1 downto 0) := (others => '0');
---------------------------------------------------------------------------
-- internal flags
---------------------------------------------------------------------------
signal rd_empty_i : std_logic;
signal wr_full_i : std_logic;
signal rd_en_filt : std_logic;
signal wr_en_filt : std_logic;
begin
---------------------------------------------------------------------------
-- reset generation
---------------------------------------------------------------------------
aclr <= wr_reset or rd_reset;
process(wr_clock, aclr)
begin
if aclr = '1' then
aclr_wr <= (others => '0');
elsif rising_edge(wr_clock) then
aclr_wr <= '1' & aclr_wr(2 downto 1);
end if;
end process;
wr_reset_i <= not aclr_wr(0);
process(rd_clock, aclr)
begin
if aclr = '1' then
aclr_rd <= (others => '0');
elsif rising_edge(rd_clock) then
aclr_rd <= '1' & aclr_rd(2 downto 1);
end if;
end process;
rd_reset_i <= not aclr_rd(0);
---------------------------------------------------------------------------
-- filtered read and write enable
---------------------------------------------------------------------------
rd_en_filt <= rd_next and not rd_empty_i;
wr_en_filt <= wr_en and not wr_full_i;
---------------------------------------------------------------------------
-- write data process
---------------------------------------------------------------------------
process(wr_en_filt, wr_head)
begin
wr_head_next <= wr_head;
if wr_en_filt = '1' then
wr_head_next <= wr_head + 1;
end if;
end process;
p_write : process(wr_clock)
begin
if rising_edge(wr_clock) then
if wr_en_filt = '1' then
mem(to_integer(wr_head)) <= wr_din;
end if;
if wr_reset_i = '1' then
wr_head <= (others => '0');
else
wr_head <= wr_head_next;
end if;
end if;
end process;
---------------------------------------------------------------------------
-- read data process
---------------------------------------------------------------------------
process(rd_en_filt, rd_tail)
begin
rd_tail_next <= rd_tail;
if rd_en_filt = '1' then
rd_tail_next <= rd_tail + 1;
end if;
end process;
p_read : process(rd_clock)
begin
if rising_edge(rd_clock) then
rd_dout <= mem(to_integer(unsigned(rd_tail_next)));
if rd_reset_i = '1' then
rd_tail <= (others => '0');
else
rd_tail <= rd_tail_next;
end if;
end if;
end process;
---------------------------------------------------------------------------
-- synchronize pointers to the other side
---------------------------------------------------------------------------
p_wr_sync: process(wr_clock)
begin
if rising_edge(wr_clock) then
-- second flop. We are now stable
wr_tail_gray <= wr_tail_gray_tig_dst;
-- conversion to binary may infer a longer xor chain, so we use a whole clock cycle here.
wr_tail <= to_unsigned(wr_tail_gray);
end if;
if wr_clock'event and wr_clock = c_edge then
-- conversion from binary to gray is very fast (one xor), so we will win some time
-- by using the falling edge (if c_edge = '0')
wr_head_gray_tig_src <= to_gray(wr_head);
-- two synchronization flipflops after one another is good for metastability
-- but bad for latency, so we use a falling edge flop for the first stage (if c_edge = '0')
wr_tail_gray_tig_dst <= rd_tail_gray_tig_src;
end if;
end process;
p_rd_sync: process(rd_clock)
begin
if rising_edge(rd_clock) then
-- second flop. We are now stable
rd_head_gray <= rd_head_gray_tig_dst;
-- conversion to binary may infer a longer xor chain, so we use a whole clock cycle here.
rd_head <= to_unsigned(rd_head_gray);
end if;
if rd_clock'event and rd_clock = c_edge then
-- two synchronization flipflops after one another is good for metastability
-- but bad for latency, so we use a falling edge flop for the first stage (if c_edge = '0')
rd_head_gray_tig_dst <= wr_head_gray_tig_src;
-- conversion from binary to gray is very fast (one xor), so we will win some time
-- by using the falling edge (if c_edge = '0')
rd_tail_gray_tig_src <= to_gray(rd_tail);
end if;
end process;
---------------------------------------------------------------------------
-- read empty generation
---------------------------------------------------------------------------
p_proc_read_count : process (rd_clock)
variable v_next_count : unsigned(rd_head'range);
begin
if rising_edge(rd_clock) then
v_next_count := rd_head - rd_tail_next;
if v_next_count = 0 then
rd_empty_i <= '1';
else
rd_empty_i <= '0';
end if;
-------------------------------------------------------------------
-- synchronous reset
-------------------------------------------------------------------
if rd_reset_i = '1' then
rd_empty_i <= '1';
end if;
end if;
end process;
---------------------------------------------------------------------------
-- write full generation
---------------------------------------------------------------------------
p_proc_write_count : process (wr_clock, wr_reset_i)
variable v_next_count : unsigned(wr_tail'range);
begin
if rising_edge(wr_clock) then
v_next_count := wr_head_next - wr_tail;
if signed(v_next_count) = -1 then
wr_full_i <= '1';
else
wr_full_i <= '0';
end if;
end if;
-------------------------------------------------------------------
-- asynchronous reset
-------------------------------------------------------------------
if wr_reset_i = '1' then
wr_full_i <= '1';
end if;
end process;
---------------------------------------------------------------------------
-- fifo status output signals
---------------------------------------------------------------------------
rd_valid <= not rd_empty_i;
wr_full <= wr_full_i;
end rtl;
| gpl-3.0 | 33cd67a978074a2828e7590c9a6ed369 | 0.385404 | 4.88816 | false | false | false | false |
markusC64/1541ultimate2 | fpga/nios_c5/nios/synthesis/nios.vhd | 1 | 82,379 | -- nios.vhd
-- Generated using ACDS version 15.1 185
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity nios is
port (
clk50_clk : in std_logic := '0'; -- clk50.clk
io_ack : in std_logic := '0'; -- io.ack
io_rdata : in std_logic_vector(7 downto 0) := (others => '0'); -- .rdata
io_read : out std_logic; -- .read
io_wdata : out std_logic_vector(7 downto 0); -- .wdata
io_write : out std_logic; -- .write
io_address : out std_logic_vector(19 downto 0); -- .address
io_irq : in std_logic := '0'; -- .irq
mem32_address : in std_logic_vector(25 downto 0) := (others => '0'); -- mem32.address
mem32_direction : in std_logic := '0'; -- .direction
mem32_byte_en : in std_logic_vector(3 downto 0) := (others => '0'); -- .byte_en
mem32_wdata : in std_logic_vector(31 downto 0) := (others => '0'); -- .wdata
mem32_request : in std_logic := '0'; -- .request
mem32_tag : in std_logic_vector(7 downto 0) := (others => '0'); -- .tag
mem32_dack_tag : out std_logic_vector(7 downto 0); -- .dack_tag
mem32_rdata : out std_logic_vector(31 downto 0); -- .rdata
mem32_rack : out std_logic; -- .rack
mem32_rack_tag : out std_logic_vector(7 downto 0); -- .rack_tag
memory_mem_a : out std_logic_vector(13 downto 0); -- memory.mem_a
memory_mem_ba : out std_logic_vector(1 downto 0); -- .mem_ba
memory_mem_ck : out std_logic_vector(0 downto 0); -- .mem_ck
memory_mem_ck_n : out std_logic_vector(0 downto 0); -- .mem_ck_n
memory_mem_cke : out std_logic_vector(0 downto 0); -- .mem_cke
memory_mem_cs_n : out std_logic_vector(0 downto 0); -- .mem_cs_n
memory_mem_dm : out std_logic_vector(0 downto 0); -- .mem_dm
memory_mem_ras_n : out std_logic_vector(0 downto 0); -- .mem_ras_n
memory_mem_cas_n : out std_logic_vector(0 downto 0); -- .mem_cas_n
memory_mem_we_n : out std_logic_vector(0 downto 0); -- .mem_we_n
memory_mem_dq : inout std_logic_vector(7 downto 0) := (others => '0'); -- .mem_dq
memory_mem_dqs : inout std_logic_vector(0 downto 0) := (others => '0'); -- .mem_dqs
memory_mem_dqs_n : inout std_logic_vector(0 downto 0) := (others => '0'); -- .mem_dqs_n
memory_mem_odt : out std_logic_vector(0 downto 0); -- .mem_odt
oct_rzqin : in std_logic := '0'; -- oct.rzqin
pio_in_port : in std_logic_vector(31 downto 0) := (others => '0'); -- pio.in_port
pio_out_port : out std_logic_vector(31 downto 0); -- .out_port
reset_reset_n : in std_logic := '0'; -- reset.reset_n
status_local_init_done : out std_logic; -- status.local_init_done
status_local_cal_success : out std_logic; -- .local_cal_success
status_local_cal_fail : out std_logic; -- .local_cal_fail
sys_clock_clk : out std_logic; -- sys_clock.clk
sys_reset_reset_n : out std_logic -- sys_reset.reset_n
);
end entity nios;
architecture rtl of nios is
component avalon_to_io_bridge is
port (
reset : in std_logic := 'X'; -- reset
avs_read : in std_logic := 'X'; -- read
avs_write : in std_logic := 'X'; -- write
avs_address : in std_logic_vector(19 downto 0) := (others => 'X'); -- address
avs_writedata : in std_logic_vector(7 downto 0) := (others => 'X'); -- writedata
avs_ready : out std_logic; -- waitrequest_n
avs_readdata : out std_logic_vector(7 downto 0); -- readdata
avs_readdatavalid : out std_logic; -- readdatavalid
clock : in std_logic := 'X'; -- clk
io_ack : in std_logic := 'X'; -- ack
io_rdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- rdata
io_read : out std_logic; -- read
io_wdata : out std_logic_vector(7 downto 0); -- wdata
io_write : out std_logic; -- write
io_address : out std_logic_vector(19 downto 0); -- address
io_irq : in std_logic := 'X'; -- irq
avs_irq : out std_logic -- irq
);
end component avalon_to_io_bridge;
component mem32_to_avalon_bridge is
port (
reset : in std_logic := 'X'; -- reset
clock : in std_logic := 'X'; -- clk
memreq_address : in std_logic_vector(25 downto 0) := (others => 'X'); -- address
memreq_read_writen : in std_logic := 'X'; -- direction
memreq_byte_en : in std_logic_vector(3 downto 0) := (others => 'X'); -- byte_en
memreq_data : in std_logic_vector(31 downto 0) := (others => 'X'); -- wdata
memreq_request : in std_logic := 'X'; -- request
memreq_tag : in std_logic_vector(7 downto 0) := (others => 'X'); -- tag
memresp_dack_tag : out std_logic_vector(7 downto 0); -- dack_tag
memresp_data : out std_logic_vector(31 downto 0); -- rdata
memresp_rack : out std_logic; -- rack
memresp_rack_tag : out std_logic_vector(7 downto 0); -- rack_tag
avm_read : out std_logic; -- read
avm_write : out std_logic; -- write
avm_address : out std_logic_vector(25 downto 0); -- address
avm_writedata : out std_logic_vector(31 downto 0); -- writedata
avm_byte_enable : out std_logic_vector(3 downto 0); -- byteenable
avm_ready : in std_logic := 'X'; -- waitrequest_n
avm_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
avm_readdatavalid : in std_logic := 'X' -- readdatavalid
);
end component mem32_to_avalon_bridge;
component nios_mem_if_ddr2_emif_0 is
port (
pll_ref_clk : in std_logic := 'X'; -- clk
global_reset_n : in std_logic := 'X'; -- reset_n
soft_reset_n : in std_logic := 'X'; -- reset_n
afi_clk : out std_logic; -- clk
afi_half_clk : out std_logic; -- clk
afi_reset_n : out std_logic; -- reset_n
afi_reset_export_n : out std_logic; -- reset_n
mem_a : out std_logic_vector(13 downto 0); -- mem_a
mem_ba : out std_logic_vector(1 downto 0); -- mem_ba
mem_ck : out std_logic_vector(0 downto 0); -- mem_ck
mem_ck_n : out std_logic_vector(0 downto 0); -- mem_ck_n
mem_cke : out std_logic_vector(0 downto 0); -- mem_cke
mem_cs_n : out std_logic_vector(0 downto 0); -- mem_cs_n
mem_dm : out std_logic_vector(0 downto 0); -- mem_dm
mem_ras_n : out std_logic_vector(0 downto 0); -- mem_ras_n
mem_cas_n : out std_logic_vector(0 downto 0); -- mem_cas_n
mem_we_n : out std_logic_vector(0 downto 0); -- mem_we_n
mem_dq : inout std_logic_vector(7 downto 0) := (others => 'X'); -- mem_dq
mem_dqs : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_dqs
mem_dqs_n : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_dqs_n
mem_odt : out std_logic_vector(0 downto 0); -- mem_odt
avl_ready : out std_logic; -- waitrequest_n
avl_burstbegin : in std_logic := 'X'; -- beginbursttransfer
avl_addr : in std_logic_vector(23 downto 0) := (others => 'X'); -- address
avl_rdata_valid : out std_logic; -- readdatavalid
avl_rdata : out std_logic_vector(31 downto 0); -- readdata
avl_wdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
avl_be : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
avl_read_req : in std_logic := 'X'; -- read
avl_write_req : in std_logic := 'X'; -- write
avl_size : in std_logic_vector(2 downto 0) := (others => 'X'); -- burstcount
local_init_done : out std_logic; -- local_init_done
local_cal_success : out std_logic; -- local_cal_success
local_cal_fail : out std_logic; -- local_cal_fail
oct_rzqin : in std_logic := 'X' -- rzqin
);
end component nios_mem_if_ddr2_emif_0;
component nios_nios2_gen2_0 is
port (
clk : in std_logic := 'X'; -- clk
reset_n : in std_logic := 'X'; -- reset_n
reset_req : in std_logic := 'X'; -- reset_req
d_address : out std_logic_vector(28 downto 0); -- address
d_byteenable : out std_logic_vector(3 downto 0); -- byteenable
d_read : out std_logic; -- read
d_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
d_waitrequest : in std_logic := 'X'; -- waitrequest
d_write : out std_logic; -- write
d_writedata : out std_logic_vector(31 downto 0); -- writedata
debug_mem_slave_debugaccess_to_roms : out std_logic; -- debugaccess
i_address : out std_logic_vector(28 downto 0); -- address
i_read : out std_logic; -- read
i_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
i_waitrequest : in std_logic := 'X'; -- waitrequest
irq : in std_logic_vector(31 downto 0) := (others => 'X'); -- irq
debug_reset_request : out std_logic; -- reset
debug_mem_slave_address : in std_logic_vector(8 downto 0) := (others => 'X'); -- address
debug_mem_slave_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
debug_mem_slave_debugaccess : in std_logic := 'X'; -- debugaccess
debug_mem_slave_read : in std_logic := 'X'; -- read
debug_mem_slave_readdata : out std_logic_vector(31 downto 0); -- readdata
debug_mem_slave_waitrequest : out std_logic; -- waitrequest
debug_mem_slave_write : in std_logic := 'X'; -- write
debug_mem_slave_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
dummy_ci_port : out std_logic -- readra
);
end component nios_nios2_gen2_0;
component nios_pio_0 is
port (
clk : in std_logic := 'X'; -- clk
reset_n : in std_logic := 'X'; -- reset_n
address : in std_logic_vector(2 downto 0) := (others => 'X'); -- address
write_n : in std_logic := 'X'; -- write_n
writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
chipselect : in std_logic := 'X'; -- chipselect
readdata : out std_logic_vector(31 downto 0); -- readdata
in_port : in std_logic_vector(31 downto 0) := (others => 'X'); -- export
out_port : out std_logic_vector(31 downto 0); -- export
irq : out std_logic -- irq
);
end component nios_pio_0;
component nios_mm_interconnect_0 is
port (
mem_if_ddr2_emif_0_afi_clk_clk : in std_logic := 'X'; -- clk
mem32_to_avalon_0_reset_reset_bridge_in_reset_reset : in std_logic := 'X'; -- reset
mem_if_ddr2_emif_0_avl_translator_reset_reset_bridge_in_reset_reset : in std_logic := 'X'; -- reset
mem_if_ddr2_emif_0_soft_reset_reset_bridge_in_reset_reset : in std_logic := 'X'; -- reset
nios2_gen2_0_reset_reset_bridge_in_reset_reset : in std_logic := 'X'; -- reset
mem32_to_avalon_0_avalon_master_address : in std_logic_vector(25 downto 0) := (others => 'X'); -- address
mem32_to_avalon_0_avalon_master_waitrequest : out std_logic; -- waitrequest
mem32_to_avalon_0_avalon_master_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
mem32_to_avalon_0_avalon_master_read : in std_logic := 'X'; -- read
mem32_to_avalon_0_avalon_master_readdata : out std_logic_vector(31 downto 0); -- readdata
mem32_to_avalon_0_avalon_master_readdatavalid : out std_logic; -- readdatavalid
mem32_to_avalon_0_avalon_master_write : in std_logic := 'X'; -- write
mem32_to_avalon_0_avalon_master_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
nios2_gen2_0_data_master_address : in std_logic_vector(28 downto 0) := (others => 'X'); -- address
nios2_gen2_0_data_master_waitrequest : out std_logic; -- waitrequest
nios2_gen2_0_data_master_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
nios2_gen2_0_data_master_read : in std_logic := 'X'; -- read
nios2_gen2_0_data_master_readdata : out std_logic_vector(31 downto 0); -- readdata
nios2_gen2_0_data_master_write : in std_logic := 'X'; -- write
nios2_gen2_0_data_master_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
nios2_gen2_0_data_master_debugaccess : in std_logic := 'X'; -- debugaccess
nios2_gen2_0_instruction_master_address : in std_logic_vector(28 downto 0) := (others => 'X'); -- address
nios2_gen2_0_instruction_master_waitrequest : out std_logic; -- waitrequest
nios2_gen2_0_instruction_master_read : in std_logic := 'X'; -- read
nios2_gen2_0_instruction_master_readdata : out std_logic_vector(31 downto 0); -- readdata
io_bridge_0_avalon_slave_0_address : out std_logic_vector(19 downto 0); -- address
io_bridge_0_avalon_slave_0_write : out std_logic; -- write
io_bridge_0_avalon_slave_0_read : out std_logic; -- read
io_bridge_0_avalon_slave_0_readdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- readdata
io_bridge_0_avalon_slave_0_writedata : out std_logic_vector(7 downto 0); -- writedata
io_bridge_0_avalon_slave_0_readdatavalid : in std_logic := 'X'; -- readdatavalid
io_bridge_0_avalon_slave_0_waitrequest : in std_logic := 'X'; -- waitrequest
mem_if_ddr2_emif_0_avl_address : out std_logic_vector(23 downto 0); -- address
mem_if_ddr2_emif_0_avl_write : out std_logic; -- write
mem_if_ddr2_emif_0_avl_read : out std_logic; -- read
mem_if_ddr2_emif_0_avl_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
mem_if_ddr2_emif_0_avl_writedata : out std_logic_vector(31 downto 0); -- writedata
mem_if_ddr2_emif_0_avl_beginbursttransfer : out std_logic; -- beginbursttransfer
mem_if_ddr2_emif_0_avl_burstcount : out std_logic_vector(2 downto 0); -- burstcount
mem_if_ddr2_emif_0_avl_byteenable : out std_logic_vector(3 downto 0); -- byteenable
mem_if_ddr2_emif_0_avl_readdatavalid : in std_logic := 'X'; -- readdatavalid
mem_if_ddr2_emif_0_avl_waitrequest : in std_logic := 'X'; -- waitrequest
nios2_gen2_0_debug_mem_slave_address : out std_logic_vector(8 downto 0); -- address
nios2_gen2_0_debug_mem_slave_write : out std_logic; -- write
nios2_gen2_0_debug_mem_slave_read : out std_logic; -- read
nios2_gen2_0_debug_mem_slave_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
nios2_gen2_0_debug_mem_slave_writedata : out std_logic_vector(31 downto 0); -- writedata
nios2_gen2_0_debug_mem_slave_byteenable : out std_logic_vector(3 downto 0); -- byteenable
nios2_gen2_0_debug_mem_slave_waitrequest : in std_logic := 'X'; -- waitrequest
nios2_gen2_0_debug_mem_slave_debugaccess : out std_logic; -- debugaccess
pio_0_s1_address : out std_logic_vector(2 downto 0); -- address
pio_0_s1_write : out std_logic; -- write
pio_0_s1_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
pio_0_s1_writedata : out std_logic_vector(31 downto 0); -- writedata
pio_0_s1_chipselect : out std_logic -- chipselect
);
end component nios_mm_interconnect_0;
component nios_irq_mapper is
port (
clk : in std_logic := 'X'; -- clk
reset : in std_logic := 'X'; -- reset
receiver0_irq : in std_logic := 'X'; -- irq
receiver1_irq : in std_logic := 'X'; -- irq
sender_irq : out std_logic_vector(31 downto 0) -- irq
);
end component nios_irq_mapper;
component nios_rst_controller is
generic (
NUM_RESET_INPUTS : integer := 6;
OUTPUT_RESET_SYNC_EDGES : string := "deassert";
SYNC_DEPTH : integer := 2;
RESET_REQUEST_PRESENT : integer := 0;
RESET_REQ_WAIT_TIME : integer := 1;
MIN_RST_ASSERTION_TIME : integer := 3;
RESET_REQ_EARLY_DSRT_TIME : integer := 1;
USE_RESET_REQUEST_IN0 : integer := 0;
USE_RESET_REQUEST_IN1 : integer := 0;
USE_RESET_REQUEST_IN2 : integer := 0;
USE_RESET_REQUEST_IN3 : integer := 0;
USE_RESET_REQUEST_IN4 : integer := 0;
USE_RESET_REQUEST_IN5 : integer := 0;
USE_RESET_REQUEST_IN6 : integer := 0;
USE_RESET_REQUEST_IN7 : integer := 0;
USE_RESET_REQUEST_IN8 : integer := 0;
USE_RESET_REQUEST_IN9 : integer := 0;
USE_RESET_REQUEST_IN10 : integer := 0;
USE_RESET_REQUEST_IN11 : integer := 0;
USE_RESET_REQUEST_IN12 : integer := 0;
USE_RESET_REQUEST_IN13 : integer := 0;
USE_RESET_REQUEST_IN14 : integer := 0;
USE_RESET_REQUEST_IN15 : integer := 0;
ADAPT_RESET_REQUEST : integer := 0
);
port (
reset_in0 : in std_logic := 'X'; -- reset
reset_in1 : in std_logic := 'X'; -- reset
clk : in std_logic := 'X'; -- clk
reset_out : out std_logic; -- reset
reset_req : out std_logic; -- reset_req
reset_req_in0 : in std_logic := 'X'; -- reset_req
reset_req_in1 : in std_logic := 'X'; -- reset_req
reset_in2 : in std_logic := 'X'; -- reset
reset_req_in2 : in std_logic := 'X'; -- reset_req
reset_in3 : in std_logic := 'X'; -- reset
reset_req_in3 : in std_logic := 'X'; -- reset_req
reset_in4 : in std_logic := 'X'; -- reset
reset_req_in4 : in std_logic := 'X'; -- reset_req
reset_in5 : in std_logic := 'X'; -- reset
reset_req_in5 : in std_logic := 'X'; -- reset_req
reset_in6 : in std_logic := 'X'; -- reset
reset_req_in6 : in std_logic := 'X'; -- reset_req
reset_in7 : in std_logic := 'X'; -- reset
reset_req_in7 : in std_logic := 'X'; -- reset_req
reset_in8 : in std_logic := 'X'; -- reset
reset_req_in8 : in std_logic := 'X'; -- reset_req
reset_in9 : in std_logic := 'X'; -- reset
reset_req_in9 : in std_logic := 'X'; -- reset_req
reset_in10 : in std_logic := 'X'; -- reset
reset_req_in10 : in std_logic := 'X'; -- reset_req
reset_in11 : in std_logic := 'X'; -- reset
reset_req_in11 : in std_logic := 'X'; -- reset_req
reset_in12 : in std_logic := 'X'; -- reset
reset_req_in12 : in std_logic := 'X'; -- reset_req
reset_in13 : in std_logic := 'X'; -- reset
reset_req_in13 : in std_logic := 'X'; -- reset_req
reset_in14 : in std_logic := 'X'; -- reset
reset_req_in14 : in std_logic := 'X'; -- reset_req
reset_in15 : in std_logic := 'X'; -- reset
reset_req_in15 : in std_logic := 'X' -- reset_req
);
end component nios_rst_controller;
component nios_rst_controller_001 is
generic (
NUM_RESET_INPUTS : integer := 6;
OUTPUT_RESET_SYNC_EDGES : string := "deassert";
SYNC_DEPTH : integer := 2;
RESET_REQUEST_PRESENT : integer := 0;
RESET_REQ_WAIT_TIME : integer := 1;
MIN_RST_ASSERTION_TIME : integer := 3;
RESET_REQ_EARLY_DSRT_TIME : integer := 1;
USE_RESET_REQUEST_IN0 : integer := 0;
USE_RESET_REQUEST_IN1 : integer := 0;
USE_RESET_REQUEST_IN2 : integer := 0;
USE_RESET_REQUEST_IN3 : integer := 0;
USE_RESET_REQUEST_IN4 : integer := 0;
USE_RESET_REQUEST_IN5 : integer := 0;
USE_RESET_REQUEST_IN6 : integer := 0;
USE_RESET_REQUEST_IN7 : integer := 0;
USE_RESET_REQUEST_IN8 : integer := 0;
USE_RESET_REQUEST_IN9 : integer := 0;
USE_RESET_REQUEST_IN10 : integer := 0;
USE_RESET_REQUEST_IN11 : integer := 0;
USE_RESET_REQUEST_IN12 : integer := 0;
USE_RESET_REQUEST_IN13 : integer := 0;
USE_RESET_REQUEST_IN14 : integer := 0;
USE_RESET_REQUEST_IN15 : integer := 0;
ADAPT_RESET_REQUEST : integer := 0
);
port (
reset_in0 : in std_logic := 'X'; -- reset
clk : in std_logic := 'X'; -- clk
reset_out : out std_logic; -- reset
reset_req : out std_logic; -- reset_req
reset_req_in0 : in std_logic := 'X'; -- reset_req
reset_in1 : in std_logic := 'X'; -- reset
reset_req_in1 : in std_logic := 'X'; -- reset_req
reset_in2 : in std_logic := 'X'; -- reset
reset_req_in2 : in std_logic := 'X'; -- reset_req
reset_in3 : in std_logic := 'X'; -- reset
reset_req_in3 : in std_logic := 'X'; -- reset_req
reset_in4 : in std_logic := 'X'; -- reset
reset_req_in4 : in std_logic := 'X'; -- reset_req
reset_in5 : in std_logic := 'X'; -- reset
reset_req_in5 : in std_logic := 'X'; -- reset_req
reset_in6 : in std_logic := 'X'; -- reset
reset_req_in6 : in std_logic := 'X'; -- reset_req
reset_in7 : in std_logic := 'X'; -- reset
reset_req_in7 : in std_logic := 'X'; -- reset_req
reset_in8 : in std_logic := 'X'; -- reset
reset_req_in8 : in std_logic := 'X'; -- reset_req
reset_in9 : in std_logic := 'X'; -- reset
reset_req_in9 : in std_logic := 'X'; -- reset_req
reset_in10 : in std_logic := 'X'; -- reset
reset_req_in10 : in std_logic := 'X'; -- reset_req
reset_in11 : in std_logic := 'X'; -- reset
reset_req_in11 : in std_logic := 'X'; -- reset_req
reset_in12 : in std_logic := 'X'; -- reset
reset_req_in12 : in std_logic := 'X'; -- reset_req
reset_in13 : in std_logic := 'X'; -- reset
reset_req_in13 : in std_logic := 'X'; -- reset_req
reset_in14 : in std_logic := 'X'; -- reset
reset_req_in14 : in std_logic := 'X'; -- reset_req
reset_in15 : in std_logic := 'X'; -- reset
reset_req_in15 : in std_logic := 'X' -- reset_req
);
end component nios_rst_controller_001;
component nios_rst_controller_002 is
generic (
NUM_RESET_INPUTS : integer := 6;
OUTPUT_RESET_SYNC_EDGES : string := "deassert";
SYNC_DEPTH : integer := 2;
RESET_REQUEST_PRESENT : integer := 0;
RESET_REQ_WAIT_TIME : integer := 1;
MIN_RST_ASSERTION_TIME : integer := 3;
RESET_REQ_EARLY_DSRT_TIME : integer := 1;
USE_RESET_REQUEST_IN0 : integer := 0;
USE_RESET_REQUEST_IN1 : integer := 0;
USE_RESET_REQUEST_IN2 : integer := 0;
USE_RESET_REQUEST_IN3 : integer := 0;
USE_RESET_REQUEST_IN4 : integer := 0;
USE_RESET_REQUEST_IN5 : integer := 0;
USE_RESET_REQUEST_IN6 : integer := 0;
USE_RESET_REQUEST_IN7 : integer := 0;
USE_RESET_REQUEST_IN8 : integer := 0;
USE_RESET_REQUEST_IN9 : integer := 0;
USE_RESET_REQUEST_IN10 : integer := 0;
USE_RESET_REQUEST_IN11 : integer := 0;
USE_RESET_REQUEST_IN12 : integer := 0;
USE_RESET_REQUEST_IN13 : integer := 0;
USE_RESET_REQUEST_IN14 : integer := 0;
USE_RESET_REQUEST_IN15 : integer := 0;
ADAPT_RESET_REQUEST : integer := 0
);
port (
reset_in0 : in std_logic := 'X'; -- reset
clk : in std_logic := 'X'; -- clk
reset_out : out std_logic; -- reset
reset_req : out std_logic; -- reset_req
reset_req_in0 : in std_logic := 'X'; -- reset_req
reset_in1 : in std_logic := 'X'; -- reset
reset_req_in1 : in std_logic := 'X'; -- reset_req
reset_in2 : in std_logic := 'X'; -- reset
reset_req_in2 : in std_logic := 'X'; -- reset_req
reset_in3 : in std_logic := 'X'; -- reset
reset_req_in3 : in std_logic := 'X'; -- reset_req
reset_in4 : in std_logic := 'X'; -- reset
reset_req_in4 : in std_logic := 'X'; -- reset_req
reset_in5 : in std_logic := 'X'; -- reset
reset_req_in5 : in std_logic := 'X'; -- reset_req
reset_in6 : in std_logic := 'X'; -- reset
reset_req_in6 : in std_logic := 'X'; -- reset_req
reset_in7 : in std_logic := 'X'; -- reset
reset_req_in7 : in std_logic := 'X'; -- reset_req
reset_in8 : in std_logic := 'X'; -- reset
reset_req_in8 : in std_logic := 'X'; -- reset_req
reset_in9 : in std_logic := 'X'; -- reset
reset_req_in9 : in std_logic := 'X'; -- reset_req
reset_in10 : in std_logic := 'X'; -- reset
reset_req_in10 : in std_logic := 'X'; -- reset_req
reset_in11 : in std_logic := 'X'; -- reset
reset_req_in11 : in std_logic := 'X'; -- reset_req
reset_in12 : in std_logic := 'X'; -- reset
reset_req_in12 : in std_logic := 'X'; -- reset_req
reset_in13 : in std_logic := 'X'; -- reset
reset_req_in13 : in std_logic := 'X'; -- reset_req
reset_in14 : in std_logic := 'X'; -- reset
reset_req_in14 : in std_logic := 'X'; -- reset_req
reset_in15 : in std_logic := 'X'; -- reset
reset_req_in15 : in std_logic := 'X' -- reset_req
);
end component nios_rst_controller_002;
signal mem_if_ddr2_emif_0_afi_clk_clk : std_logic; -- mem_if_ddr2_emif_0:afi_clk -> [sys_clock_clk, io_bridge_0:clock, irq_mapper:clk, mem32_to_avalon_0:clock, mm_interconnect_0:mem_if_ddr2_emif_0_afi_clk_clk, nios2_gen2_0:clk, pio_0:clk, rst_controller:clk, rst_controller_001:clk, rst_controller_002:clk]
signal mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest : std_logic; -- mm_interconnect_0:mem32_to_avalon_0_avalon_master_waitrequest -> mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest:in
signal mem32_to_avalon_0_avalon_master_readdata : std_logic_vector(31 downto 0); -- mm_interconnect_0:mem32_to_avalon_0_avalon_master_readdata -> mem32_to_avalon_0:avm_readdata
signal mem32_to_avalon_0_avalon_master_read : std_logic; -- mem32_to_avalon_0:avm_read -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_read
signal mem32_to_avalon_0_avalon_master_address : std_logic_vector(25 downto 0); -- mem32_to_avalon_0:avm_address -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_address
signal mem32_to_avalon_0_avalon_master_byteenable : std_logic_vector(3 downto 0); -- mem32_to_avalon_0:avm_byte_enable -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_byteenable
signal mem32_to_avalon_0_avalon_master_readdatavalid : std_logic; -- mm_interconnect_0:mem32_to_avalon_0_avalon_master_readdatavalid -> mem32_to_avalon_0:avm_readdatavalid
signal mem32_to_avalon_0_avalon_master_write : std_logic; -- mem32_to_avalon_0:avm_write -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_write
signal mem32_to_avalon_0_avalon_master_writedata : std_logic_vector(31 downto 0); -- mem32_to_avalon_0:avm_writedata -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_writedata
signal nios2_gen2_0_data_master_readdata : std_logic_vector(31 downto 0); -- mm_interconnect_0:nios2_gen2_0_data_master_readdata -> nios2_gen2_0:d_readdata
signal nios2_gen2_0_data_master_waitrequest : std_logic; -- mm_interconnect_0:nios2_gen2_0_data_master_waitrequest -> nios2_gen2_0:d_waitrequest
signal nios2_gen2_0_data_master_debugaccess : std_logic; -- nios2_gen2_0:debug_mem_slave_debugaccess_to_roms -> mm_interconnect_0:nios2_gen2_0_data_master_debugaccess
signal nios2_gen2_0_data_master_address : std_logic_vector(28 downto 0); -- nios2_gen2_0:d_address -> mm_interconnect_0:nios2_gen2_0_data_master_address
signal nios2_gen2_0_data_master_byteenable : std_logic_vector(3 downto 0); -- nios2_gen2_0:d_byteenable -> mm_interconnect_0:nios2_gen2_0_data_master_byteenable
signal nios2_gen2_0_data_master_read : std_logic; -- nios2_gen2_0:d_read -> mm_interconnect_0:nios2_gen2_0_data_master_read
signal nios2_gen2_0_data_master_write : std_logic; -- nios2_gen2_0:d_write -> mm_interconnect_0:nios2_gen2_0_data_master_write
signal nios2_gen2_0_data_master_writedata : std_logic_vector(31 downto 0); -- nios2_gen2_0:d_writedata -> mm_interconnect_0:nios2_gen2_0_data_master_writedata
signal nios2_gen2_0_instruction_master_readdata : std_logic_vector(31 downto 0); -- mm_interconnect_0:nios2_gen2_0_instruction_master_readdata -> nios2_gen2_0:i_readdata
signal nios2_gen2_0_instruction_master_waitrequest : std_logic; -- mm_interconnect_0:nios2_gen2_0_instruction_master_waitrequest -> nios2_gen2_0:i_waitrequest
signal nios2_gen2_0_instruction_master_address : std_logic_vector(28 downto 0); -- nios2_gen2_0:i_address -> mm_interconnect_0:nios2_gen2_0_instruction_master_address
signal nios2_gen2_0_instruction_master_read : std_logic; -- nios2_gen2_0:i_read -> mm_interconnect_0:nios2_gen2_0_instruction_master_read
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_beginbursttransfer : std_logic; -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_beginbursttransfer -> mem_if_ddr2_emif_0:avl_burstbegin
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_readdata : std_logic_vector(31 downto 0); -- mem_if_ddr2_emif_0:avl_rdata -> mm_interconnect_0:mem_if_ddr2_emif_0_avl_readdata
signal mem_if_ddr2_emif_0_avl_waitrequest : std_logic; -- mem_if_ddr2_emif_0:avl_ready -> mem_if_ddr2_emif_0_avl_waitrequest:in
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_address : std_logic_vector(23 downto 0); -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_address -> mem_if_ddr2_emif_0:avl_addr
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_read : std_logic; -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_read -> mem_if_ddr2_emif_0:avl_read_req
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_byteenable : std_logic_vector(3 downto 0); -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_byteenable -> mem_if_ddr2_emif_0:avl_be
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_readdatavalid : std_logic; -- mem_if_ddr2_emif_0:avl_rdata_valid -> mm_interconnect_0:mem_if_ddr2_emif_0_avl_readdatavalid
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_write : std_logic; -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_write -> mem_if_ddr2_emif_0:avl_write_req
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_writedata : std_logic_vector(31 downto 0); -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_writedata -> mem_if_ddr2_emif_0:avl_wdata
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_burstcount : std_logic_vector(2 downto 0); -- mm_interconnect_0:mem_if_ddr2_emif_0_avl_burstcount -> mem_if_ddr2_emif_0:avl_size
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_readdata : std_logic_vector(31 downto 0); -- nios2_gen2_0:debug_mem_slave_readdata -> mm_interconnect_0:nios2_gen2_0_debug_mem_slave_readdata
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_waitrequest : std_logic; -- nios2_gen2_0:debug_mem_slave_waitrequest -> mm_interconnect_0:nios2_gen2_0_debug_mem_slave_waitrequest
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_debugaccess : std_logic; -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_debugaccess -> nios2_gen2_0:debug_mem_slave_debugaccess
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_address : std_logic_vector(8 downto 0); -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_address -> nios2_gen2_0:debug_mem_slave_address
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_read : std_logic; -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_read -> nios2_gen2_0:debug_mem_slave_read
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_byteenable : std_logic_vector(3 downto 0); -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_byteenable -> nios2_gen2_0:debug_mem_slave_byteenable
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_write : std_logic; -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_write -> nios2_gen2_0:debug_mem_slave_write
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_writedata : std_logic_vector(31 downto 0); -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_writedata -> nios2_gen2_0:debug_mem_slave_writedata
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_readdata : std_logic_vector(7 downto 0); -- io_bridge_0:avs_readdata -> mm_interconnect_0:io_bridge_0_avalon_slave_0_readdata
signal io_bridge_0_avalon_slave_0_waitrequest : std_logic; -- io_bridge_0:avs_ready -> io_bridge_0_avalon_slave_0_waitrequest:in
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_address : std_logic_vector(19 downto 0); -- mm_interconnect_0:io_bridge_0_avalon_slave_0_address -> io_bridge_0:avs_address
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_read : std_logic; -- mm_interconnect_0:io_bridge_0_avalon_slave_0_read -> io_bridge_0:avs_read
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_readdatavalid : std_logic; -- io_bridge_0:avs_readdatavalid -> mm_interconnect_0:io_bridge_0_avalon_slave_0_readdatavalid
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_write : std_logic; -- mm_interconnect_0:io_bridge_0_avalon_slave_0_write -> io_bridge_0:avs_write
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_writedata : std_logic_vector(7 downto 0); -- mm_interconnect_0:io_bridge_0_avalon_slave_0_writedata -> io_bridge_0:avs_writedata
signal mm_interconnect_0_pio_0_s1_chipselect : std_logic; -- mm_interconnect_0:pio_0_s1_chipselect -> pio_0:chipselect
signal mm_interconnect_0_pio_0_s1_readdata : std_logic_vector(31 downto 0); -- pio_0:readdata -> mm_interconnect_0:pio_0_s1_readdata
signal mm_interconnect_0_pio_0_s1_address : std_logic_vector(2 downto 0); -- mm_interconnect_0:pio_0_s1_address -> pio_0:address
signal mm_interconnect_0_pio_0_s1_write : std_logic; -- mm_interconnect_0:pio_0_s1_write -> mm_interconnect_0_pio_0_s1_write:in
signal mm_interconnect_0_pio_0_s1_writedata : std_logic_vector(31 downto 0); -- mm_interconnect_0:pio_0_s1_writedata -> pio_0:writedata
signal irq_mapper_receiver0_irq : std_logic; -- io_bridge_0:avs_irq -> irq_mapper:receiver0_irq
signal irq_mapper_receiver1_irq : std_logic; -- pio_0:irq -> irq_mapper:receiver1_irq
signal nios2_gen2_0_irq_irq : std_logic_vector(31 downto 0); -- irq_mapper:sender_irq -> nios2_gen2_0:irq
signal rst_controller_reset_out_reset : std_logic; -- rst_controller:reset_out -> [io_bridge_0:reset, mem32_to_avalon_0:reset, mm_interconnect_0:mem32_to_avalon_0_reset_reset_bridge_in_reset_reset, rst_controller_reset_out_reset:in]
signal mem_if_ddr2_emif_0_afi_reset_reset : std_logic; -- mem_if_ddr2_emif_0:afi_reset_n -> mem_if_ddr2_emif_0_afi_reset_reset:in
signal nios2_gen2_0_debug_reset_request_reset : std_logic; -- nios2_gen2_0:debug_reset_request -> rst_controller:reset_in1
signal rst_controller_001_reset_out_reset : std_logic; -- rst_controller_001:reset_out -> [irq_mapper:reset, mm_interconnect_0:nios2_gen2_0_reset_reset_bridge_in_reset_reset, rst_controller_001_reset_out_reset:in]
signal rst_controller_001_reset_out_reset_req : std_logic; -- rst_controller_001:reset_req -> [nios2_gen2_0:reset_req, rst_translator:reset_req_in]
signal rst_controller_002_reset_out_reset : std_logic; -- rst_controller_002:reset_out -> [mm_interconnect_0:mem_if_ddr2_emif_0_avl_translator_reset_reset_bridge_in_reset_reset, mm_interconnect_0:mem_if_ddr2_emif_0_soft_reset_reset_bridge_in_reset_reset]
signal reset_reset_n_ports_inv : std_logic; -- reset_reset_n:inv -> rst_controller_002:reset_in0
signal mem32_to_avalon_0_avalon_master_inv : std_logic; -- mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest:inv -> mem32_to_avalon_0:avm_ready
signal mm_interconnect_0_mem_if_ddr2_emif_0_avl_inv : std_logic; -- mem_if_ddr2_emif_0_avl_waitrequest:inv -> mm_interconnect_0:mem_if_ddr2_emif_0_avl_waitrequest
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_inv : std_logic; -- io_bridge_0_avalon_slave_0_waitrequest:inv -> mm_interconnect_0:io_bridge_0_avalon_slave_0_waitrequest
signal mm_interconnect_0_pio_0_s1_write_ports_inv : std_logic; -- mm_interconnect_0_pio_0_s1_write:inv -> pio_0:write_n
signal rst_controller_reset_out_reset_ports_inv : std_logic; -- rst_controller_reset_out_reset:inv -> [sys_reset_reset_n, pio_0:reset_n]
signal mem_if_ddr2_emif_0_afi_reset_reset_ports_inv : std_logic; -- mem_if_ddr2_emif_0_afi_reset_reset:inv -> [rst_controller:reset_in0, rst_controller_001:reset_in0]
signal rst_controller_001_reset_out_reset_ports_inv : std_logic; -- rst_controller_001_reset_out_reset:inv -> nios2_gen2_0:reset_n
begin
io_bridge_0 : component avalon_to_io_bridge
port map (
reset => rst_controller_reset_out_reset, -- reset.reset
avs_read => mm_interconnect_0_io_bridge_0_avalon_slave_0_read, -- avalon_slave_0.read
avs_write => mm_interconnect_0_io_bridge_0_avalon_slave_0_write, -- .write
avs_address => mm_interconnect_0_io_bridge_0_avalon_slave_0_address, -- .address
avs_writedata => mm_interconnect_0_io_bridge_0_avalon_slave_0_writedata, -- .writedata
avs_ready => io_bridge_0_avalon_slave_0_waitrequest, -- .waitrequest_n
avs_readdata => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdata, -- .readdata
avs_readdatavalid => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdatavalid, -- .readdatavalid
clock => mem_if_ddr2_emif_0_afi_clk_clk, -- clock.clk
io_ack => io_ack, -- io.ack
io_rdata => io_rdata, -- .rdata
io_read => io_read, -- .read
io_wdata => io_wdata, -- .wdata
io_write => io_write, -- .write
io_address => io_address, -- .address
io_irq => io_irq, -- .irq
avs_irq => irq_mapper_receiver0_irq -- irq.irq
);
mem32_to_avalon_0 : component mem32_to_avalon_bridge
port map (
reset => rst_controller_reset_out_reset, -- reset.reset
clock => mem_if_ddr2_emif_0_afi_clk_clk, -- clock.clk
memreq_address => mem32_address, -- mem32_slave.address
memreq_read_writen => mem32_direction, -- .direction
memreq_byte_en => mem32_byte_en, -- .byte_en
memreq_data => mem32_wdata, -- .wdata
memreq_request => mem32_request, -- .request
memreq_tag => mem32_tag, -- .tag
memresp_dack_tag => mem32_dack_tag, -- .dack_tag
memresp_data => mem32_rdata, -- .rdata
memresp_rack => mem32_rack, -- .rack
memresp_rack_tag => mem32_rack_tag, -- .rack_tag
avm_read => mem32_to_avalon_0_avalon_master_read, -- avalon_master.read
avm_write => mem32_to_avalon_0_avalon_master_write, -- .write
avm_address => mem32_to_avalon_0_avalon_master_address, -- .address
avm_writedata => mem32_to_avalon_0_avalon_master_writedata, -- .writedata
avm_byte_enable => mem32_to_avalon_0_avalon_master_byteenable, -- .byteenable
avm_ready => mem32_to_avalon_0_avalon_master_inv, -- .waitrequest_n
avm_readdata => mem32_to_avalon_0_avalon_master_readdata, -- .readdata
avm_readdatavalid => mem32_to_avalon_0_avalon_master_readdatavalid -- .readdatavalid
);
mem_if_ddr2_emif_0 : component nios_mem_if_ddr2_emif_0
port map (
pll_ref_clk => clk50_clk, -- pll_ref_clk.clk
global_reset_n => reset_reset_n, -- global_reset.reset_n
soft_reset_n => reset_reset_n, -- soft_reset.reset_n
afi_clk => mem_if_ddr2_emif_0_afi_clk_clk, -- afi_clk.clk
afi_half_clk => open, -- afi_half_clk.clk
afi_reset_n => mem_if_ddr2_emif_0_afi_reset_reset, -- afi_reset.reset_n
afi_reset_export_n => open, -- afi_reset_export.reset_n
mem_a => memory_mem_a, -- memory.mem_a
mem_ba => memory_mem_ba, -- .mem_ba
mem_ck => memory_mem_ck, -- .mem_ck
mem_ck_n => memory_mem_ck_n, -- .mem_ck_n
mem_cke => memory_mem_cke, -- .mem_cke
mem_cs_n => memory_mem_cs_n, -- .mem_cs_n
mem_dm => memory_mem_dm, -- .mem_dm
mem_ras_n => memory_mem_ras_n, -- .mem_ras_n
mem_cas_n => memory_mem_cas_n, -- .mem_cas_n
mem_we_n => memory_mem_we_n, -- .mem_we_n
mem_dq => memory_mem_dq, -- .mem_dq
mem_dqs => memory_mem_dqs, -- .mem_dqs
mem_dqs_n => memory_mem_dqs_n, -- .mem_dqs_n
mem_odt => memory_mem_odt, -- .mem_odt
avl_ready => mem_if_ddr2_emif_0_avl_waitrequest, -- avl.waitrequest_n
avl_burstbegin => mm_interconnect_0_mem_if_ddr2_emif_0_avl_beginbursttransfer, -- .beginbursttransfer
avl_addr => mm_interconnect_0_mem_if_ddr2_emif_0_avl_address, -- .address
avl_rdata_valid => mm_interconnect_0_mem_if_ddr2_emif_0_avl_readdatavalid, -- .readdatavalid
avl_rdata => mm_interconnect_0_mem_if_ddr2_emif_0_avl_readdata, -- .readdata
avl_wdata => mm_interconnect_0_mem_if_ddr2_emif_0_avl_writedata, -- .writedata
avl_be => mm_interconnect_0_mem_if_ddr2_emif_0_avl_byteenable, -- .byteenable
avl_read_req => mm_interconnect_0_mem_if_ddr2_emif_0_avl_read, -- .read
avl_write_req => mm_interconnect_0_mem_if_ddr2_emif_0_avl_write, -- .write
avl_size => mm_interconnect_0_mem_if_ddr2_emif_0_avl_burstcount, -- .burstcount
local_init_done => status_local_init_done, -- status.local_init_done
local_cal_success => status_local_cal_success, -- .local_cal_success
local_cal_fail => status_local_cal_fail, -- .local_cal_fail
oct_rzqin => oct_rzqin -- oct.rzqin
);
nios2_gen2_0 : component nios_nios2_gen2_0
port map (
clk => mem_if_ddr2_emif_0_afi_clk_clk, -- clk.clk
reset_n => rst_controller_001_reset_out_reset_ports_inv, -- reset.reset_n
reset_req => rst_controller_001_reset_out_reset_req, -- .reset_req
d_address => nios2_gen2_0_data_master_address, -- data_master.address
d_byteenable => nios2_gen2_0_data_master_byteenable, -- .byteenable
d_read => nios2_gen2_0_data_master_read, -- .read
d_readdata => nios2_gen2_0_data_master_readdata, -- .readdata
d_waitrequest => nios2_gen2_0_data_master_waitrequest, -- .waitrequest
d_write => nios2_gen2_0_data_master_write, -- .write
d_writedata => nios2_gen2_0_data_master_writedata, -- .writedata
debug_mem_slave_debugaccess_to_roms => nios2_gen2_0_data_master_debugaccess, -- .debugaccess
i_address => nios2_gen2_0_instruction_master_address, -- instruction_master.address
i_read => nios2_gen2_0_instruction_master_read, -- .read
i_readdata => nios2_gen2_0_instruction_master_readdata, -- .readdata
i_waitrequest => nios2_gen2_0_instruction_master_waitrequest, -- .waitrequest
irq => nios2_gen2_0_irq_irq, -- irq.irq
debug_reset_request => nios2_gen2_0_debug_reset_request_reset, -- debug_reset_request.reset
debug_mem_slave_address => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_address, -- debug_mem_slave.address
debug_mem_slave_byteenable => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_byteenable, -- .byteenable
debug_mem_slave_debugaccess => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_debugaccess, -- .debugaccess
debug_mem_slave_read => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_read, -- .read
debug_mem_slave_readdata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_readdata, -- .readdata
debug_mem_slave_waitrequest => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_waitrequest, -- .waitrequest
debug_mem_slave_write => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_write, -- .write
debug_mem_slave_writedata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_writedata, -- .writedata
dummy_ci_port => open -- custom_instruction_master.readra
);
pio_0 : component nios_pio_0
port map (
clk => mem_if_ddr2_emif_0_afi_clk_clk, -- clk.clk
reset_n => rst_controller_reset_out_reset_ports_inv, -- reset.reset_n
address => mm_interconnect_0_pio_0_s1_address, -- s1.address
write_n => mm_interconnect_0_pio_0_s1_write_ports_inv, -- .write_n
writedata => mm_interconnect_0_pio_0_s1_writedata, -- .writedata
chipselect => mm_interconnect_0_pio_0_s1_chipselect, -- .chipselect
readdata => mm_interconnect_0_pio_0_s1_readdata, -- .readdata
in_port => pio_in_port, -- external_connection.export
out_port => pio_out_port, -- .export
irq => irq_mapper_receiver1_irq -- irq.irq
);
mm_interconnect_0 : component nios_mm_interconnect_0
port map (
mem_if_ddr2_emif_0_afi_clk_clk => mem_if_ddr2_emif_0_afi_clk_clk, -- mem_if_ddr2_emif_0_afi_clk.clk
mem32_to_avalon_0_reset_reset_bridge_in_reset_reset => rst_controller_reset_out_reset, -- mem32_to_avalon_0_reset_reset_bridge_in_reset.reset
mem_if_ddr2_emif_0_avl_translator_reset_reset_bridge_in_reset_reset => rst_controller_002_reset_out_reset, -- mem_if_ddr2_emif_0_avl_translator_reset_reset_bridge_in_reset.reset
mem_if_ddr2_emif_0_soft_reset_reset_bridge_in_reset_reset => rst_controller_002_reset_out_reset, -- mem_if_ddr2_emif_0_soft_reset_reset_bridge_in_reset.reset
nios2_gen2_0_reset_reset_bridge_in_reset_reset => rst_controller_001_reset_out_reset, -- nios2_gen2_0_reset_reset_bridge_in_reset.reset
mem32_to_avalon_0_avalon_master_address => mem32_to_avalon_0_avalon_master_address, -- mem32_to_avalon_0_avalon_master.address
mem32_to_avalon_0_avalon_master_waitrequest => mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest, -- .waitrequest
mem32_to_avalon_0_avalon_master_byteenable => mem32_to_avalon_0_avalon_master_byteenable, -- .byteenable
mem32_to_avalon_0_avalon_master_read => mem32_to_avalon_0_avalon_master_read, -- .read
mem32_to_avalon_0_avalon_master_readdata => mem32_to_avalon_0_avalon_master_readdata, -- .readdata
mem32_to_avalon_0_avalon_master_readdatavalid => mem32_to_avalon_0_avalon_master_readdatavalid, -- .readdatavalid
mem32_to_avalon_0_avalon_master_write => mem32_to_avalon_0_avalon_master_write, -- .write
mem32_to_avalon_0_avalon_master_writedata => mem32_to_avalon_0_avalon_master_writedata, -- .writedata
nios2_gen2_0_data_master_address => nios2_gen2_0_data_master_address, -- nios2_gen2_0_data_master.address
nios2_gen2_0_data_master_waitrequest => nios2_gen2_0_data_master_waitrequest, -- .waitrequest
nios2_gen2_0_data_master_byteenable => nios2_gen2_0_data_master_byteenable, -- .byteenable
nios2_gen2_0_data_master_read => nios2_gen2_0_data_master_read, -- .read
nios2_gen2_0_data_master_readdata => nios2_gen2_0_data_master_readdata, -- .readdata
nios2_gen2_0_data_master_write => nios2_gen2_0_data_master_write, -- .write
nios2_gen2_0_data_master_writedata => nios2_gen2_0_data_master_writedata, -- .writedata
nios2_gen2_0_data_master_debugaccess => nios2_gen2_0_data_master_debugaccess, -- .debugaccess
nios2_gen2_0_instruction_master_address => nios2_gen2_0_instruction_master_address, -- nios2_gen2_0_instruction_master.address
nios2_gen2_0_instruction_master_waitrequest => nios2_gen2_0_instruction_master_waitrequest, -- .waitrequest
nios2_gen2_0_instruction_master_read => nios2_gen2_0_instruction_master_read, -- .read
nios2_gen2_0_instruction_master_readdata => nios2_gen2_0_instruction_master_readdata, -- .readdata
io_bridge_0_avalon_slave_0_address => mm_interconnect_0_io_bridge_0_avalon_slave_0_address, -- io_bridge_0_avalon_slave_0.address
io_bridge_0_avalon_slave_0_write => mm_interconnect_0_io_bridge_0_avalon_slave_0_write, -- .write
io_bridge_0_avalon_slave_0_read => mm_interconnect_0_io_bridge_0_avalon_slave_0_read, -- .read
io_bridge_0_avalon_slave_0_readdata => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdata, -- .readdata
io_bridge_0_avalon_slave_0_writedata => mm_interconnect_0_io_bridge_0_avalon_slave_0_writedata, -- .writedata
io_bridge_0_avalon_slave_0_readdatavalid => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdatavalid, -- .readdatavalid
io_bridge_0_avalon_slave_0_waitrequest => mm_interconnect_0_io_bridge_0_avalon_slave_0_inv, -- .waitrequest
mem_if_ddr2_emif_0_avl_address => mm_interconnect_0_mem_if_ddr2_emif_0_avl_address, -- mem_if_ddr2_emif_0_avl.address
mem_if_ddr2_emif_0_avl_write => mm_interconnect_0_mem_if_ddr2_emif_0_avl_write, -- .write
mem_if_ddr2_emif_0_avl_read => mm_interconnect_0_mem_if_ddr2_emif_0_avl_read, -- .read
mem_if_ddr2_emif_0_avl_readdata => mm_interconnect_0_mem_if_ddr2_emif_0_avl_readdata, -- .readdata
mem_if_ddr2_emif_0_avl_writedata => mm_interconnect_0_mem_if_ddr2_emif_0_avl_writedata, -- .writedata
mem_if_ddr2_emif_0_avl_beginbursttransfer => mm_interconnect_0_mem_if_ddr2_emif_0_avl_beginbursttransfer, -- .beginbursttransfer
mem_if_ddr2_emif_0_avl_burstcount => mm_interconnect_0_mem_if_ddr2_emif_0_avl_burstcount, -- .burstcount
mem_if_ddr2_emif_0_avl_byteenable => mm_interconnect_0_mem_if_ddr2_emif_0_avl_byteenable, -- .byteenable
mem_if_ddr2_emif_0_avl_readdatavalid => mm_interconnect_0_mem_if_ddr2_emif_0_avl_readdatavalid, -- .readdatavalid
mem_if_ddr2_emif_0_avl_waitrequest => mm_interconnect_0_mem_if_ddr2_emif_0_avl_inv, -- .waitrequest
nios2_gen2_0_debug_mem_slave_address => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_address, -- nios2_gen2_0_debug_mem_slave.address
nios2_gen2_0_debug_mem_slave_write => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_write, -- .write
nios2_gen2_0_debug_mem_slave_read => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_read, -- .read
nios2_gen2_0_debug_mem_slave_readdata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_readdata, -- .readdata
nios2_gen2_0_debug_mem_slave_writedata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_writedata, -- .writedata
nios2_gen2_0_debug_mem_slave_byteenable => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_byteenable, -- .byteenable
nios2_gen2_0_debug_mem_slave_waitrequest => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_waitrequest, -- .waitrequest
nios2_gen2_0_debug_mem_slave_debugaccess => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_debugaccess, -- .debugaccess
pio_0_s1_address => mm_interconnect_0_pio_0_s1_address, -- pio_0_s1.address
pio_0_s1_write => mm_interconnect_0_pio_0_s1_write, -- .write
pio_0_s1_readdata => mm_interconnect_0_pio_0_s1_readdata, -- .readdata
pio_0_s1_writedata => mm_interconnect_0_pio_0_s1_writedata, -- .writedata
pio_0_s1_chipselect => mm_interconnect_0_pio_0_s1_chipselect -- .chipselect
);
irq_mapper : component nios_irq_mapper
port map (
clk => mem_if_ddr2_emif_0_afi_clk_clk, -- clk.clk
reset => rst_controller_001_reset_out_reset, -- clk_reset.reset
receiver0_irq => irq_mapper_receiver0_irq, -- receiver0.irq
receiver1_irq => irq_mapper_receiver1_irq, -- receiver1.irq
sender_irq => nios2_gen2_0_irq_irq -- sender.irq
);
rst_controller : component nios_rst_controller
generic map (
NUM_RESET_INPUTS => 2,
OUTPUT_RESET_SYNC_EDGES => "deassert",
SYNC_DEPTH => 2,
RESET_REQUEST_PRESENT => 0,
RESET_REQ_WAIT_TIME => 1,
MIN_RST_ASSERTION_TIME => 3,
RESET_REQ_EARLY_DSRT_TIME => 1,
USE_RESET_REQUEST_IN0 => 0,
USE_RESET_REQUEST_IN1 => 0,
USE_RESET_REQUEST_IN2 => 0,
USE_RESET_REQUEST_IN3 => 0,
USE_RESET_REQUEST_IN4 => 0,
USE_RESET_REQUEST_IN5 => 0,
USE_RESET_REQUEST_IN6 => 0,
USE_RESET_REQUEST_IN7 => 0,
USE_RESET_REQUEST_IN8 => 0,
USE_RESET_REQUEST_IN9 => 0,
USE_RESET_REQUEST_IN10 => 0,
USE_RESET_REQUEST_IN11 => 0,
USE_RESET_REQUEST_IN12 => 0,
USE_RESET_REQUEST_IN13 => 0,
USE_RESET_REQUEST_IN14 => 0,
USE_RESET_REQUEST_IN15 => 0,
ADAPT_RESET_REQUEST => 0
)
port map (
reset_in0 => mem_if_ddr2_emif_0_afi_reset_reset_ports_inv, -- reset_in0.reset
reset_in1 => nios2_gen2_0_debug_reset_request_reset, -- reset_in1.reset
clk => mem_if_ddr2_emif_0_afi_clk_clk, -- clk.clk
reset_out => rst_controller_reset_out_reset, -- reset_out.reset
reset_req => open, -- (terminated)
reset_req_in0 => '0', -- (terminated)
reset_req_in1 => '0', -- (terminated)
reset_in2 => '0', -- (terminated)
reset_req_in2 => '0', -- (terminated)
reset_in3 => '0', -- (terminated)
reset_req_in3 => '0', -- (terminated)
reset_in4 => '0', -- (terminated)
reset_req_in4 => '0', -- (terminated)
reset_in5 => '0', -- (terminated)
reset_req_in5 => '0', -- (terminated)
reset_in6 => '0', -- (terminated)
reset_req_in6 => '0', -- (terminated)
reset_in7 => '0', -- (terminated)
reset_req_in7 => '0', -- (terminated)
reset_in8 => '0', -- (terminated)
reset_req_in8 => '0', -- (terminated)
reset_in9 => '0', -- (terminated)
reset_req_in9 => '0', -- (terminated)
reset_in10 => '0', -- (terminated)
reset_req_in10 => '0', -- (terminated)
reset_in11 => '0', -- (terminated)
reset_req_in11 => '0', -- (terminated)
reset_in12 => '0', -- (terminated)
reset_req_in12 => '0', -- (terminated)
reset_in13 => '0', -- (terminated)
reset_req_in13 => '0', -- (terminated)
reset_in14 => '0', -- (terminated)
reset_req_in14 => '0', -- (terminated)
reset_in15 => '0', -- (terminated)
reset_req_in15 => '0' -- (terminated)
);
rst_controller_001 : component nios_rst_controller_001
generic map (
NUM_RESET_INPUTS => 1,
OUTPUT_RESET_SYNC_EDGES => "deassert",
SYNC_DEPTH => 2,
RESET_REQUEST_PRESENT => 1,
RESET_REQ_WAIT_TIME => 1,
MIN_RST_ASSERTION_TIME => 3,
RESET_REQ_EARLY_DSRT_TIME => 1,
USE_RESET_REQUEST_IN0 => 0,
USE_RESET_REQUEST_IN1 => 0,
USE_RESET_REQUEST_IN2 => 0,
USE_RESET_REQUEST_IN3 => 0,
USE_RESET_REQUEST_IN4 => 0,
USE_RESET_REQUEST_IN5 => 0,
USE_RESET_REQUEST_IN6 => 0,
USE_RESET_REQUEST_IN7 => 0,
USE_RESET_REQUEST_IN8 => 0,
USE_RESET_REQUEST_IN9 => 0,
USE_RESET_REQUEST_IN10 => 0,
USE_RESET_REQUEST_IN11 => 0,
USE_RESET_REQUEST_IN12 => 0,
USE_RESET_REQUEST_IN13 => 0,
USE_RESET_REQUEST_IN14 => 0,
USE_RESET_REQUEST_IN15 => 0,
ADAPT_RESET_REQUEST => 0
)
port map (
reset_in0 => mem_if_ddr2_emif_0_afi_reset_reset_ports_inv, -- reset_in0.reset
clk => mem_if_ddr2_emif_0_afi_clk_clk, -- clk.clk
reset_out => rst_controller_001_reset_out_reset, -- reset_out.reset
reset_req => rst_controller_001_reset_out_reset_req, -- .reset_req
reset_req_in0 => '0', -- (terminated)
reset_in1 => '0', -- (terminated)
reset_req_in1 => '0', -- (terminated)
reset_in2 => '0', -- (terminated)
reset_req_in2 => '0', -- (terminated)
reset_in3 => '0', -- (terminated)
reset_req_in3 => '0', -- (terminated)
reset_in4 => '0', -- (terminated)
reset_req_in4 => '0', -- (terminated)
reset_in5 => '0', -- (terminated)
reset_req_in5 => '0', -- (terminated)
reset_in6 => '0', -- (terminated)
reset_req_in6 => '0', -- (terminated)
reset_in7 => '0', -- (terminated)
reset_req_in7 => '0', -- (terminated)
reset_in8 => '0', -- (terminated)
reset_req_in8 => '0', -- (terminated)
reset_in9 => '0', -- (terminated)
reset_req_in9 => '0', -- (terminated)
reset_in10 => '0', -- (terminated)
reset_req_in10 => '0', -- (terminated)
reset_in11 => '0', -- (terminated)
reset_req_in11 => '0', -- (terminated)
reset_in12 => '0', -- (terminated)
reset_req_in12 => '0', -- (terminated)
reset_in13 => '0', -- (terminated)
reset_req_in13 => '0', -- (terminated)
reset_in14 => '0', -- (terminated)
reset_req_in14 => '0', -- (terminated)
reset_in15 => '0', -- (terminated)
reset_req_in15 => '0' -- (terminated)
);
rst_controller_002 : component nios_rst_controller_002
generic map (
NUM_RESET_INPUTS => 1,
OUTPUT_RESET_SYNC_EDGES => "deassert",
SYNC_DEPTH => 2,
RESET_REQUEST_PRESENT => 0,
RESET_REQ_WAIT_TIME => 1,
MIN_RST_ASSERTION_TIME => 3,
RESET_REQ_EARLY_DSRT_TIME => 1,
USE_RESET_REQUEST_IN0 => 0,
USE_RESET_REQUEST_IN1 => 0,
USE_RESET_REQUEST_IN2 => 0,
USE_RESET_REQUEST_IN3 => 0,
USE_RESET_REQUEST_IN4 => 0,
USE_RESET_REQUEST_IN5 => 0,
USE_RESET_REQUEST_IN6 => 0,
USE_RESET_REQUEST_IN7 => 0,
USE_RESET_REQUEST_IN8 => 0,
USE_RESET_REQUEST_IN9 => 0,
USE_RESET_REQUEST_IN10 => 0,
USE_RESET_REQUEST_IN11 => 0,
USE_RESET_REQUEST_IN12 => 0,
USE_RESET_REQUEST_IN13 => 0,
USE_RESET_REQUEST_IN14 => 0,
USE_RESET_REQUEST_IN15 => 0,
ADAPT_RESET_REQUEST => 0
)
port map (
reset_in0 => reset_reset_n_ports_inv, -- reset_in0.reset
clk => mem_if_ddr2_emif_0_afi_clk_clk, -- clk.clk
reset_out => rst_controller_002_reset_out_reset, -- reset_out.reset
reset_req => open, -- (terminated)
reset_req_in0 => '0', -- (terminated)
reset_in1 => '0', -- (terminated)
reset_req_in1 => '0', -- (terminated)
reset_in2 => '0', -- (terminated)
reset_req_in2 => '0', -- (terminated)
reset_in3 => '0', -- (terminated)
reset_req_in3 => '0', -- (terminated)
reset_in4 => '0', -- (terminated)
reset_req_in4 => '0', -- (terminated)
reset_in5 => '0', -- (terminated)
reset_req_in5 => '0', -- (terminated)
reset_in6 => '0', -- (terminated)
reset_req_in6 => '0', -- (terminated)
reset_in7 => '0', -- (terminated)
reset_req_in7 => '0', -- (terminated)
reset_in8 => '0', -- (terminated)
reset_req_in8 => '0', -- (terminated)
reset_in9 => '0', -- (terminated)
reset_req_in9 => '0', -- (terminated)
reset_in10 => '0', -- (terminated)
reset_req_in10 => '0', -- (terminated)
reset_in11 => '0', -- (terminated)
reset_req_in11 => '0', -- (terminated)
reset_in12 => '0', -- (terminated)
reset_req_in12 => '0', -- (terminated)
reset_in13 => '0', -- (terminated)
reset_req_in13 => '0', -- (terminated)
reset_in14 => '0', -- (terminated)
reset_req_in14 => '0', -- (terminated)
reset_in15 => '0', -- (terminated)
reset_req_in15 => '0' -- (terminated)
);
reset_reset_n_ports_inv <= not reset_reset_n;
mem32_to_avalon_0_avalon_master_inv <= not mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest;
mm_interconnect_0_mem_if_ddr2_emif_0_avl_inv <= not mem_if_ddr2_emif_0_avl_waitrequest;
mm_interconnect_0_io_bridge_0_avalon_slave_0_inv <= not io_bridge_0_avalon_slave_0_waitrequest;
mm_interconnect_0_pio_0_s1_write_ports_inv <= not mm_interconnect_0_pio_0_s1_write;
rst_controller_reset_out_reset_ports_inv <= not rst_controller_reset_out_reset;
mem_if_ddr2_emif_0_afi_reset_reset_ports_inv <= not mem_if_ddr2_emif_0_afi_reset_reset;
rst_controller_001_reset_out_reset_ports_inv <= not rst_controller_001_reset_out_reset;
sys_clock_clk <= mem_if_ddr2_emif_0_afi_clk_clk;
sys_reset_reset_n <= rst_controller_reset_out_reset_ports_inv;
end architecture rtl; -- of nios
| gpl-3.0 | 777aa27deb2b6bf39908411882f6d91f | 0.448003 | 3.723345 | false | false | false | false |
trondd/mkjpeg | design/huffman/AC_CR_ROM.vhd | 2 | 34,115 | -------------------------------------------------------------------------------
-- File Name : AC_CR_ROM.vhd
--
-- Project : JPEG_ENC
--
-- Module : AC_CR_ROM
--
-- Content : AC_CR_ROM Chrominance
--
-- Description :
--
-- Spec. :
--
-- Author : Michal Krepa
--
-------------------------------------------------------------------------------
-- History :
-- 20090329: (MK): Initial Creation.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
----------------------------------- LIBRARY/PACKAGE ---------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- generic packages/libraries:
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
-------------------------------------------------------------------------------
-- user packages/libraries:
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
----------------------------------- ENTITY ------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
entity AC_CR_ROM is
port
(
CLK : in std_logic;
RST : in std_logic;
runlength : in std_logic_vector(3 downto 0);
VLI_size : in std_logic_vector(3 downto 0);
VLC_AC_size : out unsigned(4 downto 0);
VLC_AC : out unsigned(15 downto 0)
);
end entity AC_CR_ROM;
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
----------------------------------- ARCHITECTURE ------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
architecture RTL of AC_CR_ROM is
signal rom_addr : std_logic_vector(7 downto 0);
-------------------------------------------------------------------------------
-- Architecture: begin
-------------------------------------------------------------------------------
begin
rom_addr <= runlength & VLI_size;
-------------------------------------------------------------------
-- AC-ROM
-------------------------------------------------------------------
p_AC_CR_ROM : process(CLK, RST)
begin
if RST = '1' then
VLC_AC_size <= (others => '0');
VLC_AC <= (others => '0');
elsif CLK'event and CLK = '1' then
case runlength is
when X"0" =>
case VLI_size is
when X"0" =>
VLC_AC_size <= to_unsigned(2, VLC_AC_size'length);
VLC_AC <= resize("00", VLC_AC'length);
when X"1" =>
VLC_AC_size <= to_unsigned(2, VLC_AC_size'length);
VLC_AC <= resize("01", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(3, VLC_AC_size'length);
VLC_AC <= resize("100", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(4, VLC_AC_size'length);
VLC_AC <= resize("1010", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(5, VLC_AC_size'length);
VLC_AC <= resize("11000", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(5, VLC_AC_size'length);
VLC_AC <= resize("11001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(6, VLC_AC_size'length);
VLC_AC <= resize("111000", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(7, VLC_AC_size'length);
VLC_AC <= resize("1111000", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111110100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(10, VLC_AC_size'length);
VLC_AC <= resize("1111110110", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(12, VLC_AC_size'length);
VLC_AC <= resize("111111110100", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"1" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(4, VLC_AC_size'length);
VLC_AC <= resize("1011", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(6, VLC_AC_size'length);
VLC_AC <= resize("111001", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(8, VLC_AC_size'length);
VLC_AC <= resize("11110110", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111110101", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(11, VLC_AC_size'length);
VLC_AC <= resize("11111110110", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(12, VLC_AC_size'length);
VLC_AC <= resize("111111110101", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001000", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001001", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001010", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001011", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"2" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(5, VLC_AC_size'length);
VLC_AC <= resize("11010", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(8, VLC_AC_size'length);
VLC_AC <= resize("11110111", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(10, VLC_AC_size'length);
VLC_AC <= resize("1111110111", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(12, VLC_AC_size'length);
VLC_AC <= resize("111111110110", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(15, VLC_AC_size'length);
VLC_AC <= resize("111111111000010", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001100", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001101", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001110", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110001111", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010000", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"3" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(5, VLC_AC_size'length);
VLC_AC <= resize("11011", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(8, VLC_AC_size'length);
VLC_AC <= resize("11111000", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(10, VLC_AC_size'length);
VLC_AC <= resize("1111111000", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(12, VLC_AC_size'length);
VLC_AC <= resize("111111110111", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010010", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010011", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010101", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010110", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"4" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(6, VLC_AC_size'length);
VLC_AC <= resize("111010", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111110110", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110010111", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011000", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011010", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011011", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011101", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011110", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"5" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(6, VLC_AC_size'length);
VLC_AC <= resize("111011", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(10, VLC_AC_size'length);
VLC_AC <= resize("1111111001", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110011111", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100000", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100010", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100011", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100101", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100110", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"6" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(7, VLC_AC_size'length);
VLC_AC <= resize("1111001", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(11, VLC_AC_size'length);
VLC_AC <= resize("11111110111", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110100111", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101000", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101010", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101011", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101101", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101110", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"7" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(7, VLC_AC_size'length);
VLC_AC <= resize("1111010", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(11, VLC_AC_size'length);
VLC_AC <= resize("11111111000", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110101111", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110000", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110010", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110011", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110101", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110110", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"8" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(8, VLC_AC_size'length);
VLC_AC <= resize("11111001", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110110111", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111000", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111001", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111010", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111011", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111100", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111101", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111110", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111110111111", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"9" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111110111", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000000", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000001", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000010", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000011", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000100", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000101", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000110", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111000111", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001000", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"A" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111111000", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001001", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001010", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001011", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001100", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001101", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001110", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111001111", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010000", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010001", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"B" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111111001", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010010", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010011", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010100", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010101", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010110", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111010111", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011000", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011001", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011010", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"C" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(9, VLC_AC_size'length);
VLC_AC <= resize("111111010", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011011", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011100", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011101", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011110", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111011111", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100000", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100001", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100010", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100011", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"D" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(11, VLC_AC_size'length);
VLC_AC <= resize("11111111001", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100100", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100101", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100110", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111100111", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101000", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101001", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101010", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101011", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101100", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"E" =>
case VLI_size is
when X"1" =>
VLC_AC_size <= to_unsigned(14, VLC_AC_size'length);
VLC_AC <= resize("11111111100000", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101101", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101110", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111101111", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110000", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110001", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110010", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110011", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110100", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110101", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when X"F" =>
case VLI_size is
when X"0" =>
VLC_AC_size <= to_unsigned(10, VLC_AC_size'length);
VLC_AC <= resize("1111111010", VLC_AC'length);
when X"1" =>
VLC_AC_size <= to_unsigned(15, VLC_AC_size'length);
VLC_AC <= resize("111111111000011", VLC_AC'length);
when X"2" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110110", VLC_AC'length);
when X"3" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111110111", VLC_AC'length);
when X"4" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111000", VLC_AC'length);
when X"5" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111001", VLC_AC'length);
when X"6" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111010", VLC_AC'length);
when X"7" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111011", VLC_AC'length);
when X"8" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111100", VLC_AC'length);
when X"9" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111101", VLC_AC'length);
when X"A" =>
VLC_AC_size <= to_unsigned(16, VLC_AC_size'length);
VLC_AC <= resize("1111111111111110", VLC_AC'length);
when others =>
VLC_AC_size <= to_unsigned(0, VLC_AC_size'length);
VLC_AC <= resize("0", VLC_AC'length);
end case;
when others =>
VLC_AC_size <= (others => '0');
VLC_AC <= (others => '0');
end case;
end if;
end process;
end architecture RTL;
-------------------------------------------------------------------------------
-- Architecture: end
------------------------------------------------------------------------------- | lgpl-3.0 | e58d41b37691e6650222fd217360d96e | 0.435556 | 3.923519 | false | false | false | false |
vzh/geda-gaf | utils/netlist/examples/vams/vhdl/basic-vhdl/voltage_source.vhdl | 15 | 415 | LIBRARY ieee,disciplines;
USE ieee.math_real.all;
USE ieee.math_real.all;
USE work.electrical_system.all;
USE work.all;
-- Entity declaration --
ENTITY VOLTAGE_SOURCE IS
GENERIC ( amplitude : REAL := 2.0;
offset : REAL := 1.2;
width : REAL := 0.002;
period : REAL := 0.005;
k : REAL := 100.0 );
PORT ( terminal RT : electrical;
terminal LT : electrical );
END ENTITY VOLTAGE_SOURCE;
| gpl-2.0 | 7d5ec86723011059a70e93c20a2dbfab | 0.645783 | 2.881944 | false | false | false | false |
ntb-ch/cb20 | FPGA_Designs/watchdog/cb20/synthesis/cb20_gpio_block_0.vhd | 1 | 3,970 | -- cb20_gpio_block_0.vhd
-- Generated using ACDS version 13.0sp1 232 at 2020.06.03.16:36:13
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity cb20_gpio_block_0 is
generic (
number_of_gpios : integer := 9;
unique_id : std_logic_vector(31 downto 0) := "00010010011100000101000000000001"
);
port (
oslv_avs_read_data : out std_logic_vector(31 downto 0); -- avalon_slave_0.readdata
islv_avs_address : in std_logic_vector(3 downto 0) := (others => '0'); -- .address
isl_avs_read : in std_logic := '0'; -- .read
isl_avs_write : in std_logic := '0'; -- .write
osl_avs_waitrequest : out std_logic; -- .waitrequest
islv_avs_write_data : in std_logic_vector(31 downto 0) := (others => '0'); -- .writedata
islv_avs_byteenable : in std_logic_vector(3 downto 0) := (others => '0'); -- .byteenable
isl_clk : in std_logic := '0'; -- clock_sink.clk
isl_reset_n : in std_logic := '0'; -- reset_sink.reset_n
oslv_gpios : inout std_logic_vector(8 downto 0) := (others => '0') -- conduit_end.export
);
end entity cb20_gpio_block_0;
architecture rtl of cb20_gpio_block_0 is
component avalon_gpio_interface is
generic (
number_of_gpios : integer := 1;
unique_id : std_logic_vector(31 downto 0) := "00000000000000000000000000000000"
);
port (
oslv_avs_read_data : out std_logic_vector(31 downto 0); -- readdata
islv_avs_address : in std_logic_vector(3 downto 0) := (others => 'X'); -- address
isl_avs_read : in std_logic := 'X'; -- read
isl_avs_write : in std_logic := 'X'; -- write
osl_avs_waitrequest : out std_logic; -- waitrequest
islv_avs_write_data : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
islv_avs_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
isl_clk : in std_logic := 'X'; -- clk
isl_reset_n : in std_logic := 'X'; -- reset_n
oslv_gpios : inout std_logic_vector(8 downto 0) := (others => 'X') -- export
);
end component avalon_gpio_interface;
begin
number_of_gpios_check : if number_of_gpios /= 9 generate
assert false report "Supplied generics do not match expected generics" severity Failure;
end generate;
unique_id_check : if unique_id /= "00010010011100000101000000000001" generate
assert false report "Supplied generics do not match expected generics" severity Failure;
end generate;
gpio_block_0 : component avalon_gpio_interface
generic map (
number_of_gpios => 9,
unique_id => "00010010011100000101000000000001"
)
port map (
oslv_avs_read_data => oslv_avs_read_data, -- avalon_slave_0.readdata
islv_avs_address => islv_avs_address, -- .address
isl_avs_read => isl_avs_read, -- .read
isl_avs_write => isl_avs_write, -- .write
osl_avs_waitrequest => osl_avs_waitrequest, -- .waitrequest
islv_avs_write_data => islv_avs_write_data, -- .writedata
islv_avs_byteenable => islv_avs_byteenable, -- .byteenable
isl_clk => isl_clk, -- clock_sink.clk
isl_reset_n => isl_reset_n, -- reset_sink.reset_n
oslv_gpios => oslv_gpios -- conduit_end.export
);
end architecture rtl; -- of cb20_gpio_block_0
| apache-2.0 | fe380d373d9dda8a6efeede480dec1ca | 0.522166 | 3.538324 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb/vhdl_sim/tb_ulpi_rx.vhd | 2 | 3,144 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity tb_ulpi_rx is
end entity;
architecture tb of tb_ulpi_rx is
signal clock : std_logic := '0';
signal reset : std_logic;
signal rx_data : std_logic_vector(7 downto 0) := X"00";
signal rx_last : std_logic := '0';
signal rx_valid : std_logic := '0';
signal rx_store : std_logic := '0';
signal pid : std_logic_vector(3 downto 0);
signal valid_token : std_logic;
signal token : std_logic_vector(10 downto 0);
signal valid_packet : std_logic;
signal data_out : std_logic_vector(7 downto 0);
signal data_valid : std_logic;
signal data_start : std_logic;
signal error : std_logic;
type t_std_logic_8_vector is array (natural range <>) of std_logic_vector(7 downto 0);
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_rx: entity work.usb1_ulpi_rx
port map (
clock => clock,
reset => reset,
rx_data => rx_data,
rx_last => rx_last,
rx_valid => rx_valid,
rx_store => rx_store,
pid => pid,
valid_token => valid_token,
token => token,
valid_packet => valid_packet,
data_out => data_out,
data_valid => data_valid,
data_start => data_start,
error => error );
process
procedure packet(pkt : t_std_logic_8_vector) is
begin
for i in pkt'range loop
wait until clock='1';
rx_data <= pkt(i);
rx_valid <= '1';
rx_store <= '1';
if i = pkt'right then
rx_last <= '1';
else
rx_last <= '0';
end if;
end loop;
wait until clock='1';
rx_valid <= '0';
rx_last <= '0';
wait until clock='1';
wait until clock='1';
wait until clock='1';
end procedure packet;
begin
wait until reset='0';
wait until clock='1';
packet((X"A5", X"63", X"A9"));
packet((X"4B", X"00", X"00")); -- data1, length=0, crc = 0000
packet((X"C3", X"00", X"01", X"02", X"03", X"04", X"05", X"06",
X"07", X"08", X"09", X"0A", X"0B", X"0C", X"0D", X"0E",
X"0F", X"10", X"19", X"44")); -- good crc
packet((X"C3", X"00", X"01", X"02", X"03", X"04", X"05", X"06",
X"07", X"08", X"09", X"03", X"0B", X"0C", X"0D", X"0E",
X"0F", X"10", X"19", X"44")); -- bad crc
packet((0=>X"D2")); -- good handshake
packet((0=>X"C3")); -- bad handshake (wrong pid data)
packet((0=>X"A5")); -- bad handshake (wrong pid token)
wait;
end process;
end tb;
| gpl-3.0 | 6dfbb379a193d15a1a4b56ec45cc6007 | 0.436069 | 3.536558 | false | false | false | false |
vzh/geda-gaf | utils/netlist/examples/vams/vhdl/basic-vhdl/spice_cs_arc.vhdl | 15 | 244 | ARCHITECTURE current_controlled OF spice_cs IS
QUANTITY v ACROSS i THROUGH urt TO lrt;
QUANTITY vc ACROSS ic THROUGH ult TO llt;
BEGIN
vc == 0.0;
i == N * ic;
-- i == ISS * (exp(v/(N * VT)) - 1.0);
END ARCHITECTURE current_controlled;
| gpl-2.0 | 8adc759e6007697d2eeb4e56206ad8a0 | 0.663934 | 3.05 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cart_slot/vhdl_source/reu.vhd | 1 | 18,932 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.reu_pkg.all;
use work.mem_bus_pkg.all;
use work.dma_bus_pkg.all;
use work.slot_bus_pkg.all;
-- Standard: 433 LUT/148 FF
-- Extended: 564 LUT/195 FF
entity reu is
generic (
g_ram_tag : std_logic_vector(7 downto 0) := X"10";
g_extended : boolean := true;
g_ram_base : unsigned(27 downto 0) := X"1000000" ); -- second (=upper 16M)
port (
clock : in std_logic;
reset : in std_logic;
-- register interface
slot_req : in t_slot_req;
slot_resp : out t_slot_resp;
write_ff00 : in std_logic;
-- system interface
phi2_tick : in std_logic := '0';
reu_dma_n : out std_logic := '1';
size_ctrl : in std_logic_vector(2 downto 0) := "001";
enable : in std_logic;
inhibit : in std_logic; -- to pause a transfer, because Ultimate menu is active
-- memory interface
mem_req : out t_mem_req;
mem_resp : in t_mem_resp;
dma_req : out t_dma_req;
dma_resp : in t_dma_resp );
end reu;
-- The REU is actually really simple.
-- There are 4 modes of operation, and 4 active states:
-- r = reu read, w = reu write, R = c64 read, W = c64 write
-- Copy from c64 to reu (00): Rw
-- Copy from reu to c64 (01): rW
-- Swap (10): rRwW (RrWw or rRWw or RrwW or rRwW)
-- Verify (11): rR (Rr or rR)
-- The smallest implementation is very likely when only one bit is needed to select between
-- transition options, and reducing the total number of transitions makes sense too.
architecture gideon of reu is
type t_state is (idle, do_read_c64, use_data, do_write_c64, do_read_reu, do_write_reu, reu_write_done, check_end, delay);
signal state : t_state;
attribute fsm_encoding : string;
attribute fsm_encoding of state : signal is "one-hot";
signal io_wdatau : unsigned(7 downto 0);
signal io_rdata : std_logic_vector(7 downto 0);
signal io_write : std_logic;
signal io_read : std_logic;
signal c64_base : unsigned(15 downto 0) := (others => '0');
signal reu_base : unsigned(23 downto 0) := (others => '0');
signal length_reg : unsigned(23 downto 0) := (others => '1');
signal c64_addr : unsigned(15 downto 0) := (others => '0');
signal reu_addr : unsigned(23 downto 0) := (others => '0');
signal count : unsigned(23 downto 0) := (others => '1');
signal c64_req : std_logic;
signal c64_rack : std_logic;
signal c64_dack : std_logic;
signal reu_req : std_logic;
signal reu_rack : std_logic;
signal reu_dack : std_logic;
signal glob_rwn : std_logic;
signal masked_reu_addr : unsigned(23 downto 0);
signal mask : unsigned(7 downto 0);
signal c64_read_reg : std_logic_vector(7 downto 0) := (others => '0');
signal reu_read_reg : std_logic_vector(7 downto 0) := (others => '0');
signal verify_error : std_logic;
signal trans_done : std_logic;
signal irq_pend : std_logic;
signal reserved : std_logic_vector(2 downto 0);
type t_control is record
irq_en : std_logic;
irq_done : std_logic;
irq_error : std_logic;
fix_reu : std_logic;
fix_c64 : std_logic;
end record;
type t_command is record
execute : std_logic;
autoload : std_logic;
ff00 : std_logic;
mode : std_logic_vector(1 downto 0);
end record;
constant c_control_def : t_control := (others => '0');
constant c_command_def : t_command := (
mode => "00",
execute => '0',
ff00 => '1',
autoload => '0' );
signal control : t_control;
signal command : t_command;
-- signals for extended mode
signal rate_div : unsigned(7 downto 0) := (others => '0');
signal start_delay : unsigned(7 downto 0) := (others => '0');
signal ext_count : unsigned(7 downto 0) := (others => '0');
begin
with size_ctrl select mask <=
"00000001" when "000",
"00000011" when "001",
"00000111" when "010",
"00001111" when "011",
"00011111" when "100",
"00111111" when "101",
"01111111" when "110",
"11111111" when others;
masked_reu_addr(23 downto 19) <= (reu_base(23 downto 19) and mask(7 downto 3)) when not g_extended else
(reu_addr(23 downto 19) and mask(7 downto 3));
masked_reu_addr(18 downto 16) <= (reu_addr(18 downto 16) and mask(2 downto 0));
masked_reu_addr(15 downto 0) <= reu_addr(15 downto 0);
reu_rack <= '1' when mem_resp.rack_tag = g_ram_tag else '0';
reu_dack <= '1' when mem_resp.dack_tag = g_ram_tag else '0';
io_wdatau <= unsigned(slot_req.data);
-- fill mem request structure
mem_req.tag <= g_ram_tag;
mem_req.request <= reu_req;
mem_req.address <= g_ram_base(25 downto 24) & masked_reu_addr;
mem_req.read_writen <= glob_rwn;
mem_req.data <= c64_read_reg;
mem_req.size <= "00"; -- 1 byte at a time
-- fill dma request structure
dma_req.request <= c64_req;
dma_req.address <= c64_addr;
dma_req.read_writen <= glob_rwn;
dma_req.data <= reu_read_reg;
c64_rack <= dma_resp.rack;
c64_dack <= dma_resp.dack;
p_main: process(clock)
procedure next_address is
begin
if control.fix_c64='0' then
c64_addr <= c64_addr + 1;
end if;
if control.fix_reu='0' then
reu_addr <= reu_addr + 1;
end if;
if (count(15 downto 0) = 1 and not g_extended) or
(count = 1 and g_extended) then
trans_done <= '1';
else
count <= count - 1;
end if;
end procedure;
procedure transfer_end is
begin
if command.autoload='1' then
c64_addr <= c64_base;
reu_addr <= reu_base(reu_addr'range);
if g_extended then
count <= length_reg;
else
count(15 downto 0) <= length_reg(15 downto 0);
end if;
end if;
command.ff00 <= '1'; -- reset to default state
state <= idle;
end procedure;
procedure dispatch is
begin
glob_rwn <= '1'; -- we're going to read.
case command.mode is
when c_mode_toreu => -- C64 to REU
c64_req <= '1';
state <= do_read_c64;
when others => -- in all other cases, read reu first
reu_req <= '1';
state <= do_read_reu;
end case;
end procedure;
variable r: unsigned(7 downto 0);
begin
if rising_edge(clock) then
r := "000" & slot_req.io_address(4 downto 0);
if io_write='1' then --$DF00-$DF1F, decoded below in a concurrent statement
case r is
when c_c64base_l => c64_base(7 downto 0) <= io_wdatau;
c64_addr <= c64_base(15 downto 8) & io_wdatau; -- half autoload bug
when c_c64base_h => c64_base(15 downto 8) <= io_wdatau;
c64_addr <= io_wdatau & c64_base(7 downto 0); -- half autoload bug
when c_reubase_l => reu_base(7 downto 0) <= io_wdatau;
reu_addr(15 downto 0) <= reu_base(15 downto 8) & io_wdatau; -- half autoload bug
when c_reubase_m => reu_base(15 downto 8) <= io_wdatau;
reu_addr(15 downto 0) <= io_wdatau & reu_base(7 downto 0); -- half autoload bug
when c_reubase_h => reu_base(23 downto 16) <= io_wdatau;
reu_addr(23 downto 16) <= io_wdatau;
when c_translen_l => length_reg(7 downto 0) <= io_wdatau;
count(15 downto 0) <= length_reg(15 downto 8) & io_wdatau; -- half autoload bug
when c_translen_h => length_reg(15 downto 8) <= io_wdatau;
count(15 downto 0) <= io_wdatau & length_reg(7 downto 0); -- half autoload bug
when c_irqmask =>
control.irq_en <= io_wdatau(7);
control.irq_done <= io_wdatau(6);
control.irq_error <= io_wdatau(5);
when c_control =>
control.fix_reu <= io_wdatau(6);
control.fix_c64 <= io_wdatau(7);
when c_command =>
command.execute <= io_wdatau(7);
reserved(2) <= io_wdatau(6);
command.autoload <= io_wdatau(5);
command.ff00 <= io_wdatau(4);
reserved(1) <= io_wdatau(3);
reserved(0) <= io_wdatau(2);
command.mode <= slot_req.data(1 downto 0);
when others =>
null;
end case;
end if;
-- extended registers
if io_write='1' and g_extended then --$DF00-$DF1F, decoded below in a concurrent statement
case r is
when c_start_delay =>
start_delay <= io_wdatau;
when c_rate_div =>
rate_div <= io_wdatau;
when c_translen_x =>
length_reg(23 downto 16) <= io_wdatau;
count(23 downto 16) <= io_wdatau;
when others =>
null;
end case;
end if;
-- clear on read flags
if io_read='1' then
if r = c_status then
verify_error <= '0';
trans_done <= '0';
end if;
end if;
case state is
when idle =>
reu_dma_n <= '1';
glob_rwn <= '1';
ext_count <= start_delay;
if command.execute='1' then
if (command.ff00='0' and write_ff00='1') or
(command.ff00='1') then
verify_error <= '0';
trans_done <= '0';
command.execute <= '0';
if g_extended then
state <= delay;
else
dispatch;
reu_dma_n <= '0';
end if;
end if;
end if;
when delay =>
if ext_count = 0 then
dispatch;
reu_dma_n <= '0';
elsif phi2_tick='1' then
ext_count <= ext_count - 1;
end if;
when do_read_reu =>
if reu_rack='1' then
reu_req <= '0';
end if;
if reu_dack='1' then
reu_read_reg <= mem_resp.data;
state <= use_data;
end if;
when use_data =>
if inhibit = '0' then
case command.mode is
when c_mode_swap | c_mode_verify =>
c64_req <= '1';
glob_rwn <= '1';
state <= do_read_c64;
when others =>
c64_req <= '1';
glob_rwn <= '0';
state <= do_write_c64;
end case;
end if;
when do_write_c64 =>
if c64_rack='1' then
c64_req <= '0';
next_address;
state <= check_end;
end if;
when do_read_c64 =>
if c64_rack='1' then
c64_req <= '0';
end if;
if c64_dack='1' then
c64_read_reg <= dma_resp.data;
case command.mode is
when c_mode_verify =>
if dma_resp.data /= reu_read_reg then
verify_error <= '1';
state <= idle;
else
next_address;
state <= check_end;
end if;
when others =>
reu_req <= '1';
glob_rwn <= '0';
state <= do_write_reu;
end case;
end if;
when do_write_reu =>
if reu_rack='1' then
reu_req <= '0';
state <= reu_write_done;
end if;
when reu_write_done =>
case command.mode is
when c_mode_swap =>
if inhibit = '0' then
c64_req <= '1';
glob_rwn <= '0';
state <= do_write_c64;
end if;
when others =>
next_address;
state <= check_end;
end case;
when check_end =>
ext_count <= rate_div;
if trans_done='1' then
transfer_end;
elsif g_extended then
state <= delay;
elsif inhibit = '0' then
dispatch;
end if;
when others =>
null;
end case;
if reset='1' then
reu_req <= '0';
c64_req <= '0';
glob_rwn <= '1';
control <= c_control_def;
command <= c_command_def;
state <= idle;
reserved <= (others => '0');
verify_error <= '0';
trans_done <= '0';
reu_dma_n <= '1';
c64_base <= (others => '0');
reu_base <= (others => '0');
length_reg <= X"00FFFF";
c64_addr <= (others => '0');
reu_addr <= (others => '0');
count <= (others => '1');
rate_div <= (others => '0');
start_delay <= (others => '0');
rate_div <= (others => '0');
ext_count <= (others => '0');
end if;
end if;
end process;
p_read: process(slot_req, control, command, count, c64_addr, reu_addr, verify_error, trans_done, irq_pend,
c64_base, reu_base, length_reg, reserved, mask, start_delay, rate_div)
variable r: unsigned(7 downto 0);
begin
io_rdata <= X"FF";
r := "000" & slot_req.bus_address(4 downto 0);
case r is
when c_status =>
io_rdata(7) <= irq_pend;
io_rdata(6) <= trans_done;
io_rdata(5) <= verify_error;
io_rdata(4) <= mask(1); -- for 256k and larger, this is set to '1'.
io_rdata(3 downto 0) <= X"0"; -- version
when c_command =>
io_rdata(7) <= command.execute;
io_rdata(6) <= reserved(2);
io_rdata(5) <= command.autoload;
io_rdata(4) <= command.ff00;
io_rdata(3 downto 2) <= reserved(1 downto 0);
io_rdata(1 downto 0) <= command.mode;
when c_irqmask =>
io_rdata(7) <= control.irq_en;
io_rdata(6) <= control.irq_done;
io_rdata(5) <= control.irq_error;
when c_control =>
io_rdata(7) <= control.fix_c64;
io_rdata(6) <= control.fix_reu;
when c_c64base_l => io_rdata <= std_logic_vector(c64_addr(7 downto 0));
when c_c64base_h => io_rdata <= std_logic_vector(c64_addr(15 downto 8));
when c_reubase_l => io_rdata <= std_logic_vector(reu_addr(7 downto 0));
when c_reubase_m => io_rdata <= std_logic_vector(reu_addr(15 downto 8));
when c_reubase_h =>
if g_extended then
io_rdata <= std_logic_vector(reu_addr(23 downto 16));
else
io_rdata <= "11111" & std_logic_vector(reu_addr(18 downto 16)); -- maximum 19 bits
end if;
when c_translen_l => io_rdata <= std_logic_vector(count(7 downto 0));
when c_translen_h => io_rdata <= std_logic_vector(count(15 downto 8));
when c_size_read => if g_extended then io_rdata <= std_logic_vector(mask); end if;
when c_start_delay => if g_extended then io_rdata <= std_logic_vector(start_delay); end if;
when c_rate_div => if g_extended then io_rdata <= std_logic_vector(rate_div); end if;
when others =>
null;
end case;
end process;
irq_pend <= control.irq_en and ((control.irq_done and trans_done) or (control.irq_error and verify_error));
slot_resp.nmi <= '0';
slot_resp.irq <= irq_pend;
slot_resp.data <= io_rdata;
slot_resp.reg_output <= enable when slot_req.bus_address(8 downto 5)=X"8" and
slot_req.bus_address(4 downto 3)/="11" and
(state = idle)
else '0';
io_write <= (enable and slot_req.io_write) when slot_req.io_address(8 downto 5)=X"8" else '0';
io_read <= (enable and slot_req.io_read) when slot_req.io_address(8 downto 5)=X"8" else '0';
end gideon;
| gpl-3.0 | cfae9bc125fbe201efc07b3b53394d87 | 0.433763 | 3.954878 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb2/vhdl_source/token_crc.vhd | 2 | 1,838 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2004, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : token_crc.vhd
-------------------------------------------------------------------------------
-- File : token_crc.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: This file is used to calculate the CRC over a USB token
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity token_crc is
port (
clock : in std_logic;
token_in : in std_logic_vector(10 downto 0);
crc : out std_logic_vector(4 downto 0) );
end token_crc;
architecture Gideon of token_crc is
-- CRC-5 = x5 + x2 + 1
constant polynom : std_logic_vector(4 downto 0) := "00101";
begin
process(clock)
variable tmp : std_logic_vector(crc'range);
variable d : std_logic;
begin
if rising_edge(clock) then
tmp := (others => '1');
for i in token_in'reverse_range loop -- LSB first!
d := tmp(tmp'high) xor token_in(i); -- loop xor
tmp := tmp(tmp'high-1 downto 0) & '0'; -- cyclic shift
if d = '1' then -- if highest bit was '1' then apply polynom
tmp := tmp xor polynom;
end if;
tmp(0) := d;
end loop;
for i in tmp'range loop -- reverse
crc(crc'high-i) <= not tmp(i);
end loop;
end if;
end process;
end Gideon;
| gpl-3.0 | 20d1921cd7fc7b3b71ef763e03ec29a0 | 0.401523 | 4.549505 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_source/drive_registers.vhd | 1 | 7,128 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.c1541_pkg.all;
entity drive_registers is
generic (
g_clock_freq : natural := 50_000_000;
g_multi_mode : boolean := false );
port (
clock : in std_logic;
reset : in std_logic;
tick_1kHz : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
iec_reset_o : in std_logic;
use_c64_reset : out std_logic;
power : out std_logic;
drv_reset : out std_logic;
drive_address : out std_logic_vector(1 downto 0);
floppy_inserted : out std_logic;
disk_change_n : out std_logic;
force_ready : out std_logic;
write_prot_n : out std_logic;
bank_is_ram : out std_logic_vector(7 downto 1);
stop_on_freeze : out std_logic;
drive_type : out natural range 0 to 2;
do_snd_insert : out std_logic;
do_snd_remove : out std_logic;
track : in unsigned(6 downto 0);
side : in std_logic := '0';
mode : in std_logic;
motor_on : in std_logic );
end;
architecture rtl of drive_registers is
signal power_i : std_logic;
signal drv_reset_i : std_logic;
signal use_c64_reset_i : std_logic;
signal drive_address_i : std_logic_vector(1 downto 0);
signal sensor_i : std_logic;
signal bank_is_ram_i : std_logic_vector(7 downto 1);
signal inserted_i : std_logic;
signal disk_change_i : std_logic;
signal force_ready_i : std_logic;
signal stop_when_frozen : std_logic;
signal drive_type_i : std_logic_vector(1 downto 0);
signal write_delay : unsigned(10 downto 0); -- max 2047 = 2 sec
signal write_busy : std_logic;
signal manual_write : std_logic;
begin
p_reg: process(clock)
begin
if rising_edge(clock) then
io_resp <= c_io_resp_init;
manual_write <= '0';
do_snd_insert <= '0';
do_snd_remove <= '0';
if io_req.write='1' then
io_resp.ack <= '1';
case io_req.address(3 downto 0) is
when c_drvreg_power =>
power_i <= io_req.data(0);
when c_drvreg_reset =>
drv_reset_i <= io_req.data(0);
use_c64_reset_i <= io_req.data(1);
stop_when_frozen <= io_req.data(2);
when c_drvreg_address =>
drive_address_i <= io_req.data(1 downto 0);
when c_drvreg_sensor =>
sensor_i <= io_req.data(0);
when c_drvreg_inserted =>
inserted_i <= io_req.data(0);
when c_drvreg_rammap =>
bank_is_ram_i <= io_req.data(7 downto 1);
when c_drvreg_man_write =>
manual_write <= '1';
when c_drvreg_diskchng =>
disk_change_i <= io_req.data(0);
force_ready_i <= io_req.data(1);
when c_drvreg_drivetype =>
if g_multi_mode then
drive_type_i <= io_req.data(1 downto 0);
end if;
when c_drvreg_sound =>
do_snd_insert <= io_req.data(0);
do_snd_remove <= io_req.data(1);
when others =>
null;
end case;
end if; -- write
if io_req.read='1' then
io_resp.ack <= '1';
case io_req.address(3 downto 0) is
when c_drvreg_power =>
io_resp.data(0) <= power_i;
when c_drvreg_reset =>
io_resp.data(0) <= drv_reset_i;
io_resp.data(1) <= use_c64_reset_i;
io_resp.data(2) <= stop_when_frozen;
when c_drvreg_address =>
io_resp.data(1 downto 0) <= drive_address_i;
when c_drvreg_sensor =>
io_resp.data(0) <= sensor_i;
when c_drvreg_inserted =>
io_resp.data(0) <= inserted_i;
when c_drvreg_rammap =>
io_resp.data <= bank_is_ram_i & '0';
when c_drvreg_diskchng =>
io_resp.data(0) <= disk_change_i;
io_resp.data(1) <= force_ready_i;
when c_drvreg_drivetype =>
if g_multi_mode then
io_resp.data(1 downto 0) <= drive_type_i;
end if;
when c_drvreg_track =>
io_resp.data(6 downto 0) <= std_logic_vector(track(6 downto 0));
when c_drvreg_side =>
io_resp.data(0) <= side;
when c_drvreg_status =>
io_resp.data(0) <= motor_on;
io_resp.data(1) <= not mode; -- mode is '0' when writing
io_resp.data(2) <= write_busy;
when others =>
null;
end case;
end if; -- read
drv_reset <= drv_reset_i or iec_reset_o;
if reset='1' then
power_i <= '0';
drv_reset_i <= '1';
drive_address_i <= (others => '0');
sensor_i <= '0';
bank_is_ram_i <= (others => '0');
inserted_i <= '0';
disk_change_i <= '0';
use_c64_reset_i <= '1';
stop_when_frozen <= '1';
force_ready_i <= '0';
drive_type_i <= "00";
end if;
end if;
end process;
process(clock)
begin
if rising_edge(clock) then
if drv_reset_i = '1' then
write_busy <= '0';
write_delay <= (others => '0');
elsif (mode = '0' and motor_on = '1') or manual_write = '1' then
write_busy <= '1';
write_delay <= (others => '1');
elsif write_delay = 0 then
write_busy <= '0';
elsif tick_1kHz = '1' then
write_delay <= write_delay - 1;
end if;
end if;
end process;
power <= power_i;
drive_address <= drive_address_i;
floppy_inserted <= inserted_i;
disk_change_n <= not disk_change_i;
write_prot_n <= sensor_i;
bank_is_ram <= bank_is_ram_i;
use_c64_reset <= use_c64_reset_i;
stop_on_freeze <= stop_when_frozen;
force_ready <= force_ready_i;
drive_type <= to_integer(unsigned(drive_type_i));
end architecture;
| gpl-3.0 | 0f08307121c940380621cb261d03d250 | 0.43757 | 3.716371 | false | false | false | false |
markusC64/1541ultimate2 | target/simulation/vhdl_bfm/dram_8.vhd | 2 | 5,044 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2010 - Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : DRAM model
-------------------------------------------------------------------------------
-- File : dram_model_8.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: This simple DRAM model uses the flat memory model package.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.tl_string_util_pkg.all;
entity dram_8 is
generic (
g_cas_latency : positive := 3;
g_burst_len_r : positive := 4;
g_burst_len_w : positive := 4;
g_column_bits : positive := 10;
g_row_bits : positive := 13;
g_bank_bits : positive := 2 );
port (
CLK : in std_logic;
CKE : in std_logic;
A : in std_logic_vector(g_row_bits-1 downto 0);
BA : in std_logic_vector(g_bank_bits-1 downto 0);
CSn : in std_logic;
RASn : in std_logic;
CASn : in std_logic;
WEn : in std_logic;
DQM : in std_logic;
DQ : inout std_logic_vector(7 downto 0) );
end entity;
architecture bfm of dram_8 is
signal command : std_logic_vector(2 downto 0);
constant c_banks : integer := 2 ** g_bank_bits;
type t_row_array is array(0 to c_banks-1) of std_logic_vector(g_row_bits-1 downto 0);
signal bank_rows : t_row_array;
signal bank : integer;
type t_byte_array is array(natural range <>) of std_logic_vector(7 downto 0);
signal r_queue : t_byte_array(0 to g_cas_latency + g_burst_len_r) := (others => (others => 'Z'));
-- constant c_col : integer := 0;
-- constant c_bank : integer := g_column_bits;
-- constant c_row : integer := g_column_bits + g_bank_bits;
shared variable mem_array : t_byte_array(0 to 16#FFFFFF#) := (others => X"33");
begin
command <= WEn & CASn & RASn;
bank <= to_integer(unsigned(BA));
DQ <= transport r_queue(0) after 6 ns;
process(CLK)
variable raddr : natural := 0;
variable waddr : natural := 0;
variable more_writes : integer := 0;
function map_address(bank_bits : std_logic_vector(g_bank_bits-1 downto 0);
row_bits : std_logic_vector(g_row_bits-1 downto 0);
col_bits : std_logic_vector(g_column_bits-1 downto 0) ) return integer is
variable ret : std_logic_vector(31 downto 0) := (others => '0');
begin
ret(g_column_bits-1 downto 0) := col_bits;
ret(g_column_bits+g_bank_bits-1 downto g_column_bits) := bank_bits;
ret(g_column_bits+g_bank_bits+g_row_bits-1 downto g_column_bits+g_bank_bits) := row_bits;
return to_integer(unsigned(ret(23 downto 0)));
end function;
begin
if rising_edge(CLK) then
if CKE='1' then
r_queue <= r_queue(1 to r_queue'high) & ("ZZZZZZZZ");
if more_writes > 0 then
waddr := waddr + 1;
if (waddr mod g_burst_len_w) = 0 then
waddr := waddr - g_burst_len_w;
end if;
if DQM='0' then
mem_array(waddr) := DQ;
end if;
more_writes := more_writes - 1;
end if;
if CSn='0' then
case command is
when "110" => -- RAS, register bank address
bank_rows(bank) <= A(g_row_bits-1 downto 0);
when "101" => -- CAS, start read burst
raddr := map_address(BA, bank_rows(bank), A(g_column_bits-1 downto 0));
for i in 0 to g_burst_len_r-1 loop
r_queue(g_cas_latency-1 + i) <= mem_array(raddr);
raddr := raddr + 1;
if (raddr mod g_burst_len_r) = 0 then
raddr := raddr - g_burst_len_r;
end if;
end loop;
when "001" => -- CAS & WE, start write burst
waddr := map_address(BA, bank_rows(bank), A(g_column_bits-1 downto 0));
more_writes := g_burst_len_w - 1;
if DQM='0' then
mem_array(waddr) := DQ;
end if;
when others =>
null;
end case;
end if;
end if;
end if;
end process;
end bfm;
| gpl-3.0 | 126ece175d93cdeb1e9e3f1d4331b31b | 0.444489 | 3.888975 | false | false | false | false |
chiggs/nvc | test/sem/issue162.vhd | 5 | 1,143 | package ambiguous is
end package;
package body ambiguous is
procedure proc(arg1 : integer;
arg2 : boolean := false) is
begin
end procedure;
procedure proc(arg2 : boolean := false) is
begin
end procedure;
procedure calling_proc is
begin
proc; -- Works
proc(false); -- Works
proc(1, false); -- Works
proc(arg1 => 1, arg2 => true); -- Works
proc(arg2 => true); -- Adding the named argument cause error on ambiguous call
end procedure;
function fun(arg1 : integer;
arg2 : boolean := false) return integer is
begin
return 1;
end function;
function fun(arg2 : boolean := false) return integer is
begin
return 0;
end function;
function calling_fun_works(arg2 : boolean := false) return integer is
begin
-- Works
assert fun(true) = 0;
assert fun(1, true) = 0;
assert fun(arg1 => 1, arg2 => true) = 0;
return 0;
end function;
function calling_fun(arg2 : boolean := false) return integer is
begin
return fun(arg2 => true); -- Adding named argument cause error on ambiguous call
end function;
end package body;
| gpl-3.0 | e7a937b62e547c30699b471a6b592dd3 | 0.63867 | 3.901024 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cpu_unit/mblite/hw/std/sram_4en.vhd | 2 | 2,971 | ----------------------------------------------------------------------------------------------
--
-- Input file : sram_4en.vhd
-- Design name : sram_4en
-- Author : Tamar Kranenburg
-- Company : Delft University of Technology
-- : Faculty EEMCS, Department ME&CE
-- : Systems and Circuits group
--
-- Description : Single Port Synchronous Random Access Memory with 4 write enable
-- ports.
-- Architecture 'arch' : Default implementation
-- Architecture 'arch2' : Alternative implementation
--
----------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library mblite;
use mblite.std_Pkg.all;
entity sram_4en is generic
(
WIDTH : positive := 32;
SIZE : positive := 16
);
port
(
dat_o : out std_logic_vector(WIDTH - 1 downto 0);
dat_i : in std_logic_vector(WIDTH - 1 downto 0);
adr_i : in std_logic_vector(SIZE - 1 downto 0);
wre_i : in std_logic_vector(WIDTH/8 - 1 downto 0);
ena_i : in std_logic;
clk_i : in std_logic
);
end sram_4en;
-- Although this memory is very easy to use in conjunction with Modelsims mem load, it is not
-- supported by many devices (although it comes straight from the library. Many devices give
-- cryptic synthesization errors on this implementation, so it is not the default.
architecture arch2 of sram_4en is
type ram_type is array(2 ** SIZE - 1 downto 0) of std_logic_vector(WIDTH - 1 downto 0);
type sel_type is array(WIDTH/8 - 1 downto 0) of std_logic_vector(7 downto 0);
signal ram: ram_type;
signal di: sel_type;
begin
process(wre_i, dat_i, adr_i)
begin
for i in 0 to WIDTH/8 - 1 loop
if wre_i(i) = '1' then
di(i) <= dat_i((i+1)*8 - 1 downto i*8);
else
di(i) <= ram(my_conv_integer(adr_i))((i+1)*8 - 1 downto i*8);
end if;
end loop;
end process;
process(clk_i)
begin
if rising_edge(clk_i) then
if ena_i = '1' then
ram(my_conv_integer(adr_i)) <= di(3) & di(2) & di(1) & di(0);
dat_o <= di(3) & di(2) & di(1) & di(0);
end if;
end if;
end process;
end arch2;
-- Less convenient but very general memory block with four separate write
-- enable signals. (4x8 bit)
architecture arch of sram_4en is
begin
mem: for i in 0 to WIDTH/8 - 1 generate
mem : sram generic map
(
WIDTH => 8,
SIZE => SIZE
)
port map
(
dat_o => dat_o((i+1)*8 - 1 downto i*8),
dat_i => dat_i((i+1)*8 - 1 downto i*8),
adr_i => adr_i,
wre_i => wre_i(i),
ena_i => ena_i,
clk_i => clk_i
);
end generate;
end arch;
| gpl-3.0 | b7c6d913437973fc73176f9bb9e32d0b | 0.513295 | 3.636475 | false | false | false | false |
markusC64/1541ultimate2 | fpga/devices/vhdl_source/microwire_eeprom.vhd | 1 | 9,355 | --------------------------------------------------------------------------------
-- Entity: microwire_eeprom
-- Date:2018-08-13
-- Author: gideon
--
-- Description: Emulation of ST M93C86 Microwire EEPROM.
-- The I/O interface enables the software to read/write directly to
-- the 2K embedded memory. The range is 4K. The lower 2K give access
-- to the "dirty" bit register. The upper 2K is memory.
-- This emulation supports multiple write, continuous read as well
-- as single and full erase operations. It does support the status
-- output, however, the output is not gated with the select input.
-- When used as a standalone, data_out shall be tristated when SEL
-- is 0.
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
entity microwire_eeprom is
port (
clock : in std_logic;
reset : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
-- microwire bus
sel_in : in std_logic;
clk_in : in std_logic;
data_in : in std_logic;
data_out : out std_logic );
end entity;
architecture arch of microwire_eeprom is
type t_state is (idle, selected, instruction, decode, collect_data, wait_deselect, execute, write2, error, fill, reading );
signal state : t_state;
signal sel_c : std_logic;
signal sel_d : std_logic;
signal dat_c : std_logic;
signal dat_d : std_logic;
signal clk_c : std_logic;
signal clk_d : std_logic;
signal clk_d2 : std_logic;
signal mem_io_rdata : std_logic_vector(7 downto 0);
signal mem_io_en : std_logic;
signal mem_io_en_d : std_logic;
signal mem_rdata : std_logic_vector(7 downto 0);
signal mem_wdata : std_logic_vector(7 downto 0);
signal mem_en : std_logic;
signal mem_en_d : std_logic := '0';
signal mem_we : std_logic;
signal mem_address : unsigned(10 downto 0);
signal count : integer range 0 to 15;
signal write_enable : std_logic;
signal instr : std_logic_vector(11 downto 0);
signal data_word : std_logic_vector(15 downto 0);
signal dirty : std_logic;
begin
mem_io_en <= io_req.address(11) and (io_req.read or io_req.write);
i_mem: entity work.dpram
generic map (
g_width_bits => 8,
g_depth_bits => 11
)
port map(
a_clock => clock,
a_address => io_req.address(10 downto 0),
a_rdata => mem_io_rdata,
a_wdata => io_req.data,
a_en => mem_io_en,
a_we => io_req.write,
b_clock => clock,
b_address => mem_address,
b_rdata => mem_rdata,
b_wdata => mem_wdata,
b_en => mem_en,
b_we => mem_we
);
process(clock)
begin
if rising_edge(clock) then
io_resp <= c_io_resp_init;
mem_io_en_d <= mem_io_en;
if mem_io_en_d = '1' then
io_resp.ack <= '1';
io_resp.data <= mem_io_rdata;
elsif io_req.read = '1' and io_req.address(11) = '0' then -- registers
io_resp.data(0) <= dirty;
io_resp.ack <= '1';
elsif io_req.write = '1' and io_req.address(11) = '0' then -- registers
dirty <= '0';
io_resp.ack <= '1';
end if;
if mem_we = '1' then
dirty <= '1';
end if;
sel_c <= sel_in;
sel_d <= sel_c;
dat_c <= data_in;
dat_d <= dat_c;
clk_c <= clk_in;
clk_d <= clk_c;
clk_d2 <= clk_d;
mem_en <= '0';
mem_we <= '0';
mem_en_d <= mem_en;
case state is
when idle =>
count <= 11;
data_out <= '1'; -- ready
data_word <= (others => '1');
if sel_d = '1' then
state <= selected;
end if;
when selected =>
if sel_d = '0' then
state <= idle;
elsif clk_d = '1' and clk_d2 = '0' then -- rising edge
if dat_d = '1' then
state <= instruction;
else
state <= error;
end if;
end if;
when instruction =>
if sel_d = '0' then
state <= idle;
elsif clk_d = '1' and clk_d2 = '0' then -- rising edge
instr <= instr(instr'high-1 downto 0) & dat_d;
if count = 0 then
state <= decode;
else
count <= count - 1;
end if;
end if;
when decode =>
count <= 15;
if instr(11 downto 10) = "01" then -- WRITE
state <= collect_data;
elsif instr(11 downto 8) = "0001" then -- WRALL
state <= collect_data;
elsif instr(11 downto 10) = "10" then -- READ
mem_address <= unsigned(instr(9 downto 0)) & '0';
mem_en <= '1';
state <= reading;
else
state <= wait_deselect;
end if;
when collect_data =>
if sel_d = '0' then
state <= idle;
elsif clk_d = '1' and clk_d2 = '0' then -- rising edge
data_word <= data_word(14 downto 0) & dat_d;
if count = 0 then
state <= wait_deselect;
else
count <= count - 1;
end if;
end if;
when wait_deselect =>
if clk_d = '1' and clk_d2 = '0' then -- rising edge
state <= error;
elsif sel_d = '0' then
state <= execute;
end if;
when execute =>
data_out <= '0';
if instr(10) = '1' then -- WRITE or ERASE single
mem_address <= unsigned(instr(9 downto 0)) & '0';
mem_wdata <= data_word(15 downto 8);
mem_en <= '1';
mem_we <= write_enable;
state <= write2;
elsif instr(11 downto 8) = "0011" then -- WREN
write_enable <= '1';
state <= idle;
elsif instr(11 downto 8) = "0000" then -- WRDIS
write_enable <= '0';
state <= idle;
elsif instr(11 downto 8) = "0010" then -- ERAL
mem_address <= (others => '0');
state <= fill;
elsif instr(11 downto 8) = "0001" then -- WRALL
mem_address <= (others => '0');
state <= fill;
else
state <= idle;
end if;
when error =>
if sel_d = '0' then
state <= idle;
end if;
when fill =>
mem_en <= '1';
mem_we <= write_enable;
if mem_address(0) = '1' then
mem_wdata <= data_word(7 downto 0);
else
mem_wdata <= data_word(15 downto 8);
end if;
if signed(mem_address) = -1 then
state <= idle;
else
mem_address <= mem_address + 1;
end if;
when write2 =>
mem_en <= '1';
mem_we <= write_enable;
mem_wdata <= data_word(7 downto 0);
mem_address(0) <= '1';
state <= idle;
when reading =>
if mem_en_d = '1' then
data_word(7 downto 0) <= mem_rdata;
count <= 7;
end if;
if sel_d = '0' then
state <= idle;
elsif clk_d = '1' and clk_d2 = '0' then -- rising edge
data_out <= data_word(count);
if count = 0 then
mem_address <= mem_address + 1;
mem_en <= '1';
else
count <= count - 1;
end if;
end if;
when others =>
null;
end case;
if reset = '1' then
state <= idle;
write_enable <= '0';
count <= 0;
dirty <= '0';
mem_address <= (others => '0');
end if;
end if;
end process;
end architecture;
| gpl-3.0 | 6272d83ad54d284914c7bfdc81951c4c | 0.401283 | 4.248411 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_source/c1581_drive.vhd | 1 | 11,133 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.mem_bus_pkg.all;
entity c1581_drive is
generic (
g_big_endian : boolean;
g_audio_tag : std_logic_vector(7 downto 0) := X"01";
g_disk_tag : std_logic_vector(7 downto 0) := X"02";
g_cpu_tag : std_logic_vector(7 downto 0) := X"04";
g_audio : boolean := true;
g_audio_base : unsigned(27 downto 0) := X"0030000";
g_ram_base : unsigned(27 downto 0) := X"0060000" );
port (
clock : in std_logic;
reset : in std_logic;
drive_stop : in std_logic := '0';
-- timing
tick_4MHz : in std_logic;
tick_1KHz : in std_logic;
-- slave port on io bus
io_req : in t_io_req;
io_resp : out t_io_resp;
io_irq : out std_logic;
-- master port on memory bus
mem_req : out t_mem_req_32;
mem_resp : in t_mem_resp_32;
-- serial bus pins
atn_o : out std_logic; -- open drain
atn_i : in std_logic;
clk_o : out std_logic; -- open drain
clk_i : in std_logic;
data_o : out std_logic; -- open drain
data_i : in std_logic;
fast_clk_o : out std_logic; -- open drain
fast_clk_i : in std_logic;
-- Misc
iec_reset_n : in std_logic := '1';
c64_reset_n : in std_logic := '1';
-- LED
act_led_n : out std_logic;
power_led_n : out std_logic;
motor_led_n : out std_logic;
-- audio out
audio_sample : out signed(12 downto 0) := (others => '0'));
end entity;
architecture structural of c1581_drive is
signal cpu_clock_en : std_logic;
signal iec_reset_o : std_logic;
signal do_track_out : std_logic := '0';
signal do_track_in : std_logic := '0';
signal do_head_bang : std_logic := '0';
signal en_hum : std_logic := '0';
signal en_slip : std_logic := '0';
signal use_c64_reset : std_logic;
signal floppy_inserted : std_logic := '0';
signal force_ready : std_logic;
signal power : std_logic;
signal motor_on : std_logic;
signal side_0 : std_logic;
signal cur_track : unsigned(6 downto 0) := (others => '1');
signal drive_address : std_logic_vector(1 downto 0) := "00";
signal write_prot_n : std_logic := '1';
signal disk_change_n : std_logic := '1';
signal rdy_n : std_logic := '1';
signal drv_reset : std_logic := '1';
signal drive_stop_i : std_logic;
signal stop_on_freeze : std_logic;
signal io_req_regs : t_io_req;
signal io_resp_regs : t_io_resp;
signal io_req_dirty : t_io_req;
signal io_resp_dirty : t_io_resp;
signal io_req_param : t_io_req;
signal io_resp_param : t_io_resp;
signal io_req_wd : t_io_req;
signal io_resp_wd : t_io_resp;
signal mem_req_cpu : t_mem_req;
signal mem_resp_cpu : t_mem_resp;
signal mem_req_disk : t_mem_req;
signal mem_resp_disk : t_mem_resp;
signal mem_req_snd : t_mem_req := c_mem_req_init;
signal mem_resp_snd : t_mem_resp;
signal mem_req_8 : t_mem_req := c_mem_req_init;
signal mem_resp_8 : t_mem_resp;
signal mem_busy : std_logic;
signal count : unsigned(7 downto 0) := X"00";
signal led_intensity : unsigned(1 downto 0);
begin
-- IO bus split
i_splitter: entity work.io_bus_splitter
generic map (
g_range_lo => 11,
g_range_hi => 12,
g_ports => 4
)
port map(
clock => clock,
req => io_req,
resp => io_resp,
reqs(0) => io_req_regs,
reqs(1) => io_req_dirty,
reqs(2) => io_req_param,
reqs(3) => io_req_wd,
resps(0) => io_resp_regs,
resps(1) => io_resp_dirty,
resps(2) => io_resp_param,
resps(3) => io_resp_wd
);
i_dummy_dirty: entity work.io_dummy
port map (
clock => clock,
io_req => io_req_dirty,
io_resp => io_resp_dirty
);
i_dummy_param: entity work.io_dummy
port map (
clock => clock,
io_req => io_req_param,
io_resp => io_resp_param
);
i_timing: entity work.c1541_timing
port map (
clock => clock,
reset => reset,
tick_4MHz => tick_4MHz,
two_MHz_mode => '1',
mem_busy => mem_busy,
use_c64_reset=> use_c64_reset,
c64_reset_n => c64_reset_n,
iec_reset_n => iec_reset_n,
iec_reset_o => iec_reset_o,
power => power,
drive_stop => drive_stop_i,
cpu_clock_en => cpu_clock_en ); -- 2 MHz
drive_stop_i <= drive_stop and stop_on_freeze;
i_cpu: entity work.cpu_part_1581
generic map (
g_cpu_tag => g_cpu_tag,
g_disk_tag => g_disk_tag,
g_ram_base => g_ram_base )
port map (
clock => clock,
falling => cpu_clock_en,
reset => drv_reset,
tick_1kHz => tick_1kHz,
tick_4MHz => tick_4MHz,
-- serial bus pins
atn_o => atn_o, -- open drain
atn_i => atn_i,
clk_o => clk_o, -- open drain
clk_i => clk_i,
data_o => data_o, -- open drain
data_i => data_i,
fast_clk_o => fast_clk_o, -- open drain
fast_clk_i => fast_clk_i,
-- memory interface
mem_req_cpu => mem_req_cpu,
mem_resp_cpu => mem_resp_cpu,
mem_req_disk => mem_req_disk,
mem_resp_disk => mem_resp_disk,
mem_busy => mem_busy,
-- i/o interface to wd177x
io_req => io_req_wd,
io_resp => io_resp_wd,
io_irq => io_irq,
-- stepper interface
do_track_out => do_track_out,
do_track_in => do_track_in,
-- drive pins
power => power,
drive_address => drive_address,
write_prot_n => write_prot_n,
motor_on => motor_on,
rdy_n => rdy_n,
disk_change_n => disk_change_n,
side_0 => side_0,
cur_track => cur_track,
-- other
power_led => power_led_n,
act_led => act_led_n );
rdy_n <= not (motor_on and floppy_inserted) and not force_ready; -- should have a delay
-- Bare minimum drive mechanics.. :-D
process(clock)
begin
if rising_edge(clock) then
if reset = '1' then
cur_track <= (others => '0');
elsif do_track_in = '1' and cur_track /= 83 then
cur_track <= cur_track + 1;
elsif do_track_out = '1' and cur_track /= 0 then
cur_track <= cur_track - 1;
end if;
end if;
end process;
r_snd: if g_audio generate
begin
en_hum <= motor_on and not floppy_inserted;
en_slip <= motor_on and floppy_inserted;
i_snd: entity work.floppy_sound
generic map (
g_tag => g_audio_tag,
sound_base => g_audio_base(26 downto 15),
motor_hum_addr => X"0000",
flop_slip_addr => X"1200",
track_in_addr => X"2400",
track_out_addr => X"2C00",
head_bang_addr => X"3480",
motor_len => 4410,
track_in_len => X"0800", -- ~100 ms;
track_out_len => X"0880", -- ~100 ms;
head_bang_len => X"0880" ) -- ~100 ms;
port map (
clock => clock,
reset => drv_reset,
tick_4MHz => tick_4MHz,
do_trk_out => do_track_out,
do_trk_in => do_track_in,
do_head_bang => do_head_bang,
en_hum => en_hum,
en_slip => en_slip,
-- memory interface
mem_req => mem_req_snd,
mem_resp => mem_resp_snd,
-- audio
sample_out => audio_sample );
end generate;
i_regs: entity work.drive_registers
port map (
clock => clock,
reset => reset,
tick_1kHz => tick_1kHz,
io_req => io_req_regs,
io_resp => io_resp_regs,
iec_reset_o => iec_reset_o,
use_c64_reset => use_c64_reset,
power => power,
drv_reset => drv_reset,
drive_address => drive_address,
floppy_inserted => floppy_inserted,
disk_change_n => disk_change_n,
force_ready => force_ready,
write_prot_n => write_prot_n,
stop_on_freeze => stop_on_freeze,
track => cur_track,
mode => side_0,
motor_on => motor_on );
-- memory arbitration
i_arb: entity work.mem_bus_arbiter_pri
generic map (
g_ports => 3,
g_registered => false )
port map (
clock => clock,
reset => reset,
reqs(0) => mem_req_cpu,
reqs(1) => mem_req_disk,
reqs(2) => mem_req_snd,
resps(0) => mem_resp_cpu,
resps(1) => mem_resp_disk,
resps(2) => mem_resp_snd,
req => mem_req_8,
resp => mem_resp_8 );
i_conv32: entity work.mem_to_mem32(route_through)
generic map (
g_big_endian => g_big_endian )
port map(
clock => clock,
reset => reset,
mem_req_8 => mem_req_8,
mem_resp_8 => mem_resp_8,
mem_req_32 => mem_req,
mem_resp_32 => mem_resp );
process(clock)
variable led_int : unsigned(7 downto 0);
begin
if rising_edge(clock) then
count <= count + 1;
if count=X"00" then
motor_led_n <= '0'; -- on
end if;
led_int := led_intensity & led_intensity & led_intensity & led_intensity;
if count=led_int then
motor_led_n <= '1'; -- off
end if;
end if;
end process;
led_intensity <= "00" when power='0' else
"01" when floppy_inserted='0' else
"10" when motor_on='0' else
"11";
end architecture;
| gpl-3.0 | 60a1d528bf2032fa57a31a6772cd42ff | 0.453427 | 3.408757 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb2/vhdl_source/token_crc_19.vhd | 2 | 1,790 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2004, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : token_crc.vhd
-------------------------------------------------------------------------------
-- File : token_crc.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: This file is used to calculate the CRC over a USB token
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity token_crc_19 is
port (
clock : in std_logic;
token_in : in std_logic_vector(18 downto 0);
crc : out std_logic_vector(4 downto 0) );
end token_crc_19;
architecture Gideon of token_crc_19 is
-- CRC-5 = x5 + x2 + 1
constant polynom : std_logic_vector(4 downto 0) := "00101";
begin
process(clock)
variable tmp : std_logic_vector(crc'range);
variable d : std_logic;
begin
if rising_edge(clock) then
tmp := (others => '1');
L1: for i in token_in'reverse_range loop -- LSB first!
d := token_in(i) xor tmp(tmp'high);
tmp := tmp(tmp'high-1 downto 0) & '0';
if d = '1' then
tmp := tmp xor polynom;
end if;
tmp(0) := d;
end loop;
for i in tmp'range loop -- reverse and invert
crc(crc'high-i) <= not(tmp(i));
end loop;
end if;
end process;
end Gideon;
| gpl-3.0 | 1ac8cccaa9b6e0b0931dbbf9e9eb3705 | 0.393855 | 4.497487 | false | false | false | false |
trondd/mkjpeg | design/common/JPEG_PKG.vhd | 1 | 2,508 | --------------------------------------------------------------------------------
-- --
-- V H D L F I L E --
-- COPYRIGHT (C) 2009 --
-- --
--------------------------------------------------------------------------------
--
-- Title : JPEG_PKG
-- Design : JPEG_ENC
-- Author : Michal Krepa
--
--------------------------------------------------------------------------------
--
-- File : JPEG_PKG.VHD
-- Created : Sat Mar 7 2009
--
--------------------------------------------------------------------------------
--
-- Description : Package for JPEG core
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.numeric_std.all;
package JPEG_PKG is
-- do not change, constant
constant C_HDR_SIZE : integer := 623;
-- warning! this parameter heavily affects memory size required
-- if expected image width is known change this parameter to match this
-- otherwise some onchip RAM will be wasted and never used
constant C_MAX_LINE_WIDTH : integer := 2048;
-- memory/performance tradeoff
-- 8 extra lines highest performance
-- 0 extra lines lowest area
constant C_EXTRA_LINES : integer := 8; -- from 0 to 8
-- 24 bit format RGB/YCbCr 888 bits
-- 16 bit format RGB/YCbCr 565 bits
constant C_PIXEL_BITS : integer := 24;
-- 0 = RGB
-- 1 = YUV/YCbCr
constant C_YUV_INPUT : std_logic := '0';
type T_SM_SETTINGS is record
x_cnt : unsigned(15 downto 0);
y_cnt : unsigned(15 downto 0);
cmp_idx : unsigned(2 downto 0);
end record;
constant C_SM_SETTINGS : T_SM_SETTINGS :=
(
(others => '0'),
(others => '0'),
(others => '0')
);
function log2(n : natural) return natural;
end package JPEG_PKG;
package body JPEG_PKG is
-----------------------------------------------------------------------------
function log2(n : natural)
return natural is
begin
for i in 0 to 31 loop
if (2**i) >= n then
return i;
end if;
end loop;
return 32;
end log2;
-----------------------------------------------------------------------------
end package body JPEG_PKG; | lgpl-3.0 | 4f11c76199da76a5b1b7562e777b85b6 | 0.394737 | 5.026052 | false | false | false | false |
armandas/Arcade | plong_graphics.vhd | 1 | 15,386 | library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity plong_graphics is
port(
clk, not_reset: in std_logic;
nes1_up, nes1_down: in std_logic;
nes2_up, nes2_down: in std_logic;
nes1_start, nes2_start: in std_logic;
px_x, px_y: in std_logic_vector(9 downto 0);
video_on: in std_logic;
rgb_stream: out std_logic_vector(2 downto 0);
ball_bounced: out std_logic;
ball_missed: out std_logic
);
end plong_graphics;
architecture dispatcher of plong_graphics is
constant SCREEN_WIDTH: integer := 640;
constant SCREEN_HEIGHT: integer := 480;
type game_states is (start, waiting, playing, game_over);
signal state, state_next: game_states;
type counter_storage is array(0 to 3) of std_logic_vector(17 downto 0);
constant COUNTER_VALUES: counter_storage :=
(
"110010110111001101", -- 208333
"101000101100001011", -- 166667
"100001111010001001", -- 138889
"011101000100001000" -- 119048
);
-- counters to determine ball control frequency
signal ball_control_counter,
ball_control_counter_next: std_logic_vector(17 downto 0);
signal ball_control_value: integer;
-- counts how many times the ball hits the bar
-- used to determine ball speed
signal bounce_counter, bounce_counter_next: std_logic_vector(7 downto 0);
constant MIDDLE_LINE_POS: integer := SCREEN_WIDTH / 2;
signal middle_line_on: std_logic;
signal middle_line_rgb: std_logic_vector(2 downto 0);
signal score_1, score_1_next: std_logic_vector(5 downto 0);
signal score_2, score_2_next: std_logic_vector(5 downto 0);
signal score_on: std_logic;
signal current_score: std_logic_vector(5 downto 0);
signal score_font_addr: std_logic_vector(8 downto 0);
-- message format is "PLAYER p WINS!"
-- where p is replaced by player_id
signal message_on, player_id_on: std_logic;
signal message_font_addr, player_id_font_addr: std_logic_vector(8 downto 0);
signal font_addr: std_logic_vector(8 downto 0);
signal font_data: std_logic_vector(0 to 7);
signal font_pixel: std_logic;
signal font_rgb: std_logic_vector(2 downto 0);
constant BALL_SIZE: integer := 16; -- ball is square
signal ball_enable: std_logic;
signal ball_addr: std_logic_vector(3 downto 0);
signal ball_px_addr: std_logic_vector(3 downto 0);
signal ball_data: std_logic_vector(0 to BALL_SIZE - 1);
signal ball_pixel: std_logic;
signal ball_rgb: std_logic_vector(2 downto 0);
signal ball_x, ball_x_next: std_logic_vector(9 downto 0);
signal ball_y, ball_y_next: std_logic_vector(9 downto 0);
signal ball_h_dir, ball_h_dir_next, ball_v_dir, ball_v_dir_next: std_logic;
signal ball_bounce, ball_miss: std_logic;
constant BAR_1_POS: integer := 20;
constant BAR_2_POS: integer := 600;
constant BAR_WIDTH: integer := 20;
constant BAR_HEIGHT: integer := 64;
signal bar_pos: integer;
signal bar_addr: std_logic_vector(5 downto 0);
signal bar_data: std_logic_vector(0 to BAR_WIDTH - 1);
signal bar_pixel: std_logic;
signal bar_rgb: std_logic_vector(2 downto 0);
signal bar_1_y, bar_1_y_next,
bar_2_y, bar_2_y_next: std_logic_vector(9 downto 0);
signal ball_on, bar_on: std_logic;
signal nes_start: std_logic;
begin
process(state, ball_x, nes_start, score_1, score_2)
begin
state_next <= state;
ball_enable <= '0';
ball_miss <= '0';
score_1_next <= score_1;
score_2_next <= score_2;
case state is
when start =>
score_1_next <= (others => '0');
score_2_next <= (others => '0');
state_next <= waiting;
when waiting =>
ball_enable <= '0';
if score_1 = 7 or score_2 = 7 then
state_next <= game_over;
elsif nes_start = '1' then
state_next <= playing;
end if;
when playing =>
ball_enable <= '1';
if ball_x = 0 then
-- player 2 wins
score_2_next <= score_2 + 1;
state_next <= waiting;
ball_miss <= '1';
elsif ball_x = SCREEN_WIDTH - BALL_SIZE then
-- player 1 wins
score_1_next <= score_1 + 1;
state_next <= waiting;
ball_miss <= '1';
end if;
when game_over =>
if nes_start = '1' then
state_next <= start;
end if;
end case;
end process;
process(clk, not_reset)
begin
if not_reset = '0' then
state <= start;
ball_x <= (others => '0');
ball_y <= (others => '0');
bar_1_y <= conv_std_logic_vector(SCREEN_HEIGHT / 2 - BAR_HEIGHT / 2, 10);
bar_2_y <= conv_std_logic_vector(SCREEN_HEIGHT / 2 - BAR_HEIGHT / 2, 10);
ball_h_dir <= '0';
ball_v_dir <= '0';
bounce_counter <= (others => '0');
ball_control_counter <= (others => '0');
score_1 <= (others => '0');
score_2 <= (others => '0');
elsif clk'event and clk = '0' then
state <= state_next;
ball_x <= ball_x_next;
ball_y <= ball_y_next;
bar_1_y <= bar_1_y_next;
bar_2_y <= bar_2_y_next;
ball_h_dir <= ball_h_dir_next;
ball_v_dir <= ball_v_dir_next;
bounce_counter <= bounce_counter_next;
ball_control_counter <= ball_control_counter_next;
score_1 <= score_1_next;
score_2 <= score_2_next;
end if;
end process;
nes_start <= (nes1_start or nes2_start);
score_on <= '1' when px_y(9 downto 3) = 1 and
(px_x(9 downto 3) = 42 or px_x(9 downto 3) = 37) else
'0';
current_score <= score_1 when px_x < 320 else score_2;
-- numbers start at memory location 128
-- '1' starts at 136, '2' at 144 and so on
score_font_addr <= conv_std_logic_vector(128, 9) +
(current_score(2 downto 0) & current_score(5 downto 3));
player_id_on <= '1' when state = game_over and px_y(9 downto 3) = 29 and
(px_x(9 downto 3) = 19 or px_x(9 downto 3) = 59) else
'0';
-- player_id will display either 1 or 2
player_id_font_addr <= "010001000" when px_x < 320 else "010010000";
message_on <= '1' when state = game_over and
-- message on player_1's side
((score_1 > score_2 and
px_x(9 downto 3) >= 12 and
px_x(9 downto 3) < 26 and
px_y(9 downto 3) = 29) or
-- message on player_2's side
(score_2 > score_1 and
px_x(9 downto 3) >= 52 and
px_x(9 downto 3) < 66 and
px_y(9 downto 3) = 29)) else
'0';
with px_x(9 downto 3) select
message_font_addr <= "110000000" when "0110100"|"0001100", -- P
"101100000" when "0110101"|"0001101", -- L
"100001000" when "0110110"|"0001110", -- A
"111001000" when "0110111"|"0001111", -- Y
"100101000" when "0111000"|"0010000", -- E
"110010000" when "0111001"|"0010001", -- R
"111100000" when "0111011"|"0010011", -- not visible
"110111000" when "0111101"|"0010101", -- W
"101111000" when "0111110"|"0010110", -- O
"101110000" when "0111111"|"0010111", -- N
"000001000" when "1000000"|"0011000", -- !
"000000000" when others;
-- font address mutltiplexer
font_addr <= px_y(2 downto 0) + score_font_addr when score_on = '1' else
px_y(2 downto 0) + player_id_font_addr when player_id_on = '1' else
px_y(2 downto 0) + message_font_addr when message_on = '1' else
(others => '0');
font_pixel <= font_data(conv_integer(px_x(2 downto 0)));
font_rgb <= "000" when font_pixel = '1' else "111";
direction_control: process(
ball_control_counter,
ball_x, ball_y,
ball_h_dir, ball_v_dir,
ball_h_dir_next, ball_v_dir_next,
bar_1_y, bar_2_y
)
begin
ball_h_dir_next <= ball_h_dir;
ball_v_dir_next <= ball_v_dir;
ball_bounce <= '0';
--
-- BEWARE! Looks like ball_bounce signal is generated twice
-- due to slower clock! Too lazy to fix now :D
--
if ball_control_counter = 0 then
if ball_x = bar_1_pos + BAR_WIDTH and
ball_y + BALL_SIZE > bar_1_y and
ball_y < bar_1_y + BAR_HEIGHT then
ball_h_dir_next <= '1';
ball_bounce <= '1';
elsif ball_x + BALL_SIZE = bar_2_pos and
ball_y + BALL_SIZE > bar_2_y and
ball_y < bar_2_y + BAR_HEIGHT then
ball_h_dir_next <= '0';
ball_bounce <= '1';
elsif ball_x < bar_1_pos + BAR_WIDTH and
ball_x + BALL_SIZE > bar_1_pos then
if ball_y + BALL_SIZE = bar_1_y then
ball_v_dir_next <= '0';
elsif ball_y = bar_1_y + BAR_HEIGHT then
ball_v_dir_next <= '1';
end if;
elsif ball_x + BALL_SIZE > bar_2_pos and
ball_x < bar_2_pos + BAR_WIDTH then
if ball_y + BALL_SIZE = bar_2_y then
ball_v_dir_next <= '0';
elsif ball_y = bar_2_y + BAR_HEIGHT then
ball_v_dir_next <= '1';
end if;
end if;
if ball_y = 0 then
ball_v_dir_next <= '1';
elsif ball_y = SCREEN_HEIGHT - BALL_SIZE then
ball_v_dir_next <= '0';
end if;
end if;
end process;
bounce_counter_next <= bounce_counter + 1 when ball_bounce = '1' else
(others => '0') when ball_miss = '1' else
bounce_counter;
ball_control_value <= 0 when bounce_counter < 4 else
1 when bounce_counter < 15 else
2 when bounce_counter < 25 else
3;
ball_control_counter_next <= ball_control_counter + 1 when ball_control_counter < COUNTER_VALUES(ball_control_value) else
(others => '0');
ball_control: process(
ball_control_counter,
ball_x, ball_y,
ball_x_next, ball_y_next,
ball_h_dir, ball_v_dir,
ball_enable
)
begin
ball_x_next <= ball_x;
ball_y_next <= ball_y;
if ball_enable = '1' then
if ball_control_counter = 0 then
if ball_h_dir = '1' then
ball_x_next <= ball_x + 1;
else
ball_x_next <= ball_x - 1;
end if;
if ball_v_dir = '1' then
ball_y_next <= ball_y + 1;
else
ball_y_next <= ball_y - 1;
end if;
end if;
else
ball_x_next <= conv_std_logic_vector(SCREEN_WIDTH / 2 - BALL_SIZE / 2, 10);
ball_y_next <= conv_std_logic_vector(SCREEN_HEIGHT / 2 - BALL_SIZE / 2, 10);
end if;
end process;
bar_control: process(
bar_1_y, bar_2_y,
nes1_up, nes1_down,
nes2_up, nes2_down
)
begin
bar_1_y_next <= bar_1_y;
bar_2_y_next <= bar_2_y;
if nes1_up = '1' then
if bar_1_y > 0 then
bar_1_y_next <= bar_1_y - 1;
end if;
elsif nes1_down = '1' then
if bar_1_y < SCREEN_HEIGHT - BAR_HEIGHT - 1 then
bar_1_y_next <= bar_1_y + 1;
end if;
end if;
if nes2_up = '1' then
if bar_2_y > 0 then
bar_2_y_next <= bar_2_y - 1;
end if;
elsif nes2_down = '1' then
if bar_2_y < SCREEN_HEIGHT - BAR_HEIGHT - 1 then
bar_2_y_next <= bar_2_y + 1;
end if;
end if;
end process;
middle_line_on <= '1' when px_x = MIDDLE_LINE_POS else '0';
middle_line_rgb <= "000" when px_y(0) = '1' else "111";
ball_on <= '1' when px_x >= ball_x and
px_x < (ball_x + BALL_SIZE) and
px_y >= ball_y and
px_y < (ball_y + BALL_SIZE) else
'0';
-- whether bar_1 or bar_2 is on
bar_on <= '1' when (px_x >= BAR_1_POS and
px_x < BAR_1_POS + BAR_WIDTH and
px_y >= bar_1_y and
px_y < bar_1_y + BAR_HEIGHT) or
(px_x >= BAR_2_POS and
px_x < BAR_2_POS + BAR_WIDTH and
px_y >= bar_2_y and
px_y < bar_2_y + BAR_HEIGHT) else
'0';
ball_addr <= px_y(3 downto 0) - ball_y(3 downto 0);
ball_px_addr <= px_x(3 downto 0) - ball_x(3 downto 0);
ball_pixel <= ball_data(conv_integer(ball_px_addr));
ball_rgb <= "000" when ball_pixel = '1' else "111";
bar_addr <= (px_y(5 downto 0) - bar_1_y(5 downto 0)) when px_x < 320 else
(px_y(5 downto 0) - bar_2_y(5 downto 0));
bar_pos <= BAR_1_POS when px_x < 320 else BAR_2_POS;
bar_pixel <= bar_data(conv_integer(px_x - bar_pos));
bar_rgb <= "000" when bar_pixel = '1' else "111";
process(
ball_on, bar_on,
ball_rgb, bar_rgb,
score_on, message_on, font_rgb,
middle_line_on, middle_line_rgb,
video_on
)
begin
if video_on = '1' then
if bar_on = '1' then
rgb_stream <= bar_rgb;
elsif ball_on = '1' then
rgb_stream <= ball_rgb;
elsif middle_line_on = '1' then
rgb_stream <= middle_line_rgb;
-- scores and messages share rgb stream
elsif score_on = '1' or message_on = '1' then
rgb_stream <= font_rgb;
else
-- background is white
rgb_stream <= "111";
end if;
else
-- blank screen
rgb_stream <= "000";
end if;
end process;
ball_unit:
entity work.ball_rom(content)
port map(addr => ball_addr, data => ball_data);
bar_unit:
entity work.bar_rom(content)
port map(clk => clk, addr => bar_addr, data => bar_data);
font_unit:
entity work.codepage_rom(content)
port map(addr => font_addr, data => font_data);
ball_bounced <= ball_bounce;
ball_missed <= ball_miss;
end dispatcher;
| bsd-2-clause | e8133531f9660af8e67e1aae4e8294d6 | 0.492721 | 3.589827 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/audio/lp_filter2.vhd | 1 | 3,002 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2016 Gideon's Logic Architectures'
--
-------------------------------------------------------------------------------
--
-- Author: Gideon Zweijtzer (gideon.zweijtzer (at) gmail.com)
--
-- Note that this file is copyrighted, and is not supposed to be used in other
-- projects without written permission from the author.
--
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.my_math_pkg.all;
entity lp_filter is
port (
clock : in std_logic;
reset : in std_logic;
signal_in : in signed(17 downto 0);
high_pass : out signed(17 downto 0);
band_pass : out signed(17 downto 0);
low_pass : out signed(17 downto 0);
error_out : out std_logic;
valid_out : out std_logic );
end entity;
architecture dsvf of lp_filter is
--signal filter_q : signed(signal_in'range);
--signal filter_f : signed(signal_in'range);
signal input_sc : signed(signal_in'range);
signal reg_a : signed(25 downto 0);
signal reg_b : signed(25 downto 0);
begin
--filter_q <= to_signed(65536 + 16384, filter_q'length); -- 92682
--filter_f <= to_signed( 64, filter_f'length);
input_sc <= signal_in; -- shift_right(signal_in, 1);
process(clock)
variable af, vq, lp, hp, hpf, bp : signed(25 downto 0);
function mult2_24 (xa, xb : signed(17 downto 0)) return signed is
variable result : signed(35 downto 0);
begin
result := xa * xb;
return result(33 downto 8);
end function;
begin
if rising_edge(clock) then
-- af := mult2_24(filter_f, reg_a(25 downto 8)); -- 26 bit
-- *64 in 2_16 format is actually shifting to the right by (16-6=) 10 bits
af := shift_right(reg_a, 10);
lp := af + reg_b; -- 26 bit
-- vq := mult2_24(filter_q, reg_a(25 downto 8)); -- 26 bit
-- * 65536+16384 = *1.125 = addition with its shifted self.
vq := reg_a + shift_right(reg_a, 2);
hp := (input_sc & X"00") - vq - lp;
-- hpf := mult2_24(filter_f, hp(25 downto 8));
hpf := shift_right(hp, 10);
bp := hpf + reg_a;
reg_a <= bp;
reg_b <= lp;
low_pass <= lp(25 downto 8);
band_pass <= bp(25 downto 8);
high_pass <= hp(25 downto 8);
valid_out <= '1';
if reset = '1' then
reg_a <= (others => '0');
reg_b <= (others => '0');
valid_out <= '0';
end if;
end if;
end process;
error_out <= '0';
end dsvf;
| gpl-3.0 | c5a802a65dc2c962bc6c8ad4ce75af37 | 0.464357 | 3.8 | false | false | false | false |
chiggs/nvc | test/sem/array.vhd | 1 | 10,057 | package p is
type int_array is array (integer range <>) of integer;
type ten_ints is array (1 to 10) of integer;
end package;
entity e is
end entity;
use work.p.all;
architecture a of e is
-- All these declarations are OK
signal x : int_array(1 to 5);
signal y : ten_ints;
signal z : int_array(1 to 3) := ( 0, 1, 2 );
signal m : int_array(1 to 3) := ( 1 to 3 => 0 );
alias a : int_array(2 to 3) is x(2 to 3);
begin
process is
-- Positional elements cannot follow named
variable e : int_array(1 to 2) := (
0 => 1, 2 );
begin
end process;
process is
-- Others element must be last
variable e : ten_ints := ( others => 5, 1 => 2 );
begin
end process;
process is
-- Only one others element
variable e : ten_ints := ( others => 5, others => 2 );
begin
end process;
process is
-- Single element aggregates must be named
variable a : int_array(0 to 0) := ( 0 => 1 );
variable b : int_array(0 to 0) := ( 1 ); -- Error
begin
end process;
process is
variable a : integer;
begin
x(0) <= 1; -- OK
x <= ( others => 2 ); -- OK
x <= 1; -- RHS not array
a := x(0); -- OK
a := x; -- LHS not array
end process;
process is
variable b : boolean;
begin
b := z = m; -- OK
b := z /= m; -- OK
b := z = y; -- Different types
end process;
process is
begin
x(1 to 3) <= z;
x(1 to 2) <= z(1 to 2);
x(x'range) <= (others => 0);
end process;
process is
begin
a(2) <= 4; -- OK
y(2) <= 1; -- OK
end process;
process is
type int2d is array (1 to 10, 1 to 4) of integer;
variable w : int2d := ( 1 => ( 1, 2, 3, 4 ),
2 => ( others => 5 ),
others => ( others => 0 ) );
begin
w(2, 4) := 6;
w(6) := 6; -- Too few indices
w(6, 7, 2) := 2; -- Too many indices
end process;
process is
type letter is (A, B, C);
type larray is array (letter) of integer;
variable w : larray;
begin
w(A) := 2; -- OK
w(5) := 66; -- Wrong index type
end process;
process is
variable n : int_array(1 to 3) := ( 0, 1 => 1, others => 2 ); -- Error
begin
end process;
process is
variable x : integer;
constant c : integer := 3;
variable y : int_array(1 to 3);
begin
y := ( 1 => 2, 2 => 3, x => 5 ); -- Error
y := ( 1 => 2, 2 => 3, c => 5 ); -- OK
end process;
process is
variable x : integer;
variable y : int_array(3 downto 0);
begin
x(1 to 3) := (others => 4); -- Error
y(1 to 3) := (others => 4); -- Error
assert y = (others => 4); -- Error
end process;
process is
subtype five_ints is ten_ints(1 to 4);
variable x : five_ints;
begin
x(1 to 3) := (1, 2, 3); -- OK
x(2) := 1; -- OK
x(3 downto 1) := (others => '0'); -- Error
assert x(2) = 5; -- OK
end process;
process is
function foo(size: integer) return int_array is
subtype rtype is int_array(size-1 downto 0);
variable result: rtype;
begin
assert result(0) = 1;
return result;
end;
begin
end process;
process is
function plus(A, B: int_array) return int_array is
variable BV, sum: int_array(A'left downto 0);
begin
return sum;
end;
begin
end process;
process is
subtype int4_t is int_array(1 to 4);
type foo_t is array (integer'left to 10) of integer;
variable v : int_array(foo_t'range);
variable u : foo_t;
begin
assert int4_t'length = 4;
assert foo_t'length = 50;
end process;
process is
subtype a_to_c is character range 'a' to 'c';
type abc_ints is array (a_to_c) of integer;
variable v : abc_ints;
begin
assert abc_ints'length = 3;
v('b') := 2;
end process;
process is
type bit_map is array (bit) of integer;
variable b : bit_map := ( '0' => 5, '1' => 6 );
type bit_map2 is array (bit, 0 to 1) of integer;
variable c : bit_map2 := (
'0' => (0 => 0, 1 => 1),
'1' => (0 => 2, 1 => 3) );
begin
b('0') := 6;
c('1', 1) := 5;
end process;
process is
constant c : ten_ints := (ten_ints'range => 5);
variable v : ten_ints;
begin
v := (v'range => 6); -- OK
end process;
process is
type mybit is ('0', '1');
type bit_map is array (bit range '0' to '1') of integer;
variable v : bit_map;
variable b : bit;
begin
v(b) := 1; -- OK
end process;
process is
begin
assert x'length(1) = 5; -- OK
end process;
process is
type bad is array (integer range <>) of int_array; -- Error
begin
end process;
process is
type int2d is array (natural range <>, natural range <>) of integer;
constant c : int2d := ( (0, 1, 2), (0, 1, 2) ); -- OK
constant d : int2d := ( (0, 1), (5, 6, 7) ); -- OK (at sem)
constant e : int2d := ( (0, 1), (others => 2) ); -- Error
begin
end process;
process is
variable b1 : bit_vector(7 downto 0);
begin
b1 := b1 sll 1;
b1 := b1 srl 2;
b1 := b1 sla 0;
b1 := b1 sra 1;
b1 := b1 rol 6;
b1 := b1 ror 1;
end process;
process is
variable i : integer;
alias xi is x(1 to i); -- Error
alias zi : integer is z(i); -- Error
alias xx : integer is x(1 to 2); -- Error
begin
end process;
process is
variable i : integer;
begin
i(6) := 2; -- Error
end process;
process is
constant c : integer := -1;
type bad_range is array (-1 to -5) of integer; -- Error
type ok_range is array(c to -5) of integer; -- OK
begin
end process;
process is
subtype bad_sub1 is int_array(1 to 3, 2 to 5); -- Error
begin
end process;
process is
type element is array (integer range 0 to 1) of bit_vector( 0 to 1);
begin
end process;
process is
type ten_ten_ints is array (1 to 10) of ten_ints;
type int2d is array (natural range <>, natural range <>) of integer;
variable t1, t2 : ten_ten_ints;
variable m1, m2 : int2d(1 to 3, 1 to 3);
begin
assert t1 = t2; -- OK
assert t1 /= t2; -- OK
assert t1 < t2; -- OK
assert t1 > t2; -- OK
assert m1 = m2; -- OK
assert m1 < m2; -- Error
end process;
process is
subtype num_array is int_array; -- OK
subtype bad_array is not_here; -- Error
variable a1 : num_array(1 to 3); -- OK
variable a2 : num_array; -- Error
begin
end process;
process is
constant k : integer := 5;
type a is array (k) of integer; -- Error
variable v : a; -- Error
begin
end process;
process is
type ibv is array (boolean range <>) of integer;
variable a : ibv(false to true);
begin
a(false) := 1; -- OK
a(4) := 2; -- Error
a(false to false) := (others => 1); -- OK
end process;
process is
subtype r is integer range 1 to 3;
begin
x(r'range) <= (others => 1);
x(r) <= (others => 1);
end process;
process is
subtype str is string;
constant x : str := "hello"; -- OK
begin
end process;
process is
type barry2d is array (boolean range <>, boolean range <>)
of integer;
variable b : barry2d(false to true, false to true);
type ibarray2d is array (integer range <>, boolean range <>)
of integer;
variable ib : ibarray2d(1 to 5, false to true);
begin
b(barry2d'left(1), barry2d'left(2)) := 5; -- OK
ib(integer'(5), boolean'(true)) := 1; -- OK
ib(ibarray2d'left(1), ibarray2d'left(2)) := 5; -- OK
end process;
process is
type enum1 is (m1, m2, m3, m4, m5);
type abase is array (enum1 range <>) of boolean;
subtype a1 is abase(enum1 range m1 to m5);
variable V1 : A1;
begin
assert v1 = (false, false, false); -- OK
end process;
process is
variable x : int_array(1 to 3);
begin
x := (1 | 2 to 3 => 5); -- OK
end process;
process is
variable b : bit_vector(1 to 3); -- OK
begin
b := "1fe"; -- Error
end process;
issue86: block is
type integer_vector is array (natural range <>) of integer;
subtype ElementType is integer ;
subtype ArrayofElementType is integer_vector;
function inside0 (constant E : ElementType;
constant A : in ArrayofElementType) return boolean is
begin
for i in A'range loop -- OK (issue #86)
if E = A(i) then
return TRUE;
end if ;
end loop ;
return FALSE ;
end function inside0;
begin
end block;
end architecture;
| gpl-3.0 | 39e29fe3bebbe105d494c816ef36ffb8 | 0.465646 | 3.76949 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_sim/harness_c1581.vhd | 1 | 3,892 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.io_bus_bfm_pkg.all;
use work.mem_bus_pkg.all;
use work.tl_flat_memory_model_pkg.all;
entity harness_c1581 is
port (
io_irq : out std_logic );
end entity;
architecture harness of harness_c1581 is
signal clock : std_logic := '0';
signal reset : std_logic := '0';
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal iec_atn : std_logic;
signal iec_atn_o : std_logic;
signal iec_atn_i : std_logic;
signal iec_data : std_logic;
signal iec_data_o : std_logic;
signal iec_data_i : std_logic;
signal iec_clk : std_logic;
signal iec_clk_o : std_logic;
signal iec_clk_i : std_logic;
signal iec_fclk_o : std_logic;
signal iec_fclk_i : std_logic;
signal iec_fclk : std_logic;
signal mem_req : t_mem_req_32;
signal mem_resp : t_mem_resp_32;
signal act_led_n : std_logic;
signal audio_sample : signed(12 downto 0);
signal tick_4MHz : std_logic := '0';
begin
clock <= not clock after 25 ns;
reset <= '1', '0' after 1000 ns;
process
begin
wait until clock = '1'; tick_4MHz <= '0';
wait until clock = '1'; tick_4MHz <= '0';
wait until clock = '1'; tick_4MHz <= '0';
wait until clock = '1'; tick_4MHz <= '0';
wait until clock = '1'; tick_4MHz <= '1';
end process;
i_io_bus_bfm: entity work.io_bus_bfm
generic map (
g_name => "io_bfm" )
port map (
clock => clock,
req => io_req,
resp => io_resp );
i_drive: entity work.c1581_drive
generic map (
g_big_endian => false,
g_audio => false,
g_audio_base => X"0010000",
g_ram_base => X"0000000" )
port map (
clock => clock,
reset => reset,
-- timing
tick_4MHz => tick_4MHz,
-- slave port on io bus
io_req => io_req,
io_resp => io_resp,
io_irq => io_irq,
-- master port on memory bus
mem_req => mem_req,
mem_resp => mem_resp,
-- serial bus pins
atn_o => iec_atn_o, -- open drain
atn_i => iec_atn_i,
clk_o => iec_clk_o, -- open drain
clk_i => iec_clk_i,
data_o => iec_data_o, -- open drain
data_i => iec_data_i,
fast_clk_o => iec_fclk_o, -- open drain
fast_clk_i => iec_fclk_i,
-- LED
act_led_n => act_led_n,
-- audio out
audio_sample => audio_sample );
iec_atn <= '0' when iec_atn_o='0' else 'Z';
iec_atn_i <= '0' when iec_atn='0' else '1';
iec_clk <= '0' when iec_clk_o='0' else 'Z';
iec_clk_i <= '0' when iec_clk='0' else '1';
iec_data <= '0' when iec_data_o='0' else 'Z';
iec_data_i <= '0' when iec_data='0' else '1';
iec_fclk <= '0' when iec_fclk_o='0' else 'Z';
iec_fclk_i <= '0' when iec_fclk='0' else '1';
i_memory: entity work.mem_bus_32_slave_bfm
generic map(
g_name => "dram",
g_latency => 2
)
port map(
clock => clock,
req => mem_req,
resp => mem_resp
);
iec_bfm: entity work.iec_bus_bfm
generic map ("iec_bfm")
port map (
iec_clock => iec_clk,
iec_data => iec_data,
iec_atn => iec_atn,
iec_srq => iec_fclk );
end harness;
| gpl-3.0 | f55ec1fa319e3175c5e74e350aa2554b | 0.463001 | 3.306712 | false | false | false | false |
cfelton/musicbox_simple | m_musicbox.vhd | 1 | 674,407 | -- File: m_musicbox.vhd
-- Generated by MyHDL 0.9dev
-- Date: Tue Dec 30 11:42:04 2014
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use std.textio.all;
use work.pck_myhdl_09.all;
entity m_musicbox is
port (
clock: in std_logic;
reset: in std_logic;
note: out signed (14 downto 0);
nv: out std_logic
);
end entity m_musicbox;
-- module to generate a "tone".
--
-- Port Map
-- --------
-- clock : circuit synchronous clock
-- reset : circult reset
-- note : digital signal for the note
-- nv : note valid strobe
architecture MyHDL of m_musicbox is
constant ticks_per_fs: integer := 1042;
constant Nsmp: integer := 12000;
signal noteidx: unsigned(13 downto 0);
signal sample_rate_cnt: unsigned(10 downto 0);
begin
M_MUSICBOX_RTL: process (clock, reset) is
begin
if (reset = '0') then
sample_rate_cnt <= to_unsigned(1, 11);
note <= to_signed(0, 15);
noteidx <= to_unsigned(0, 14);
nv <= '0';
elsif rising_edge(clock) then
if (sample_rate_cnt = ticks_per_fs) then
sample_rate_cnt <= to_unsigned(1, 11);
case to_integer(noteidx) is
when 0 => note <= "000000000000000";
when 1 => note <= "001010100000010";
when 2 => note <= "010010110011010";
when 3 => note <= "010111010000111";
when 4 => note <= "010111010000110";
when 5 => note <= "010011010100001";
when 6 => note <= "001100111100011";
when 7 => note <= "000110010000011";
when 8 => note <= "000001010111001";
when 9 => note <= "111111110011011";
when 10 => note <= "000010001001010";
when 11 => note <= "000111110011011";
when 12 => note <= "001111001101111";
when 13 => note <= "010110010000011";
when 14 => note <= "011010110011010";
when 15 => note <= "011011010100001";
when 16 => note <= "010111010000110";
when 17 => note <= "001111010000111";
when 18 => note <= "000100111100011";
when 19 => note <= "111010100000010";
when 20 => note <= "110010001001010";
when 21 => note <= "101101011111110";
when 22 => note <= "101101001100110";
when 23 => note <= "110000101111001";
when 24 => note <= "110110100110001";
when 25 => note <= "111100101011111";
when 26 => note <= "000000111010011";
when 27 => note <= "000001101111101";
when 28 => note <= "111110101000111";
when 29 => note <= "111000001100101";
when 30 => note <= "110000000000000";
when 31 => note <= "101000001100101";
when 32 => note <= "100010111011010";
when 33 => note <= "100001101111101";
when 34 => note <= "100101001100110";
when 35 => note <= "101100101011111";
when 36 => note <= "110110100110001";
when 37 => note <= "000000101111001";
when 38 => note <= "001000111010011";
when 39 => note <= "001101011111110";
when 40 => note <= "001101110110110";
when 41 => note <= "001010100000010";
when 42 => note <= "000100111100011";
when 43 => note <= "111111010000111";
when 44 => note <= "111011100011001";
when 45 => note <= "111011010100001";
when 46 => note <= "111111000101101";
when 47 => note <= "000110010000011";
when 48 => note <= "001111001101111";
when 49 => note <= "010111110011011";
when 50 => note <= "011101110110110";
when 51 => note <= "011111110011011";
when 52 => note <= "011101000100110";
when 53 => note <= "010110010000011";
when 54 => note <= "001100111100011";
when 55 => note <= "000011010100001";
when 56 => note <= "111011100011001";
when 57 => note <= "110111010000111";
when 58 => note <= "110111000101101";
when 59 => note <= "111010100000010";
when 60 => note <= "000000000000000";
when 61 => note <= "000101011111110";
when 62 => note <= "001000111010011";
when 63 => note <= "001000101111001";
when 64 => note <= "000100011100111";
when 65 => note <= "111100101011111";
when 66 => note <= "110011000011101";
when 67 => note <= "101001101111101";
when 68 => note <= "100010111011010";
when 69 => note <= "100000001100101";
when 70 => note <= "100010001001010";
when 71 => note <= "101000001100101";
when 72 => note <= "110000110010001";
when 73 => note <= "111001101111101";
when 74 => note <= "000000111010011";
when 75 => note <= "000100101011111";
when 76 => note <= "000100011100111";
when 77 => note <= "000000101111001";
when 78 => note <= "111011000011101";
when 79 => note <= "110101011111110";
when 80 => note <= "110010001001010";
when 81 => note <= "110010100000010";
when 82 => note <= "110111000101101";
when 83 => note <= "111111010000111";
when 84 => note <= "001001011001111";
when 85 => note <= "010011010100001";
when 86 => note <= "011010110011010";
when 87 => note <= "011110010000011";
when 88 => note <= "011101000100110";
when 89 => note <= "010111110011011";
when 90 => note <= "010000000000000";
when 91 => note <= "000111110011011";
when 92 => note <= "000001010111001";
when 93 => note <= "111110010000011";
when 94 => note <= "111111000101101";
when 95 => note <= "000011010100001";
when 96 => note <= "001001011001111";
when 97 => note <= "001111010000111";
when 98 => note <= "010010110011010";
when 99 => note <= "010010100000010";
when 100 => note <= "001101110110110";
when 101 => note <= "000101011111110";
when 102 => note <= "111011000011101";
when 103 => note <= "110000101111001";
when 104 => note <= "101000101111010";
when 105 => note <= "100100101011111";
when 106 => note <= "100101001100110";
when 107 => note <= "101001101111101";
when 108 => note <= "110000110010001";
when 109 => note <= "111000001100101";
when 110 => note <= "111101110110110";
when 111 => note <= "000000001100101";
when 112 => note <= "111110101000111";
when 113 => note <= "111001101111101";
when 114 => note <= "110011000011101";
when 115 => note <= "101100101011111";
when 116 => note <= "101000101111010";
when 117 => note <= "101000101111001";
when 118 => note <= "101101001100110";
when 119 => note <= "110101011111110";
when 120 => note <= "000000000000000";
when 121 => note <= "001010100000010";
when 122 => note <= "010010110011010";
when 123 => note <= "010111010000111";
when 124 => note <= "010111010000110";
when 125 => note <= "010011010100001";
when 126 => note <= "001100111100011";
when 127 => note <= "000110010000011";
when 128 => note <= "000001010111001";
when 129 => note <= "111111110011011";
when 130 => note <= "000010001001010";
when 131 => note <= "000111110011011";
when 132 => note <= "001111001101111";
when 133 => note <= "010110010000011";
when 134 => note <= "011010110011010";
when 135 => note <= "011011010100001";
when 136 => note <= "010111010000110";
when 137 => note <= "001111010000111";
when 138 => note <= "000100111100011";
when 139 => note <= "111010100000010";
when 140 => note <= "110010001001010";
when 141 => note <= "101101011111110";
when 142 => note <= "101101001100110";
when 143 => note <= "110000101111001";
when 144 => note <= "110110100110001";
when 145 => note <= "111100101011111";
when 146 => note <= "000000111010011";
when 147 => note <= "000001101111101";
when 148 => note <= "111110101000111";
when 149 => note <= "111000001100101";
when 150 => note <= "110000000000000";
when 151 => note <= "101000001100101";
when 152 => note <= "100010111011010";
when 153 => note <= "100001101111101";
when 154 => note <= "100101001100110";
when 155 => note <= "101100101011111";
when 156 => note <= "110110100110001";
when 157 => note <= "000000101111001";
when 158 => note <= "001000111010011";
when 159 => note <= "001101011111110";
when 160 => note <= "001101110110110";
when 161 => note <= "001010100000010";
when 162 => note <= "000100111100011";
when 163 => note <= "111111010000111";
when 164 => note <= "111011100011001";
when 165 => note <= "111011010100001";
when 166 => note <= "111111000101101";
when 167 => note <= "000110010000011";
when 168 => note <= "001111001101111";
when 169 => note <= "010111110011011";
when 170 => note <= "011101110110110";
when 171 => note <= "011111110011011";
when 172 => note <= "011101000100110";
when 173 => note <= "010110010000011";
when 174 => note <= "001100111100011";
when 175 => note <= "000011010100001";
when 176 => note <= "111011100011001";
when 177 => note <= "110111010000111";
when 178 => note <= "110111000101101";
when 179 => note <= "111010100000010";
when 180 => note <= "000000000000000";
when 181 => note <= "000101011111110";
when 182 => note <= "001000111010011";
when 183 => note <= "001000101111001";
when 184 => note <= "000100011100111";
when 185 => note <= "111100101011111";
when 186 => note <= "110011000011101";
when 187 => note <= "101001101111101";
when 188 => note <= "100010111011010";
when 189 => note <= "100000001100101";
when 190 => note <= "100010001001010";
when 191 => note <= "101000001100101";
when 192 => note <= "110000110010001";
when 193 => note <= "111001101111101";
when 194 => note <= "000000111010011";
when 195 => note <= "000100101011111";
when 196 => note <= "000100011100111";
when 197 => note <= "000000101111001";
when 198 => note <= "111011000011101";
when 199 => note <= "110101011111110";
when 200 => note <= "110010001001010";
when 201 => note <= "110010100000010";
when 202 => note <= "110111000101101";
when 203 => note <= "111111010000111";
when 204 => note <= "001001011001111";
when 205 => note <= "010011010100001";
when 206 => note <= "011010110011010";
when 207 => note <= "011110010000011";
when 208 => note <= "011101000100110";
when 209 => note <= "010111110011011";
when 210 => note <= "010000000000000";
when 211 => note <= "000111110011011";
when 212 => note <= "000001010111001";
when 213 => note <= "111110010000011";
when 214 => note <= "111111000101101";
when 215 => note <= "000011010100001";
when 216 => note <= "001001011001111";
when 217 => note <= "001111010000111";
when 218 => note <= "010010110011010";
when 219 => note <= "010010100000010";
when 220 => note <= "001101110110110";
when 221 => note <= "000101011111110";
when 222 => note <= "111011000011101";
when 223 => note <= "110000101111001";
when 224 => note <= "101000101111010";
when 225 => note <= "100100101011111";
when 226 => note <= "100101001100110";
when 227 => note <= "101001101111101";
when 228 => note <= "110000110010001";
when 229 => note <= "111000001100101";
when 230 => note <= "111101110110110";
when 231 => note <= "000000001100101";
when 232 => note <= "111110101000111";
when 233 => note <= "111001101111101";
when 234 => note <= "110011000011101";
when 235 => note <= "101100101011111";
when 236 => note <= "101000101111010";
when 237 => note <= "101000101111001";
when 238 => note <= "101101001100110";
when 239 => note <= "110101011111110";
when 240 => note <= "000000000000000";
when 241 => note <= "001010100000010";
when 242 => note <= "010010110011010";
when 243 => note <= "010111010000111";
when 244 => note <= "010111010000110";
when 245 => note <= "010011010100001";
when 246 => note <= "001100111100011";
when 247 => note <= "000110010000011";
when 248 => note <= "000001010111001";
when 249 => note <= "111111110011011";
when 250 => note <= "000010001001010";
when 251 => note <= "000111110011011";
when 252 => note <= "001111001101111";
when 253 => note <= "010110010000011";
when 254 => note <= "011010110011010";
when 255 => note <= "011011010100001";
when 256 => note <= "010111010000110";
when 257 => note <= "001111010000111";
when 258 => note <= "000100111100011";
when 259 => note <= "111010100000010";
when 260 => note <= "110010001001010";
when 261 => note <= "101101011111110";
when 262 => note <= "101101001100110";
when 263 => note <= "110000101111001";
when 264 => note <= "110110100110001";
when 265 => note <= "111100101011111";
when 266 => note <= "000000111010011";
when 267 => note <= "000001101111101";
when 268 => note <= "111110101000111";
when 269 => note <= "111000001100101";
when 270 => note <= "110000000000000";
when 271 => note <= "101000001100101";
when 272 => note <= "100010111011010";
when 273 => note <= "100001101111101";
when 274 => note <= "100101001100110";
when 275 => note <= "101100101011111";
when 276 => note <= "110110100110001";
when 277 => note <= "000000101111001";
when 278 => note <= "001000111010011";
when 279 => note <= "001101011111110";
when 280 => note <= "001101110110110";
when 281 => note <= "001010100000010";
when 282 => note <= "000100111100011";
when 283 => note <= "111111010000111";
when 284 => note <= "111011100011001";
when 285 => note <= "111011010100001";
when 286 => note <= "111111000101101";
when 287 => note <= "000110010000011";
when 288 => note <= "001111001101111";
when 289 => note <= "010111110011011";
when 290 => note <= "011101110110110";
when 291 => note <= "011111110011011";
when 292 => note <= "011101000100110";
when 293 => note <= "010110010000011";
when 294 => note <= "001100111100011";
when 295 => note <= "000011010100001";
when 296 => note <= "111011100011001";
when 297 => note <= "110111010000111";
when 298 => note <= "110111000101101";
when 299 => note <= "111010100000010";
when 300 => note <= "000000000000000";
when 301 => note <= "000101011111110";
when 302 => note <= "001000111010011";
when 303 => note <= "001000101111001";
when 304 => note <= "000100011100111";
when 305 => note <= "111100101011111";
when 306 => note <= "110011000011101";
when 307 => note <= "101001101111101";
when 308 => note <= "100010111011010";
when 309 => note <= "100000001100101";
when 310 => note <= "100010001001010";
when 311 => note <= "101000001100101";
when 312 => note <= "110000110010001";
when 313 => note <= "111001101111101";
when 314 => note <= "000000111010011";
when 315 => note <= "000100101011111";
when 316 => note <= "000100011100111";
when 317 => note <= "000000101111001";
when 318 => note <= "111011000011101";
when 319 => note <= "110101011111110";
when 320 => note <= "110010001001010";
when 321 => note <= "110010100000010";
when 322 => note <= "110111000101101";
when 323 => note <= "111111010000111";
when 324 => note <= "001001011001111";
when 325 => note <= "010011010100001";
when 326 => note <= "011010110011010";
when 327 => note <= "011110010000011";
when 328 => note <= "011101000100110";
when 329 => note <= "010111110011011";
when 330 => note <= "010000000000000";
when 331 => note <= "000111110011011";
when 332 => note <= "000001010111001";
when 333 => note <= "111110010000011";
when 334 => note <= "111111000101101";
when 335 => note <= "000011010100001";
when 336 => note <= "001001011001111";
when 337 => note <= "001111010000111";
when 338 => note <= "010010110011010";
when 339 => note <= "010010100000010";
when 340 => note <= "001101110110110";
when 341 => note <= "000101011111110";
when 342 => note <= "111011000011101";
when 343 => note <= "110000101111001";
when 344 => note <= "101000101111010";
when 345 => note <= "100100101011111";
when 346 => note <= "100101001100110";
when 347 => note <= "101001101111101";
when 348 => note <= "110000110010001";
when 349 => note <= "111000001100101";
when 350 => note <= "111101110110110";
when 351 => note <= "000000001100101";
when 352 => note <= "111110101000111";
when 353 => note <= "111001101111101";
when 354 => note <= "110011000011101";
when 355 => note <= "101100101011111";
when 356 => note <= "101000101111010";
when 357 => note <= "101000101111001";
when 358 => note <= "101101001100110";
when 359 => note <= "110101011111110";
when 360 => note <= "000000000000000";
when 361 => note <= "001010100000010";
when 362 => note <= "010010110011010";
when 363 => note <= "010111010000111";
when 364 => note <= "010111010000110";
when 365 => note <= "010011010100001";
when 366 => note <= "001100111100011";
when 367 => note <= "000110010000011";
when 368 => note <= "000001010111001";
when 369 => note <= "111111110011011";
when 370 => note <= "000010001001010";
when 371 => note <= "000111110011011";
when 372 => note <= "001111001101111";
when 373 => note <= "010110010000011";
when 374 => note <= "011010110011010";
when 375 => note <= "011011010100001";
when 376 => note <= "010111010000110";
when 377 => note <= "001111010000111";
when 378 => note <= "000100111100011";
when 379 => note <= "111010100000010";
when 380 => note <= "110010001001010";
when 381 => note <= "101101011111110";
when 382 => note <= "101101001100110";
when 383 => note <= "110000101111001";
when 384 => note <= "110110100110001";
when 385 => note <= "111100101011111";
when 386 => note <= "000000111010011";
when 387 => note <= "000001101111101";
when 388 => note <= "111110101000111";
when 389 => note <= "111000001100101";
when 390 => note <= "110000000000000";
when 391 => note <= "101000001100101";
when 392 => note <= "100010111011010";
when 393 => note <= "100001101111101";
when 394 => note <= "100101001100110";
when 395 => note <= "101100101011111";
when 396 => note <= "110110100110001";
when 397 => note <= "000000101111001";
when 398 => note <= "001000111010011";
when 399 => note <= "001101011111110";
when 400 => note <= "001101110110110";
when 401 => note <= "001010100000010";
when 402 => note <= "000100111100011";
when 403 => note <= "111111010000111";
when 404 => note <= "111011100011001";
when 405 => note <= "111011010100001";
when 406 => note <= "111111000101101";
when 407 => note <= "000110010000011";
when 408 => note <= "001111001101111";
when 409 => note <= "010111110011011";
when 410 => note <= "011101110110110";
when 411 => note <= "011111110011011";
when 412 => note <= "011101000100110";
when 413 => note <= "010110010000011";
when 414 => note <= "001100111100011";
when 415 => note <= "000011010100001";
when 416 => note <= "111011100011001";
when 417 => note <= "110111010000111";
when 418 => note <= "110111000101101";
when 419 => note <= "111010100000010";
when 420 => note <= "000000000000000";
when 421 => note <= "000101011111110";
when 422 => note <= "001000111010011";
when 423 => note <= "001000101111001";
when 424 => note <= "000100011100111";
when 425 => note <= "111100101011111";
when 426 => note <= "110011000011101";
when 427 => note <= "101001101111101";
when 428 => note <= "100010111011010";
when 429 => note <= "100000001100101";
when 430 => note <= "100010001001010";
when 431 => note <= "101000001100101";
when 432 => note <= "110000110010001";
when 433 => note <= "111001101111101";
when 434 => note <= "000000111010011";
when 435 => note <= "000100101011111";
when 436 => note <= "000100011100111";
when 437 => note <= "000000101111001";
when 438 => note <= "111011000011101";
when 439 => note <= "110101011111110";
when 440 => note <= "110010001001010";
when 441 => note <= "110010100000010";
when 442 => note <= "110111000101101";
when 443 => note <= "111111010000111";
when 444 => note <= "001001011001111";
when 445 => note <= "010011010100001";
when 446 => note <= "011010110011010";
when 447 => note <= "011110010000011";
when 448 => note <= "011101000100110";
when 449 => note <= "010111110011011";
when 450 => note <= "010000000000000";
when 451 => note <= "000111110011011";
when 452 => note <= "000001010111001";
when 453 => note <= "111110010000011";
when 454 => note <= "111111000101101";
when 455 => note <= "000011010100001";
when 456 => note <= "001001011001111";
when 457 => note <= "001111010000111";
when 458 => note <= "010010110011010";
when 459 => note <= "010010100000010";
when 460 => note <= "001101110110110";
when 461 => note <= "000101011111110";
when 462 => note <= "111011000011101";
when 463 => note <= "110000101111001";
when 464 => note <= "101000101111010";
when 465 => note <= "100100101011111";
when 466 => note <= "100101001100110";
when 467 => note <= "101001101111101";
when 468 => note <= "110000110010001";
when 469 => note <= "111000001100101";
when 470 => note <= "111101110110110";
when 471 => note <= "000000001100101";
when 472 => note <= "111110101000111";
when 473 => note <= "111001101111101";
when 474 => note <= "110011000011101";
when 475 => note <= "101100101011111";
when 476 => note <= "101000101111010";
when 477 => note <= "101000101111001";
when 478 => note <= "101101001100110";
when 479 => note <= "110101011111110";
when 480 => note <= "000000000000000";
when 481 => note <= "001010100000010";
when 482 => note <= "010010110011010";
when 483 => note <= "010111010000111";
when 484 => note <= "010111010000110";
when 485 => note <= "010011010100001";
when 486 => note <= "001100111100011";
when 487 => note <= "000110010000011";
when 488 => note <= "000001010111001";
when 489 => note <= "111111110011011";
when 490 => note <= "000010001001010";
when 491 => note <= "000111110011011";
when 492 => note <= "001111001101111";
when 493 => note <= "010110010000011";
when 494 => note <= "011010110011010";
when 495 => note <= "011011010100001";
when 496 => note <= "010111010000110";
when 497 => note <= "001111010000111";
when 498 => note <= "000100111100011";
when 499 => note <= "111010100000010";
when 500 => note <= "110010001001010";
when 501 => note <= "101101011111110";
when 502 => note <= "101101001100110";
when 503 => note <= "110000101111001";
when 504 => note <= "110110100110001";
when 505 => note <= "111100101011111";
when 506 => note <= "000000111010011";
when 507 => note <= "000001101111101";
when 508 => note <= "111110101000111";
when 509 => note <= "111000001100101";
when 510 => note <= "110000000000000";
when 511 => note <= "101000001100101";
when 512 => note <= "100010111011010";
when 513 => note <= "100001101111101";
when 514 => note <= "100101001100110";
when 515 => note <= "101100101011111";
when 516 => note <= "110110100110001";
when 517 => note <= "000000101111001";
when 518 => note <= "001000111010011";
when 519 => note <= "001101011111110";
when 520 => note <= "001101110110110";
when 521 => note <= "001010100000010";
when 522 => note <= "000100111100011";
when 523 => note <= "111111010000111";
when 524 => note <= "111011100011001";
when 525 => note <= "111011010100001";
when 526 => note <= "111111000101101";
when 527 => note <= "000110010000011";
when 528 => note <= "001111001101111";
when 529 => note <= "010111110011011";
when 530 => note <= "011101110110110";
when 531 => note <= "011111110011011";
when 532 => note <= "011101000100110";
when 533 => note <= "010110010000011";
when 534 => note <= "001100111100011";
when 535 => note <= "000011010100001";
when 536 => note <= "111011100011001";
when 537 => note <= "110111010000111";
when 538 => note <= "110111000101101";
when 539 => note <= "111010100000010";
when 540 => note <= "000000000000000";
when 541 => note <= "000101011111110";
when 542 => note <= "001000111010011";
when 543 => note <= "001000101111001";
when 544 => note <= "000100011100111";
when 545 => note <= "111100101011111";
when 546 => note <= "110011000011101";
when 547 => note <= "101001101111101";
when 548 => note <= "100010111011010";
when 549 => note <= "100000001100101";
when 550 => note <= "100010001001010";
when 551 => note <= "101000001100101";
when 552 => note <= "110000110010001";
when 553 => note <= "111001101111101";
when 554 => note <= "000000111010011";
when 555 => note <= "000100101011111";
when 556 => note <= "000100011100111";
when 557 => note <= "000000101111001";
when 558 => note <= "111011000011101";
when 559 => note <= "110101011111110";
when 560 => note <= "110010001001010";
when 561 => note <= "110010100000010";
when 562 => note <= "110111000101101";
when 563 => note <= "111111010000111";
when 564 => note <= "001001011001111";
when 565 => note <= "010011010100001";
when 566 => note <= "011010110011010";
when 567 => note <= "011110010000011";
when 568 => note <= "011101000100110";
when 569 => note <= "010111110011011";
when 570 => note <= "010000000000000";
when 571 => note <= "000111110011011";
when 572 => note <= "000001010111001";
when 573 => note <= "111110010000011";
when 574 => note <= "111111000101101";
when 575 => note <= "000011010100001";
when 576 => note <= "001001011001111";
when 577 => note <= "001111010000111";
when 578 => note <= "010010110011010";
when 579 => note <= "010010100000010";
when 580 => note <= "001101110110110";
when 581 => note <= "000101011111110";
when 582 => note <= "111011000011101";
when 583 => note <= "110000101111001";
when 584 => note <= "101000101111010";
when 585 => note <= "100100101011111";
when 586 => note <= "100101001100110";
when 587 => note <= "101001101111101";
when 588 => note <= "110000110010001";
when 589 => note <= "111000001100101";
when 590 => note <= "111101110110110";
when 591 => note <= "000000001100101";
when 592 => note <= "111110101000111";
when 593 => note <= "111001101111101";
when 594 => note <= "110011000011101";
when 595 => note <= "101100101011111";
when 596 => note <= "101000101111010";
when 597 => note <= "101000101111001";
when 598 => note <= "101101001100110";
when 599 => note <= "110101011111110";
when 600 => note <= "000000000000000";
when 601 => note <= "001010100000010";
when 602 => note <= "010010110011010";
when 603 => note <= "010111010000111";
when 604 => note <= "010111010000110";
when 605 => note <= "010011010100001";
when 606 => note <= "001100111100011";
when 607 => note <= "000110010000011";
when 608 => note <= "000001010111001";
when 609 => note <= "111111110011011";
when 610 => note <= "000010001001010";
when 611 => note <= "000111110011011";
when 612 => note <= "001111001101111";
when 613 => note <= "010110010000011";
when 614 => note <= "011010110011010";
when 615 => note <= "011011010100001";
when 616 => note <= "010111010000110";
when 617 => note <= "001111010000111";
when 618 => note <= "000100111100011";
when 619 => note <= "111010100000010";
when 620 => note <= "110010001001010";
when 621 => note <= "101101011111110";
when 622 => note <= "101101001100110";
when 623 => note <= "110000101111001";
when 624 => note <= "110110100110001";
when 625 => note <= "111100101011111";
when 626 => note <= "000000111010011";
when 627 => note <= "000001101111101";
when 628 => note <= "111110101000111";
when 629 => note <= "111000001100101";
when 630 => note <= "110000000000000";
when 631 => note <= "101000001100101";
when 632 => note <= "100010111011010";
when 633 => note <= "100001101111101";
when 634 => note <= "100101001100110";
when 635 => note <= "101100101011111";
when 636 => note <= "110110100110001";
when 637 => note <= "000000101111001";
when 638 => note <= "001000111010011";
when 639 => note <= "001101011111110";
when 640 => note <= "001101110110110";
when 641 => note <= "001010100000010";
when 642 => note <= "000100111100011";
when 643 => note <= "111111010000111";
when 644 => note <= "111011100011001";
when 645 => note <= "111011010100001";
when 646 => note <= "111111000101101";
when 647 => note <= "000110010000011";
when 648 => note <= "001111001101111";
when 649 => note <= "010111110011011";
when 650 => note <= "011101110110110";
when 651 => note <= "011111110011011";
when 652 => note <= "011101000100110";
when 653 => note <= "010110010000011";
when 654 => note <= "001100111100011";
when 655 => note <= "000011010100001";
when 656 => note <= "111011100011001";
when 657 => note <= "110111010000111";
when 658 => note <= "110111000101101";
when 659 => note <= "111010100000010";
when 660 => note <= "000000000000000";
when 661 => note <= "000101011111110";
when 662 => note <= "001000111010011";
when 663 => note <= "001000101111001";
when 664 => note <= "000100011100111";
when 665 => note <= "111100101011111";
when 666 => note <= "110011000011101";
when 667 => note <= "101001101111101";
when 668 => note <= "100010111011010";
when 669 => note <= "100000001100101";
when 670 => note <= "100010001001010";
when 671 => note <= "101000001100101";
when 672 => note <= "110000110010001";
when 673 => note <= "111001101111101";
when 674 => note <= "000000111010011";
when 675 => note <= "000100101011111";
when 676 => note <= "000100011100111";
when 677 => note <= "000000101111001";
when 678 => note <= "111011000011101";
when 679 => note <= "110101011111110";
when 680 => note <= "110010001001010";
when 681 => note <= "110010100000010";
when 682 => note <= "110111000101101";
when 683 => note <= "111111010000111";
when 684 => note <= "001001011001111";
when 685 => note <= "010011010100001";
when 686 => note <= "011010110011010";
when 687 => note <= "011110010000011";
when 688 => note <= "011101000100110";
when 689 => note <= "010111110011011";
when 690 => note <= "010000000000000";
when 691 => note <= "000111110011011";
when 692 => note <= "000001010111001";
when 693 => note <= "111110010000011";
when 694 => note <= "111111000101101";
when 695 => note <= "000011010100001";
when 696 => note <= "001001011001111";
when 697 => note <= "001111010000111";
when 698 => note <= "010010110011010";
when 699 => note <= "010010100000010";
when 700 => note <= "001101110110110";
when 701 => note <= "000101011111110";
when 702 => note <= "111011000011101";
when 703 => note <= "110000101111001";
when 704 => note <= "101000101111010";
when 705 => note <= "100100101011111";
when 706 => note <= "100101001100110";
when 707 => note <= "101001101111101";
when 708 => note <= "110000110010001";
when 709 => note <= "111000001100101";
when 710 => note <= "111101110110110";
when 711 => note <= "000000001100101";
when 712 => note <= "111110101000111";
when 713 => note <= "111001101111101";
when 714 => note <= "110011000011101";
when 715 => note <= "101100101011111";
when 716 => note <= "101000101111010";
when 717 => note <= "101000101111001";
when 718 => note <= "101101001100110";
when 719 => note <= "110101011111110";
when 720 => note <= "000000000000000";
when 721 => note <= "001010100000010";
when 722 => note <= "010010110011010";
when 723 => note <= "010111010000111";
when 724 => note <= "010111010000110";
when 725 => note <= "010011010100001";
when 726 => note <= "001100111100011";
when 727 => note <= "000110010000011";
when 728 => note <= "000001010111001";
when 729 => note <= "111111110011011";
when 730 => note <= "000010001001010";
when 731 => note <= "000111110011011";
when 732 => note <= "001111001101111";
when 733 => note <= "010110010000011";
when 734 => note <= "011010110011010";
when 735 => note <= "011011010100001";
when 736 => note <= "010111010000110";
when 737 => note <= "001111010000111";
when 738 => note <= "000100111100011";
when 739 => note <= "111010100000010";
when 740 => note <= "110010001001010";
when 741 => note <= "101101011111110";
when 742 => note <= "101101001100110";
when 743 => note <= "110000101111001";
when 744 => note <= "110110100110001";
when 745 => note <= "111100101011111";
when 746 => note <= "000000111010011";
when 747 => note <= "000001101111101";
when 748 => note <= "111110101000111";
when 749 => note <= "111000001100101";
when 750 => note <= "110000000000000";
when 751 => note <= "101000001100101";
when 752 => note <= "100010111011010";
when 753 => note <= "100001101111101";
when 754 => note <= "100101001100110";
when 755 => note <= "101100101011111";
when 756 => note <= "110110100110001";
when 757 => note <= "000000101111001";
when 758 => note <= "001000111010011";
when 759 => note <= "001101011111110";
when 760 => note <= "001101110110110";
when 761 => note <= "001010100000010";
when 762 => note <= "000100111100011";
when 763 => note <= "111111010000111";
when 764 => note <= "111011100011001";
when 765 => note <= "111011010100001";
when 766 => note <= "111111000101101";
when 767 => note <= "000110010000011";
when 768 => note <= "001111001101111";
when 769 => note <= "010111110011011";
when 770 => note <= "011101110110110";
when 771 => note <= "011111110011011";
when 772 => note <= "011101000100110";
when 773 => note <= "010110010000011";
when 774 => note <= "001100111100011";
when 775 => note <= "000011010100001";
when 776 => note <= "111011100011001";
when 777 => note <= "110111010000111";
when 778 => note <= "110111000101101";
when 779 => note <= "111010100000010";
when 780 => note <= "000000000000000";
when 781 => note <= "000101011111110";
when 782 => note <= "001000111010011";
when 783 => note <= "001000101111001";
when 784 => note <= "000100011100111";
when 785 => note <= "111100101011111";
when 786 => note <= "110011000011101";
when 787 => note <= "101001101111101";
when 788 => note <= "100010111011010";
when 789 => note <= "100000001100101";
when 790 => note <= "100010001001010";
when 791 => note <= "101000001100101";
when 792 => note <= "110000110010001";
when 793 => note <= "111001101111101";
when 794 => note <= "000000111010011";
when 795 => note <= "000100101011111";
when 796 => note <= "000100011100111";
when 797 => note <= "000000101111001";
when 798 => note <= "111011000011101";
when 799 => note <= "110101011111110";
when 800 => note <= "110010001001010";
when 801 => note <= "110010100000010";
when 802 => note <= "110111000101101";
when 803 => note <= "111111010000111";
when 804 => note <= "001001011001111";
when 805 => note <= "010011010100001";
when 806 => note <= "011010110011010";
when 807 => note <= "011110010000011";
when 808 => note <= "011101000100110";
when 809 => note <= "010111110011011";
when 810 => note <= "010000000000000";
when 811 => note <= "000111110011011";
when 812 => note <= "000001010111001";
when 813 => note <= "111110010000011";
when 814 => note <= "111111000101101";
when 815 => note <= "000011010100001";
when 816 => note <= "001001011001111";
when 817 => note <= "001111010000111";
when 818 => note <= "010010110011010";
when 819 => note <= "010010100000010";
when 820 => note <= "001101110110110";
when 821 => note <= "000101011111110";
when 822 => note <= "111011000011101";
when 823 => note <= "110000101111001";
when 824 => note <= "101000101111010";
when 825 => note <= "100100101011111";
when 826 => note <= "100101001100110";
when 827 => note <= "101001101111101";
when 828 => note <= "110000110010001";
when 829 => note <= "111000001100101";
when 830 => note <= "111101110110110";
when 831 => note <= "000000001100101";
when 832 => note <= "111110101000111";
when 833 => note <= "111001101111101";
when 834 => note <= "110011000011101";
when 835 => note <= "101100101011111";
when 836 => note <= "101000101111010";
when 837 => note <= "101000101111001";
when 838 => note <= "101101001100110";
when 839 => note <= "110101011111110";
when 840 => note <= "000000000000000";
when 841 => note <= "001010100000010";
when 842 => note <= "010010110011010";
when 843 => note <= "010111010000111";
when 844 => note <= "010111010000110";
when 845 => note <= "010011010100001";
when 846 => note <= "001100111100011";
when 847 => note <= "000110010000011";
when 848 => note <= "000001010111001";
when 849 => note <= "111111110011011";
when 850 => note <= "000010001001010";
when 851 => note <= "000111110011011";
when 852 => note <= "001111001101111";
when 853 => note <= "010110010000011";
when 854 => note <= "011010110011010";
when 855 => note <= "011011010100001";
when 856 => note <= "010111010000110";
when 857 => note <= "001111010000111";
when 858 => note <= "000100111100011";
when 859 => note <= "111010100000010";
when 860 => note <= "110010001001010";
when 861 => note <= "101101011111110";
when 862 => note <= "101101001100110";
when 863 => note <= "110000101111001";
when 864 => note <= "110110100110001";
when 865 => note <= "111100101011111";
when 866 => note <= "000000111010011";
when 867 => note <= "000001101111101";
when 868 => note <= "111110101000111";
when 869 => note <= "111000001100101";
when 870 => note <= "110000000000000";
when 871 => note <= "101000001100101";
when 872 => note <= "100010111011010";
when 873 => note <= "100001101111101";
when 874 => note <= "100101001100110";
when 875 => note <= "101100101011111";
when 876 => note <= "110110100110001";
when 877 => note <= "000000101111001";
when 878 => note <= "001000111010011";
when 879 => note <= "001101011111110";
when 880 => note <= "001101110110110";
when 881 => note <= "001010100000010";
when 882 => note <= "000100111100011";
when 883 => note <= "111111010000111";
when 884 => note <= "111011100011001";
when 885 => note <= "111011010100001";
when 886 => note <= "111111000101101";
when 887 => note <= "000110010000011";
when 888 => note <= "001111001101111";
when 889 => note <= "010111110011011";
when 890 => note <= "011101110110110";
when 891 => note <= "011111110011011";
when 892 => note <= "011101000100110";
when 893 => note <= "010110010000011";
when 894 => note <= "001100111100011";
when 895 => note <= "000011010100001";
when 896 => note <= "111011100011001";
when 897 => note <= "110111010000111";
when 898 => note <= "110111000101101";
when 899 => note <= "111010100000010";
when 900 => note <= "000000000000000";
when 901 => note <= "000101011111110";
when 902 => note <= "001000111010011";
when 903 => note <= "001000101111001";
when 904 => note <= "000100011100111";
when 905 => note <= "111100101011111";
when 906 => note <= "110011000011101";
when 907 => note <= "101001101111101";
when 908 => note <= "100010111011010";
when 909 => note <= "100000001100101";
when 910 => note <= "100010001001010";
when 911 => note <= "101000001100101";
when 912 => note <= "110000110010001";
when 913 => note <= "111001101111101";
when 914 => note <= "000000111010011";
when 915 => note <= "000100101011111";
when 916 => note <= "000100011100111";
when 917 => note <= "000000101111001";
when 918 => note <= "111011000011101";
when 919 => note <= "110101011111110";
when 920 => note <= "110010001001010";
when 921 => note <= "110010100000010";
when 922 => note <= "110111000101101";
when 923 => note <= "111111010000111";
when 924 => note <= "001001011001111";
when 925 => note <= "010011010100001";
when 926 => note <= "011010110011010";
when 927 => note <= "011110010000011";
when 928 => note <= "011101000100110";
when 929 => note <= "010111110011011";
when 930 => note <= "010000000000000";
when 931 => note <= "000111110011011";
when 932 => note <= "000001010111001";
when 933 => note <= "111110010000011";
when 934 => note <= "111111000101101";
when 935 => note <= "000011010100001";
when 936 => note <= "001001011001111";
when 937 => note <= "001111010000111";
when 938 => note <= "010010110011010";
when 939 => note <= "010010100000010";
when 940 => note <= "001101110110110";
when 941 => note <= "000101011111110";
when 942 => note <= "111011000011101";
when 943 => note <= "110000101111001";
when 944 => note <= "101000101111010";
when 945 => note <= "100100101011111";
when 946 => note <= "100101001100110";
when 947 => note <= "101001101111101";
when 948 => note <= "110000110010001";
when 949 => note <= "111000001100101";
when 950 => note <= "111101110110110";
when 951 => note <= "000000001100101";
when 952 => note <= "111110101000111";
when 953 => note <= "111001101111101";
when 954 => note <= "110011000011101";
when 955 => note <= "101100101011111";
when 956 => note <= "101000101111010";
when 957 => note <= "101000101111001";
when 958 => note <= "101101001100110";
when 959 => note <= "110101011111110";
when 960 => note <= "000000000000000";
when 961 => note <= "001010100000010";
when 962 => note <= "010010110011010";
when 963 => note <= "010111010000111";
when 964 => note <= "010111010000110";
when 965 => note <= "010011010100001";
when 966 => note <= "001100111100011";
when 967 => note <= "000110010000011";
when 968 => note <= "000001010111001";
when 969 => note <= "111111110011011";
when 970 => note <= "000010001001010";
when 971 => note <= "000111110011011";
when 972 => note <= "001111001101111";
when 973 => note <= "010110010000011";
when 974 => note <= "011010110011010";
when 975 => note <= "011011010100001";
when 976 => note <= "010111010000110";
when 977 => note <= "001111010000111";
when 978 => note <= "000100111100011";
when 979 => note <= "111010100000010";
when 980 => note <= "110010001001010";
when 981 => note <= "101101011111110";
when 982 => note <= "101101001100110";
when 983 => note <= "110000101111001";
when 984 => note <= "110110100110001";
when 985 => note <= "111100101011111";
when 986 => note <= "000000111010011";
when 987 => note <= "000001101111101";
when 988 => note <= "111110101000111";
when 989 => note <= "111000001100101";
when 990 => note <= "110000000000000";
when 991 => note <= "101000001100101";
when 992 => note <= "100010111011010";
when 993 => note <= "100001101111101";
when 994 => note <= "100101001100110";
when 995 => note <= "101100101011111";
when 996 => note <= "110110100110001";
when 997 => note <= "000000101111001";
when 998 => note <= "001000111010011";
when 999 => note <= "001101011111110";
when 1000 => note <= "001101110110110";
when 1001 => note <= "001010100000010";
when 1002 => note <= "000100111100011";
when 1003 => note <= "111111010000111";
when 1004 => note <= "111011100011001";
when 1005 => note <= "111011010100001";
when 1006 => note <= "111111000101101";
when 1007 => note <= "000110010000011";
when 1008 => note <= "001111001101111";
when 1009 => note <= "010111110011011";
when 1010 => note <= "011101110110110";
when 1011 => note <= "011111110011011";
when 1012 => note <= "011101000100110";
when 1013 => note <= "010110010000011";
when 1014 => note <= "001100111100011";
when 1015 => note <= "000011010100001";
when 1016 => note <= "111011100011001";
when 1017 => note <= "110111010000111";
when 1018 => note <= "110111000101101";
when 1019 => note <= "111010100000010";
when 1020 => note <= "000000000000000";
when 1021 => note <= "000101011111110";
when 1022 => note <= "001000111010011";
when 1023 => note <= "001000101111001";
when 1024 => note <= "000100011100111";
when 1025 => note <= "111100101011111";
when 1026 => note <= "110011000011101";
when 1027 => note <= "101001101111101";
when 1028 => note <= "100010111011010";
when 1029 => note <= "100000001100101";
when 1030 => note <= "100010001001010";
when 1031 => note <= "101000001100101";
when 1032 => note <= "110000110010001";
when 1033 => note <= "111001101111101";
when 1034 => note <= "000000111010011";
when 1035 => note <= "000100101011111";
when 1036 => note <= "000100011100111";
when 1037 => note <= "000000101111001";
when 1038 => note <= "111011000011101";
when 1039 => note <= "110101011111110";
when 1040 => note <= "110010001001010";
when 1041 => note <= "110010100000010";
when 1042 => note <= "110111000101101";
when 1043 => note <= "111111010000111";
when 1044 => note <= "001001011001111";
when 1045 => note <= "010011010100001";
when 1046 => note <= "011010110011010";
when 1047 => note <= "011110010000011";
when 1048 => note <= "011101000100110";
when 1049 => note <= "010111110011011";
when 1050 => note <= "010000000000000";
when 1051 => note <= "000111110011011";
when 1052 => note <= "000001010111001";
when 1053 => note <= "111110010000011";
when 1054 => note <= "111111000101101";
when 1055 => note <= "000011010100001";
when 1056 => note <= "001001011001111";
when 1057 => note <= "001111010000111";
when 1058 => note <= "010010110011010";
when 1059 => note <= "010010100000010";
when 1060 => note <= "001101110110110";
when 1061 => note <= "000101011111110";
when 1062 => note <= "111011000011101";
when 1063 => note <= "110000101111001";
when 1064 => note <= "101000101111010";
when 1065 => note <= "100100101011111";
when 1066 => note <= "100101001100110";
when 1067 => note <= "101001101111101";
when 1068 => note <= "110000110010001";
when 1069 => note <= "111000001100101";
when 1070 => note <= "111101110110110";
when 1071 => note <= "000000001100101";
when 1072 => note <= "111110101000111";
when 1073 => note <= "111001101111101";
when 1074 => note <= "110011000011101";
when 1075 => note <= "101100101011111";
when 1076 => note <= "101000101111010";
when 1077 => note <= "101000101111001";
when 1078 => note <= "101101001100110";
when 1079 => note <= "110101011111110";
when 1080 => note <= "000000000000000";
when 1081 => note <= "001010100000010";
when 1082 => note <= "010010110011010";
when 1083 => note <= "010111010000111";
when 1084 => note <= "010111010000110";
when 1085 => note <= "010011010100001";
when 1086 => note <= "001100111100011";
when 1087 => note <= "000110010000011";
when 1088 => note <= "000001010111001";
when 1089 => note <= "111111110011011";
when 1090 => note <= "000010001001010";
when 1091 => note <= "000111110011011";
when 1092 => note <= "001111001101111";
when 1093 => note <= "010110010000011";
when 1094 => note <= "011010110011010";
when 1095 => note <= "011011010100001";
when 1096 => note <= "010111010000110";
when 1097 => note <= "001111010000111";
when 1098 => note <= "000100111100011";
when 1099 => note <= "111010100000010";
when 1100 => note <= "110010001001010";
when 1101 => note <= "101101011111110";
when 1102 => note <= "101101001100110";
when 1103 => note <= "110000101111001";
when 1104 => note <= "110110100110001";
when 1105 => note <= "111100101011111";
when 1106 => note <= "000000111010011";
when 1107 => note <= "000001101111101";
when 1108 => note <= "111110101000111";
when 1109 => note <= "111000001100101";
when 1110 => note <= "110000000000000";
when 1111 => note <= "101000001100101";
when 1112 => note <= "100010111011010";
when 1113 => note <= "100001101111101";
when 1114 => note <= "100101001100110";
when 1115 => note <= "101100101011111";
when 1116 => note <= "110110100110001";
when 1117 => note <= "000000101111001";
when 1118 => note <= "001000111010011";
when 1119 => note <= "001101011111110";
when 1120 => note <= "001101110110110";
when 1121 => note <= "001010100000010";
when 1122 => note <= "000100111100011";
when 1123 => note <= "111111010000111";
when 1124 => note <= "111011100011001";
when 1125 => note <= "111011010100001";
when 1126 => note <= "111111000101101";
when 1127 => note <= "000110010000011";
when 1128 => note <= "001111001101111";
when 1129 => note <= "010111110011011";
when 1130 => note <= "011101110110110";
when 1131 => note <= "011111110011011";
when 1132 => note <= "011101000100110";
when 1133 => note <= "010110010000011";
when 1134 => note <= "001100111100011";
when 1135 => note <= "000011010100001";
when 1136 => note <= "111011100011001";
when 1137 => note <= "110111010000111";
when 1138 => note <= "110111000101101";
when 1139 => note <= "111010100000010";
when 1140 => note <= "000000000000000";
when 1141 => note <= "000101011111110";
when 1142 => note <= "001000111010011";
when 1143 => note <= "001000101111001";
when 1144 => note <= "000100011100111";
when 1145 => note <= "111100101011111";
when 1146 => note <= "110011000011101";
when 1147 => note <= "101001101111101";
when 1148 => note <= "100010111011010";
when 1149 => note <= "100000001100101";
when 1150 => note <= "100010001001010";
when 1151 => note <= "101000001100101";
when 1152 => note <= "110000110010001";
when 1153 => note <= "111001101111101";
when 1154 => note <= "000000111010011";
when 1155 => note <= "000100101011111";
when 1156 => note <= "000100011100111";
when 1157 => note <= "000000101111001";
when 1158 => note <= "111011000011101";
when 1159 => note <= "110101011111110";
when 1160 => note <= "110010001001010";
when 1161 => note <= "110010100000010";
when 1162 => note <= "110111000101101";
when 1163 => note <= "111111010000111";
when 1164 => note <= "001001011001111";
when 1165 => note <= "010011010100001";
when 1166 => note <= "011010110011010";
when 1167 => note <= "011110010000011";
when 1168 => note <= "011101000100110";
when 1169 => note <= "010111110011011";
when 1170 => note <= "010000000000000";
when 1171 => note <= "000111110011011";
when 1172 => note <= "000001010111001";
when 1173 => note <= "111110010000011";
when 1174 => note <= "111111000101101";
when 1175 => note <= "000011010100001";
when 1176 => note <= "001001011001111";
when 1177 => note <= "001111010000111";
when 1178 => note <= "010010110011010";
when 1179 => note <= "010010100000010";
when 1180 => note <= "001101110110110";
when 1181 => note <= "000101011111110";
when 1182 => note <= "111011000011101";
when 1183 => note <= "110000101111001";
when 1184 => note <= "101000101111010";
when 1185 => note <= "100100101011111";
when 1186 => note <= "100101001100110";
when 1187 => note <= "101001101111101";
when 1188 => note <= "110000110010001";
when 1189 => note <= "111000001100101";
when 1190 => note <= "111101110110110";
when 1191 => note <= "000000001100101";
when 1192 => note <= "111110101000111";
when 1193 => note <= "111001101111101";
when 1194 => note <= "110011000011101";
when 1195 => note <= "101100101011111";
when 1196 => note <= "101000101111010";
when 1197 => note <= "101000101111001";
when 1198 => note <= "101101001100110";
when 1199 => note <= "110101011111110";
when 1200 => note <= "000000000000000";
when 1201 => note <= "001010100000010";
when 1202 => note <= "010010110011010";
when 1203 => note <= "010111010000111";
when 1204 => note <= "010111010000110";
when 1205 => note <= "010011010100001";
when 1206 => note <= "001100111100011";
when 1207 => note <= "000110010000011";
when 1208 => note <= "000001010111001";
when 1209 => note <= "111111110011011";
when 1210 => note <= "000010001001010";
when 1211 => note <= "000111110011011";
when 1212 => note <= "001111001101111";
when 1213 => note <= "010110010000011";
when 1214 => note <= "011010110011010";
when 1215 => note <= "011011010100001";
when 1216 => note <= "010111010000110";
when 1217 => note <= "001111010000111";
when 1218 => note <= "000100111100011";
when 1219 => note <= "111010100000010";
when 1220 => note <= "110010001001010";
when 1221 => note <= "101101011111110";
when 1222 => note <= "101101001100110";
when 1223 => note <= "110000101111001";
when 1224 => note <= "110110100110001";
when 1225 => note <= "111100101011111";
when 1226 => note <= "000000111010011";
when 1227 => note <= "000001101111101";
when 1228 => note <= "111110101000111";
when 1229 => note <= "111000001100101";
when 1230 => note <= "110000000000000";
when 1231 => note <= "101000001100101";
when 1232 => note <= "100010111011010";
when 1233 => note <= "100001101111101";
when 1234 => note <= "100101001100110";
when 1235 => note <= "101100101011111";
when 1236 => note <= "110110100110001";
when 1237 => note <= "000000101111001";
when 1238 => note <= "001000111010011";
when 1239 => note <= "001101011111110";
when 1240 => note <= "001101110110110";
when 1241 => note <= "001010100000010";
when 1242 => note <= "000100111100011";
when 1243 => note <= "111111010000111";
when 1244 => note <= "111011100011001";
when 1245 => note <= "111011010100001";
when 1246 => note <= "111111000101101";
when 1247 => note <= "000110010000011";
when 1248 => note <= "001111001101111";
when 1249 => note <= "010111110011011";
when 1250 => note <= "011101110110110";
when 1251 => note <= "011111110011011";
when 1252 => note <= "011101000100110";
when 1253 => note <= "010110010000011";
when 1254 => note <= "001100111100011";
when 1255 => note <= "000011010100001";
when 1256 => note <= "111011100011001";
when 1257 => note <= "110111010000111";
when 1258 => note <= "110111000101101";
when 1259 => note <= "111010100000010";
when 1260 => note <= "000000000000000";
when 1261 => note <= "000101011111110";
when 1262 => note <= "001000111010011";
when 1263 => note <= "001000101111001";
when 1264 => note <= "000100011100111";
when 1265 => note <= "111100101011111";
when 1266 => note <= "110011000011101";
when 1267 => note <= "101001101111101";
when 1268 => note <= "100010111011010";
when 1269 => note <= "100000001100101";
when 1270 => note <= "100010001001010";
when 1271 => note <= "101000001100101";
when 1272 => note <= "110000110010001";
when 1273 => note <= "111001101111101";
when 1274 => note <= "000000111010011";
when 1275 => note <= "000100101011111";
when 1276 => note <= "000100011100111";
when 1277 => note <= "000000101111001";
when 1278 => note <= "111011000011101";
when 1279 => note <= "110101011111110";
when 1280 => note <= "110010001001010";
when 1281 => note <= "110010100000010";
when 1282 => note <= "110111000101101";
when 1283 => note <= "111111010000111";
when 1284 => note <= "001001011001111";
when 1285 => note <= "010011010100001";
when 1286 => note <= "011010110011010";
when 1287 => note <= "011110010000011";
when 1288 => note <= "011101000100110";
when 1289 => note <= "010111110011011";
when 1290 => note <= "010000000000000";
when 1291 => note <= "000111110011011";
when 1292 => note <= "000001010111001";
when 1293 => note <= "111110010000011";
when 1294 => note <= "111111000101101";
when 1295 => note <= "000011010100001";
when 1296 => note <= "001001011001111";
when 1297 => note <= "001111010000111";
when 1298 => note <= "010010110011010";
when 1299 => note <= "010010100000010";
when 1300 => note <= "001101110110110";
when 1301 => note <= "000101011111110";
when 1302 => note <= "111011000011101";
when 1303 => note <= "110000101111001";
when 1304 => note <= "101000101111010";
when 1305 => note <= "100100101011111";
when 1306 => note <= "100101001100110";
when 1307 => note <= "101001101111101";
when 1308 => note <= "110000110010001";
when 1309 => note <= "111000001100101";
when 1310 => note <= "111101110110110";
when 1311 => note <= "000000001100101";
when 1312 => note <= "111110101000111";
when 1313 => note <= "111001101111101";
when 1314 => note <= "110011000011101";
when 1315 => note <= "101100101011111";
when 1316 => note <= "101000101111010";
when 1317 => note <= "101000101111001";
when 1318 => note <= "101101001100110";
when 1319 => note <= "110101011111110";
when 1320 => note <= "000000000000000";
when 1321 => note <= "001010100000010";
when 1322 => note <= "010010110011010";
when 1323 => note <= "010111010000111";
when 1324 => note <= "010111010000110";
when 1325 => note <= "010011010100001";
when 1326 => note <= "001100111100011";
when 1327 => note <= "000110010000011";
when 1328 => note <= "000001010111001";
when 1329 => note <= "111111110011011";
when 1330 => note <= "000010001001010";
when 1331 => note <= "000111110011011";
when 1332 => note <= "001111001101111";
when 1333 => note <= "010110010000011";
when 1334 => note <= "011010110011010";
when 1335 => note <= "011011010100001";
when 1336 => note <= "010111010000110";
when 1337 => note <= "001111010000111";
when 1338 => note <= "000100111100011";
when 1339 => note <= "111010100000010";
when 1340 => note <= "110010001001010";
when 1341 => note <= "101101011111110";
when 1342 => note <= "101101001100110";
when 1343 => note <= "110000101111001";
when 1344 => note <= "110110100110001";
when 1345 => note <= "111100101011111";
when 1346 => note <= "000000111010011";
when 1347 => note <= "000001101111101";
when 1348 => note <= "111110101000111";
when 1349 => note <= "111000001100101";
when 1350 => note <= "110000000000000";
when 1351 => note <= "101000001100101";
when 1352 => note <= "100010111011010";
when 1353 => note <= "100001101111101";
when 1354 => note <= "100101001100110";
when 1355 => note <= "101100101011111";
when 1356 => note <= "110110100110001";
when 1357 => note <= "000000101111001";
when 1358 => note <= "001000111010011";
when 1359 => note <= "001101011111110";
when 1360 => note <= "001101110110110";
when 1361 => note <= "001010100000010";
when 1362 => note <= "000100111100011";
when 1363 => note <= "111111010000111";
when 1364 => note <= "111011100011001";
when 1365 => note <= "111011010100001";
when 1366 => note <= "111111000101101";
when 1367 => note <= "000110010000011";
when 1368 => note <= "001111001101111";
when 1369 => note <= "010111110011011";
when 1370 => note <= "011101110110110";
when 1371 => note <= "011111110011011";
when 1372 => note <= "011101000100110";
when 1373 => note <= "010110010000011";
when 1374 => note <= "001100111100011";
when 1375 => note <= "000011010100001";
when 1376 => note <= "111011100011001";
when 1377 => note <= "110111010000111";
when 1378 => note <= "110111000101101";
when 1379 => note <= "111010100000010";
when 1380 => note <= "000000000000000";
when 1381 => note <= "000101011111110";
when 1382 => note <= "001000111010011";
when 1383 => note <= "001000101111001";
when 1384 => note <= "000100011100111";
when 1385 => note <= "111100101011111";
when 1386 => note <= "110011000011101";
when 1387 => note <= "101001101111101";
when 1388 => note <= "100010111011010";
when 1389 => note <= "100000001100101";
when 1390 => note <= "100010001001010";
when 1391 => note <= "101000001100101";
when 1392 => note <= "110000110010001";
when 1393 => note <= "111001101111101";
when 1394 => note <= "000000111010011";
when 1395 => note <= "000100101011111";
when 1396 => note <= "000100011100111";
when 1397 => note <= "000000101111001";
when 1398 => note <= "111011000011101";
when 1399 => note <= "110101011111110";
when 1400 => note <= "110010001001010";
when 1401 => note <= "110010100000010";
when 1402 => note <= "110111000101101";
when 1403 => note <= "111111010000111";
when 1404 => note <= "001001011001111";
when 1405 => note <= "010011010100001";
when 1406 => note <= "011010110011010";
when 1407 => note <= "011110010000011";
when 1408 => note <= "011101000100110";
when 1409 => note <= "010111110011011";
when 1410 => note <= "010000000000000";
when 1411 => note <= "000111110011011";
when 1412 => note <= "000001010111001";
when 1413 => note <= "111110010000011";
when 1414 => note <= "111111000101101";
when 1415 => note <= "000011010100001";
when 1416 => note <= "001001011001111";
when 1417 => note <= "001111010000111";
when 1418 => note <= "010010110011010";
when 1419 => note <= "010010100000010";
when 1420 => note <= "001101110110110";
when 1421 => note <= "000101011111110";
when 1422 => note <= "111011000011101";
when 1423 => note <= "110000101111001";
when 1424 => note <= "101000101111010";
when 1425 => note <= "100100101011111";
when 1426 => note <= "100101001100110";
when 1427 => note <= "101001101111101";
when 1428 => note <= "110000110010001";
when 1429 => note <= "111000001100101";
when 1430 => note <= "111101110110110";
when 1431 => note <= "000000001100101";
when 1432 => note <= "111110101000111";
when 1433 => note <= "111001101111101";
when 1434 => note <= "110011000011101";
when 1435 => note <= "101100101011111";
when 1436 => note <= "101000101111010";
when 1437 => note <= "101000101111001";
when 1438 => note <= "101101001100110";
when 1439 => note <= "110101011111110";
when 1440 => note <= "000000000000000";
when 1441 => note <= "001010100000010";
when 1442 => note <= "010010110011010";
when 1443 => note <= "010111010000111";
when 1444 => note <= "010111010000110";
when 1445 => note <= "010011010100001";
when 1446 => note <= "001100111100011";
when 1447 => note <= "000110010000011";
when 1448 => note <= "000001010111001";
when 1449 => note <= "111111110011011";
when 1450 => note <= "000010001001010";
when 1451 => note <= "000111110011011";
when 1452 => note <= "001111001101111";
when 1453 => note <= "010110010000011";
when 1454 => note <= "011010110011010";
when 1455 => note <= "011011010100001";
when 1456 => note <= "010111010000110";
when 1457 => note <= "001111010000111";
when 1458 => note <= "000100111100011";
when 1459 => note <= "111010100000010";
when 1460 => note <= "110010001001010";
when 1461 => note <= "101101011111110";
when 1462 => note <= "101101001100110";
when 1463 => note <= "110000101111001";
when 1464 => note <= "110110100110001";
when 1465 => note <= "111100101011111";
when 1466 => note <= "000000111010011";
when 1467 => note <= "000001101111101";
when 1468 => note <= "111110101000111";
when 1469 => note <= "111000001100101";
when 1470 => note <= "110000000000000";
when 1471 => note <= "101000001100101";
when 1472 => note <= "100010111011010";
when 1473 => note <= "100001101111101";
when 1474 => note <= "100101001100110";
when 1475 => note <= "101100101011111";
when 1476 => note <= "110110100110001";
when 1477 => note <= "000000101111001";
when 1478 => note <= "001000111010011";
when 1479 => note <= "001101011111110";
when 1480 => note <= "001101110110110";
when 1481 => note <= "001010100000010";
when 1482 => note <= "000100111100011";
when 1483 => note <= "111111010000111";
when 1484 => note <= "111011100011001";
when 1485 => note <= "111011010100001";
when 1486 => note <= "111111000101101";
when 1487 => note <= "000110010000011";
when 1488 => note <= "001111001101111";
when 1489 => note <= "010111110011011";
when 1490 => note <= "011101110110110";
when 1491 => note <= "011111110011011";
when 1492 => note <= "011101000100110";
when 1493 => note <= "010110010000011";
when 1494 => note <= "001100111100011";
when 1495 => note <= "000011010100001";
when 1496 => note <= "111011100011001";
when 1497 => note <= "110111010000111";
when 1498 => note <= "110111000101101";
when 1499 => note <= "111010100000010";
when 1500 => note <= "000000000000000";
when 1501 => note <= "000101011111110";
when 1502 => note <= "001000111010011";
when 1503 => note <= "001000101111001";
when 1504 => note <= "000100011100111";
when 1505 => note <= "111100101011111";
when 1506 => note <= "110011000011101";
when 1507 => note <= "101001101111101";
when 1508 => note <= "100010111011010";
when 1509 => note <= "100000001100101";
when 1510 => note <= "100010001001010";
when 1511 => note <= "101000001100101";
when 1512 => note <= "110000110010001";
when 1513 => note <= "111001101111101";
when 1514 => note <= "000000111010011";
when 1515 => note <= "000100101011111";
when 1516 => note <= "000100011100111";
when 1517 => note <= "000000101111001";
when 1518 => note <= "111011000011101";
when 1519 => note <= "110101011111110";
when 1520 => note <= "110010001001010";
when 1521 => note <= "110010100000010";
when 1522 => note <= "110111000101101";
when 1523 => note <= "111111010000111";
when 1524 => note <= "001001011001111";
when 1525 => note <= "010011010100001";
when 1526 => note <= "011010110011010";
when 1527 => note <= "011110010000011";
when 1528 => note <= "011101000100110";
when 1529 => note <= "010111110011011";
when 1530 => note <= "010000000000000";
when 1531 => note <= "000111110011011";
when 1532 => note <= "000001010111001";
when 1533 => note <= "111110010000011";
when 1534 => note <= "111111000101101";
when 1535 => note <= "000011010100001";
when 1536 => note <= "001001011001111";
when 1537 => note <= "001111010000111";
when 1538 => note <= "010010110011010";
when 1539 => note <= "010010100000010";
when 1540 => note <= "001101110110110";
when 1541 => note <= "000101011111110";
when 1542 => note <= "111011000011101";
when 1543 => note <= "110000101111001";
when 1544 => note <= "101000101111010";
when 1545 => note <= "100100101011111";
when 1546 => note <= "100101001100110";
when 1547 => note <= "101001101111101";
when 1548 => note <= "110000110010001";
when 1549 => note <= "111000001100101";
when 1550 => note <= "111101110110110";
when 1551 => note <= "000000001100101";
when 1552 => note <= "111110101000111";
when 1553 => note <= "111001101111101";
when 1554 => note <= "110011000011101";
when 1555 => note <= "101100101011111";
when 1556 => note <= "101000101111010";
when 1557 => note <= "101000101111001";
when 1558 => note <= "101101001100110";
when 1559 => note <= "110101011111110";
when 1560 => note <= "000000000000000";
when 1561 => note <= "001010100000010";
when 1562 => note <= "010010110011010";
when 1563 => note <= "010111010000111";
when 1564 => note <= "010111010000110";
when 1565 => note <= "010011010100001";
when 1566 => note <= "001100111100011";
when 1567 => note <= "000110010000011";
when 1568 => note <= "000001010111001";
when 1569 => note <= "111111110011011";
when 1570 => note <= "000010001001010";
when 1571 => note <= "000111110011011";
when 1572 => note <= "001111001101111";
when 1573 => note <= "010110010000011";
when 1574 => note <= "011010110011010";
when 1575 => note <= "011011010100001";
when 1576 => note <= "010111010000110";
when 1577 => note <= "001111010000111";
when 1578 => note <= "000100111100011";
when 1579 => note <= "111010100000010";
when 1580 => note <= "110010001001010";
when 1581 => note <= "101101011111110";
when 1582 => note <= "101101001100110";
when 1583 => note <= "110000101111001";
when 1584 => note <= "110110100110001";
when 1585 => note <= "111100101011111";
when 1586 => note <= "000000111010011";
when 1587 => note <= "000001101111101";
when 1588 => note <= "111110101000111";
when 1589 => note <= "111000001100101";
when 1590 => note <= "110000000000000";
when 1591 => note <= "101000001100101";
when 1592 => note <= "100010111011010";
when 1593 => note <= "100001101111101";
when 1594 => note <= "100101001100110";
when 1595 => note <= "101100101011111";
when 1596 => note <= "110110100110001";
when 1597 => note <= "000000101111001";
when 1598 => note <= "001000111010011";
when 1599 => note <= "001101011111110";
when 1600 => note <= "001101110110110";
when 1601 => note <= "001010100000010";
when 1602 => note <= "000100111100011";
when 1603 => note <= "111111010000111";
when 1604 => note <= "111011100011001";
when 1605 => note <= "111011010100001";
when 1606 => note <= "111111000101101";
when 1607 => note <= "000110010000011";
when 1608 => note <= "001111001101111";
when 1609 => note <= "010111110011011";
when 1610 => note <= "011101110110110";
when 1611 => note <= "011111110011011";
when 1612 => note <= "011101000100110";
when 1613 => note <= "010110010000011";
when 1614 => note <= "001100111100011";
when 1615 => note <= "000011010100001";
when 1616 => note <= "111011100011001";
when 1617 => note <= "110111010000111";
when 1618 => note <= "110111000101101";
when 1619 => note <= "111010100000010";
when 1620 => note <= "000000000000000";
when 1621 => note <= "000101011111110";
when 1622 => note <= "001000111010011";
when 1623 => note <= "001000101111001";
when 1624 => note <= "000100011100111";
when 1625 => note <= "111100101011111";
when 1626 => note <= "110011000011101";
when 1627 => note <= "101001101111101";
when 1628 => note <= "100010111011010";
when 1629 => note <= "100000001100101";
when 1630 => note <= "100010001001010";
when 1631 => note <= "101000001100101";
when 1632 => note <= "110000110010001";
when 1633 => note <= "111001101111101";
when 1634 => note <= "000000111010011";
when 1635 => note <= "000100101011111";
when 1636 => note <= "000100011100111";
when 1637 => note <= "000000101111001";
when 1638 => note <= "111011000011101";
when 1639 => note <= "110101011111110";
when 1640 => note <= "110010001001010";
when 1641 => note <= "110010100000010";
when 1642 => note <= "110111000101101";
when 1643 => note <= "111111010000111";
when 1644 => note <= "001001011001111";
when 1645 => note <= "010011010100001";
when 1646 => note <= "011010110011010";
when 1647 => note <= "011110010000011";
when 1648 => note <= "011101000100110";
when 1649 => note <= "010111110011011";
when 1650 => note <= "010000000000000";
when 1651 => note <= "000111110011011";
when 1652 => note <= "000001010111001";
when 1653 => note <= "111110010000011";
when 1654 => note <= "111111000101101";
when 1655 => note <= "000011010100001";
when 1656 => note <= "001001011001111";
when 1657 => note <= "001111010000111";
when 1658 => note <= "010010110011010";
when 1659 => note <= "010010100000010";
when 1660 => note <= "001101110110110";
when 1661 => note <= "000101011111110";
when 1662 => note <= "111011000011101";
when 1663 => note <= "110000101111001";
when 1664 => note <= "101000101111010";
when 1665 => note <= "100100101011111";
when 1666 => note <= "100101001100110";
when 1667 => note <= "101001101111101";
when 1668 => note <= "110000110010001";
when 1669 => note <= "111000001100101";
when 1670 => note <= "111101110110110";
when 1671 => note <= "000000001100101";
when 1672 => note <= "111110101000111";
when 1673 => note <= "111001101111101";
when 1674 => note <= "110011000011101";
when 1675 => note <= "101100101011111";
when 1676 => note <= "101000101111010";
when 1677 => note <= "101000101111001";
when 1678 => note <= "101101001100110";
when 1679 => note <= "110101011111110";
when 1680 => note <= "000000000000000";
when 1681 => note <= "001010100000010";
when 1682 => note <= "010010110011010";
when 1683 => note <= "010111010000111";
when 1684 => note <= "010111010000110";
when 1685 => note <= "010011010100001";
when 1686 => note <= "001100111100011";
when 1687 => note <= "000110010000011";
when 1688 => note <= "000001010111001";
when 1689 => note <= "111111110011011";
when 1690 => note <= "000010001001010";
when 1691 => note <= "000111110011011";
when 1692 => note <= "001111001101111";
when 1693 => note <= "010110010000011";
when 1694 => note <= "011010110011010";
when 1695 => note <= "011011010100001";
when 1696 => note <= "010111010000110";
when 1697 => note <= "001111010000111";
when 1698 => note <= "000100111100011";
when 1699 => note <= "111010100000010";
when 1700 => note <= "110010001001010";
when 1701 => note <= "101101011111110";
when 1702 => note <= "101101001100110";
when 1703 => note <= "110000101111001";
when 1704 => note <= "110110100110001";
when 1705 => note <= "111100101011111";
when 1706 => note <= "000000111010011";
when 1707 => note <= "000001101111101";
when 1708 => note <= "111110101000111";
when 1709 => note <= "111000001100101";
when 1710 => note <= "110000000000000";
when 1711 => note <= "101000001100101";
when 1712 => note <= "100010111011010";
when 1713 => note <= "100001101111101";
when 1714 => note <= "100101001100110";
when 1715 => note <= "101100101011111";
when 1716 => note <= "110110100110001";
when 1717 => note <= "000000101111001";
when 1718 => note <= "001000111010011";
when 1719 => note <= "001101011111110";
when 1720 => note <= "001101110110110";
when 1721 => note <= "001010100000010";
when 1722 => note <= "000100111100011";
when 1723 => note <= "111111010000111";
when 1724 => note <= "111011100011001";
when 1725 => note <= "111011010100001";
when 1726 => note <= "111111000101101";
when 1727 => note <= "000110010000011";
when 1728 => note <= "001111001101111";
when 1729 => note <= "010111110011011";
when 1730 => note <= "011101110110110";
when 1731 => note <= "011111110011011";
when 1732 => note <= "011101000100110";
when 1733 => note <= "010110010000011";
when 1734 => note <= "001100111100011";
when 1735 => note <= "000011010100001";
when 1736 => note <= "111011100011001";
when 1737 => note <= "110111010000111";
when 1738 => note <= "110111000101101";
when 1739 => note <= "111010100000010";
when 1740 => note <= "000000000000000";
when 1741 => note <= "000101011111110";
when 1742 => note <= "001000111010011";
when 1743 => note <= "001000101111001";
when 1744 => note <= "000100011100111";
when 1745 => note <= "111100101011111";
when 1746 => note <= "110011000011101";
when 1747 => note <= "101001101111101";
when 1748 => note <= "100010111011010";
when 1749 => note <= "100000001100101";
when 1750 => note <= "100010001001010";
when 1751 => note <= "101000001100101";
when 1752 => note <= "110000110010001";
when 1753 => note <= "111001101111101";
when 1754 => note <= "000000111010011";
when 1755 => note <= "000100101011111";
when 1756 => note <= "000100011100111";
when 1757 => note <= "000000101111001";
when 1758 => note <= "111011000011101";
when 1759 => note <= "110101011111110";
when 1760 => note <= "110010001001010";
when 1761 => note <= "110010100000010";
when 1762 => note <= "110111000101101";
when 1763 => note <= "111111010000111";
when 1764 => note <= "001001011001111";
when 1765 => note <= "010011010100001";
when 1766 => note <= "011010110011010";
when 1767 => note <= "011110010000011";
when 1768 => note <= "011101000100110";
when 1769 => note <= "010111110011011";
when 1770 => note <= "010000000000000";
when 1771 => note <= "000111110011011";
when 1772 => note <= "000001010111001";
when 1773 => note <= "111110010000011";
when 1774 => note <= "111111000101101";
when 1775 => note <= "000011010100001";
when 1776 => note <= "001001011001111";
when 1777 => note <= "001111010000111";
when 1778 => note <= "010010110011010";
when 1779 => note <= "010010100000010";
when 1780 => note <= "001101110110110";
when 1781 => note <= "000101011111110";
when 1782 => note <= "111011000011101";
when 1783 => note <= "110000101111001";
when 1784 => note <= "101000101111010";
when 1785 => note <= "100100101011111";
when 1786 => note <= "100101001100110";
when 1787 => note <= "101001101111101";
when 1788 => note <= "110000110010001";
when 1789 => note <= "111000001100101";
when 1790 => note <= "111101110110110";
when 1791 => note <= "000000001100101";
when 1792 => note <= "111110101000111";
when 1793 => note <= "111001101111101";
when 1794 => note <= "110011000011101";
when 1795 => note <= "101100101011111";
when 1796 => note <= "101000101111010";
when 1797 => note <= "101000101111001";
when 1798 => note <= "101101001100110";
when 1799 => note <= "110101011111110";
when 1800 => note <= "000000000000000";
when 1801 => note <= "001010100000010";
when 1802 => note <= "010010110011010";
when 1803 => note <= "010111010000111";
when 1804 => note <= "010111010000110";
when 1805 => note <= "010011010100001";
when 1806 => note <= "001100111100011";
when 1807 => note <= "000110010000011";
when 1808 => note <= "000001010111001";
when 1809 => note <= "111111110011011";
when 1810 => note <= "000010001001010";
when 1811 => note <= "000111110011011";
when 1812 => note <= "001111001101111";
when 1813 => note <= "010110010000011";
when 1814 => note <= "011010110011010";
when 1815 => note <= "011011010100001";
when 1816 => note <= "010111010000110";
when 1817 => note <= "001111010000111";
when 1818 => note <= "000100111100011";
when 1819 => note <= "111010100000010";
when 1820 => note <= "110010001001010";
when 1821 => note <= "101101011111110";
when 1822 => note <= "101101001100110";
when 1823 => note <= "110000101111001";
when 1824 => note <= "110110100110001";
when 1825 => note <= "111100101011111";
when 1826 => note <= "000000111010011";
when 1827 => note <= "000001101111101";
when 1828 => note <= "111110101000111";
when 1829 => note <= "111000001100101";
when 1830 => note <= "110000000000000";
when 1831 => note <= "101000001100101";
when 1832 => note <= "100010111011010";
when 1833 => note <= "100001101111101";
when 1834 => note <= "100101001100110";
when 1835 => note <= "101100101011111";
when 1836 => note <= "110110100110001";
when 1837 => note <= "000000101111001";
when 1838 => note <= "001000111010011";
when 1839 => note <= "001101011111110";
when 1840 => note <= "001101110110110";
when 1841 => note <= "001010100000010";
when 1842 => note <= "000100111100011";
when 1843 => note <= "111111010000111";
when 1844 => note <= "111011100011001";
when 1845 => note <= "111011010100001";
when 1846 => note <= "111111000101101";
when 1847 => note <= "000110010000011";
when 1848 => note <= "001111001101111";
when 1849 => note <= "010111110011011";
when 1850 => note <= "011101110110110";
when 1851 => note <= "011111110011011";
when 1852 => note <= "011101000100110";
when 1853 => note <= "010110010000011";
when 1854 => note <= "001100111100011";
when 1855 => note <= "000011010100001";
when 1856 => note <= "111011100011001";
when 1857 => note <= "110111010000111";
when 1858 => note <= "110111000101101";
when 1859 => note <= "111010100000010";
when 1860 => note <= "000000000000000";
when 1861 => note <= "000101011111110";
when 1862 => note <= "001000111010011";
when 1863 => note <= "001000101111001";
when 1864 => note <= "000100011100111";
when 1865 => note <= "111100101011111";
when 1866 => note <= "110011000011101";
when 1867 => note <= "101001101111101";
when 1868 => note <= "100010111011010";
when 1869 => note <= "100000001100101";
when 1870 => note <= "100010001001010";
when 1871 => note <= "101000001100101";
when 1872 => note <= "110000110010001";
when 1873 => note <= "111001101111101";
when 1874 => note <= "000000111010011";
when 1875 => note <= "000100101011111";
when 1876 => note <= "000100011100111";
when 1877 => note <= "000000101111001";
when 1878 => note <= "111011000011101";
when 1879 => note <= "110101011111110";
when 1880 => note <= "110010001001010";
when 1881 => note <= "110010100000010";
when 1882 => note <= "110111000101101";
when 1883 => note <= "111111010000111";
when 1884 => note <= "001001011001111";
when 1885 => note <= "010011010100001";
when 1886 => note <= "011010110011010";
when 1887 => note <= "011110010000011";
when 1888 => note <= "011101000100110";
when 1889 => note <= "010111110011011";
when 1890 => note <= "010000000000000";
when 1891 => note <= "000111110011011";
when 1892 => note <= "000001010111001";
when 1893 => note <= "111110010000011";
when 1894 => note <= "111111000101101";
when 1895 => note <= "000011010100001";
when 1896 => note <= "001001011001111";
when 1897 => note <= "001111010000111";
when 1898 => note <= "010010110011010";
when 1899 => note <= "010010100000010";
when 1900 => note <= "001101110110110";
when 1901 => note <= "000101011111110";
when 1902 => note <= "111011000011101";
when 1903 => note <= "110000101111001";
when 1904 => note <= "101000101111010";
when 1905 => note <= "100100101011111";
when 1906 => note <= "100101001100110";
when 1907 => note <= "101001101111101";
when 1908 => note <= "110000110010001";
when 1909 => note <= "111000001100101";
when 1910 => note <= "111101110110110";
when 1911 => note <= "000000001100101";
when 1912 => note <= "111110101000111";
when 1913 => note <= "111001101111101";
when 1914 => note <= "110011000011101";
when 1915 => note <= "101100101011111";
when 1916 => note <= "101000101111010";
when 1917 => note <= "101000101111001";
when 1918 => note <= "101101001100110";
when 1919 => note <= "110101011111110";
when 1920 => note <= "000000000000000";
when 1921 => note <= "001010100000010";
when 1922 => note <= "010010110011010";
when 1923 => note <= "010111010000111";
when 1924 => note <= "010111010000110";
when 1925 => note <= "010011010100001";
when 1926 => note <= "001100111100011";
when 1927 => note <= "000110010000011";
when 1928 => note <= "000001010111001";
when 1929 => note <= "111111110011011";
when 1930 => note <= "000010001001010";
when 1931 => note <= "000111110011011";
when 1932 => note <= "001111001101111";
when 1933 => note <= "010110010000011";
when 1934 => note <= "011010110011010";
when 1935 => note <= "011011010100001";
when 1936 => note <= "010111010000110";
when 1937 => note <= "001111010000111";
when 1938 => note <= "000100111100011";
when 1939 => note <= "111010100000010";
when 1940 => note <= "110010001001010";
when 1941 => note <= "101101011111110";
when 1942 => note <= "101101001100110";
when 1943 => note <= "110000101111001";
when 1944 => note <= "110110100110001";
when 1945 => note <= "111100101011111";
when 1946 => note <= "000000111010011";
when 1947 => note <= "000001101111101";
when 1948 => note <= "111110101000111";
when 1949 => note <= "111000001100101";
when 1950 => note <= "110000000000000";
when 1951 => note <= "101000001100101";
when 1952 => note <= "100010111011010";
when 1953 => note <= "100001101111101";
when 1954 => note <= "100101001100110";
when 1955 => note <= "101100101011111";
when 1956 => note <= "110110100110001";
when 1957 => note <= "000000101111001";
when 1958 => note <= "001000111010011";
when 1959 => note <= "001101011111110";
when 1960 => note <= "001101110110110";
when 1961 => note <= "001010100000010";
when 1962 => note <= "000100111100011";
when 1963 => note <= "111111010000111";
when 1964 => note <= "111011100011001";
when 1965 => note <= "111011010100001";
when 1966 => note <= "111111000101101";
when 1967 => note <= "000110010000011";
when 1968 => note <= "001111001101111";
when 1969 => note <= "010111110011011";
when 1970 => note <= "011101110110110";
when 1971 => note <= "011111110011011";
when 1972 => note <= "011101000100110";
when 1973 => note <= "010110010000011";
when 1974 => note <= "001100111100011";
when 1975 => note <= "000011010100001";
when 1976 => note <= "111011100011001";
when 1977 => note <= "110111010000111";
when 1978 => note <= "110111000101101";
when 1979 => note <= "111010100000010";
when 1980 => note <= "000000000000000";
when 1981 => note <= "000101011111110";
when 1982 => note <= "001000111010011";
when 1983 => note <= "001000101111001";
when 1984 => note <= "000100011100111";
when 1985 => note <= "111100101011111";
when 1986 => note <= "110011000011101";
when 1987 => note <= "101001101111101";
when 1988 => note <= "100010111011010";
when 1989 => note <= "100000001100101";
when 1990 => note <= "100010001001010";
when 1991 => note <= "101000001100101";
when 1992 => note <= "110000110010001";
when 1993 => note <= "111001101111101";
when 1994 => note <= "000000111010011";
when 1995 => note <= "000100101011111";
when 1996 => note <= "000100011100111";
when 1997 => note <= "000000101111001";
when 1998 => note <= "111011000011101";
when 1999 => note <= "110101011111110";
when 2000 => note <= "110010001001010";
when 2001 => note <= "110010100000010";
when 2002 => note <= "110111000101101";
when 2003 => note <= "111111010000111";
when 2004 => note <= "001001011001111";
when 2005 => note <= "010011010100001";
when 2006 => note <= "011010110011010";
when 2007 => note <= "011110010000011";
when 2008 => note <= "011101000100110";
when 2009 => note <= "010111110011011";
when 2010 => note <= "010000000000000";
when 2011 => note <= "000111110011011";
when 2012 => note <= "000001010111001";
when 2013 => note <= "111110010000011";
when 2014 => note <= "111111000101101";
when 2015 => note <= "000011010100001";
when 2016 => note <= "001001011001111";
when 2017 => note <= "001111010000111";
when 2018 => note <= "010010110011010";
when 2019 => note <= "010010100000010";
when 2020 => note <= "001101110110110";
when 2021 => note <= "000101011111110";
when 2022 => note <= "111011000011101";
when 2023 => note <= "110000101111001";
when 2024 => note <= "101000101111010";
when 2025 => note <= "100100101011111";
when 2026 => note <= "100101001100110";
when 2027 => note <= "101001101111101";
when 2028 => note <= "110000110010001";
when 2029 => note <= "111000001100101";
when 2030 => note <= "111101110110110";
when 2031 => note <= "000000001100101";
when 2032 => note <= "111110101000111";
when 2033 => note <= "111001101111101";
when 2034 => note <= "110011000011101";
when 2035 => note <= "101100101011111";
when 2036 => note <= "101000101111010";
when 2037 => note <= "101000101111001";
when 2038 => note <= "101101001100110";
when 2039 => note <= "110101011111110";
when 2040 => note <= "000000000000000";
when 2041 => note <= "001010100000010";
when 2042 => note <= "010010110011010";
when 2043 => note <= "010111010000111";
when 2044 => note <= "010111010000110";
when 2045 => note <= "010011010100001";
when 2046 => note <= "001100111100011";
when 2047 => note <= "000110010000011";
when 2048 => note <= "000001010111001";
when 2049 => note <= "111111110011011";
when 2050 => note <= "000010001001010";
when 2051 => note <= "000111110011011";
when 2052 => note <= "001111001101111";
when 2053 => note <= "010110010000011";
when 2054 => note <= "011010110011010";
when 2055 => note <= "011011010100001";
when 2056 => note <= "010111010000110";
when 2057 => note <= "001111010000111";
when 2058 => note <= "000100111100011";
when 2059 => note <= "111010100000010";
when 2060 => note <= "110010001001010";
when 2061 => note <= "101101011111110";
when 2062 => note <= "101101001100110";
when 2063 => note <= "110000101111001";
when 2064 => note <= "110110100110001";
when 2065 => note <= "111100101011111";
when 2066 => note <= "000000111010011";
when 2067 => note <= "000001101111101";
when 2068 => note <= "111110101000111";
when 2069 => note <= "111000001100101";
when 2070 => note <= "110000000000000";
when 2071 => note <= "101000001100101";
when 2072 => note <= "100010111011010";
when 2073 => note <= "100001101111101";
when 2074 => note <= "100101001100110";
when 2075 => note <= "101100101011111";
when 2076 => note <= "110110100110001";
when 2077 => note <= "000000101111001";
when 2078 => note <= "001000111010011";
when 2079 => note <= "001101011111110";
when 2080 => note <= "001101110110110";
when 2081 => note <= "001010100000010";
when 2082 => note <= "000100111100011";
when 2083 => note <= "111111010000111";
when 2084 => note <= "111011100011001";
when 2085 => note <= "111011010100001";
when 2086 => note <= "111111000101101";
when 2087 => note <= "000110010000011";
when 2088 => note <= "001111001101111";
when 2089 => note <= "010111110011011";
when 2090 => note <= "011101110110110";
when 2091 => note <= "011111110011011";
when 2092 => note <= "011101000100110";
when 2093 => note <= "010110010000011";
when 2094 => note <= "001100111100011";
when 2095 => note <= "000011010100001";
when 2096 => note <= "111011100011001";
when 2097 => note <= "110111010000111";
when 2098 => note <= "110111000101101";
when 2099 => note <= "111010100000010";
when 2100 => note <= "000000000000000";
when 2101 => note <= "000101011111110";
when 2102 => note <= "001000111010011";
when 2103 => note <= "001000101111001";
when 2104 => note <= "000100011100111";
when 2105 => note <= "111100101011111";
when 2106 => note <= "110011000011101";
when 2107 => note <= "101001101111101";
when 2108 => note <= "100010111011010";
when 2109 => note <= "100000001100101";
when 2110 => note <= "100010001001010";
when 2111 => note <= "101000001100101";
when 2112 => note <= "110000110010001";
when 2113 => note <= "111001101111101";
when 2114 => note <= "000000111010011";
when 2115 => note <= "000100101011111";
when 2116 => note <= "000100011100111";
when 2117 => note <= "000000101111001";
when 2118 => note <= "111011000011101";
when 2119 => note <= "110101011111110";
when 2120 => note <= "110010001001010";
when 2121 => note <= "110010100000010";
when 2122 => note <= "110111000101101";
when 2123 => note <= "111111010000111";
when 2124 => note <= "001001011001111";
when 2125 => note <= "010011010100001";
when 2126 => note <= "011010110011010";
when 2127 => note <= "011110010000011";
when 2128 => note <= "011101000100110";
when 2129 => note <= "010111110011011";
when 2130 => note <= "010000000000000";
when 2131 => note <= "000111110011011";
when 2132 => note <= "000001010111001";
when 2133 => note <= "111110010000011";
when 2134 => note <= "111111000101101";
when 2135 => note <= "000011010100001";
when 2136 => note <= "001001011001111";
when 2137 => note <= "001111010000111";
when 2138 => note <= "010010110011010";
when 2139 => note <= "010010100000010";
when 2140 => note <= "001101110110110";
when 2141 => note <= "000101011111110";
when 2142 => note <= "111011000011101";
when 2143 => note <= "110000101111001";
when 2144 => note <= "101000101111010";
when 2145 => note <= "100100101011111";
when 2146 => note <= "100101001100110";
when 2147 => note <= "101001101111101";
when 2148 => note <= "110000110010001";
when 2149 => note <= "111000001100101";
when 2150 => note <= "111101110110110";
when 2151 => note <= "000000001100101";
when 2152 => note <= "111110101000111";
when 2153 => note <= "111001101111101";
when 2154 => note <= "110011000011101";
when 2155 => note <= "101100101011111";
when 2156 => note <= "101000101111010";
when 2157 => note <= "101000101111001";
when 2158 => note <= "101101001100110";
when 2159 => note <= "110101011111110";
when 2160 => note <= "000000000000000";
when 2161 => note <= "001010100000010";
when 2162 => note <= "010010110011010";
when 2163 => note <= "010111010000111";
when 2164 => note <= "010111010000110";
when 2165 => note <= "010011010100001";
when 2166 => note <= "001100111100011";
when 2167 => note <= "000110010000011";
when 2168 => note <= "000001010111001";
when 2169 => note <= "111111110011011";
when 2170 => note <= "000010001001010";
when 2171 => note <= "000111110011011";
when 2172 => note <= "001111001101111";
when 2173 => note <= "010110010000011";
when 2174 => note <= "011010110011010";
when 2175 => note <= "011011010100001";
when 2176 => note <= "010111010000110";
when 2177 => note <= "001111010000111";
when 2178 => note <= "000100111100011";
when 2179 => note <= "111010100000010";
when 2180 => note <= "110010001001010";
when 2181 => note <= "101101011111110";
when 2182 => note <= "101101001100110";
when 2183 => note <= "110000101111001";
when 2184 => note <= "110110100110001";
when 2185 => note <= "111100101011111";
when 2186 => note <= "000000111010011";
when 2187 => note <= "000001101111101";
when 2188 => note <= "111110101000111";
when 2189 => note <= "111000001100101";
when 2190 => note <= "110000000000000";
when 2191 => note <= "101000001100101";
when 2192 => note <= "100010111011010";
when 2193 => note <= "100001101111101";
when 2194 => note <= "100101001100110";
when 2195 => note <= "101100101011111";
when 2196 => note <= "110110100110001";
when 2197 => note <= "000000101111001";
when 2198 => note <= "001000111010011";
when 2199 => note <= "001101011111110";
when 2200 => note <= "001101110110110";
when 2201 => note <= "001010100000010";
when 2202 => note <= "000100111100011";
when 2203 => note <= "111111010000111";
when 2204 => note <= "111011100011001";
when 2205 => note <= "111011010100001";
when 2206 => note <= "111111000101101";
when 2207 => note <= "000110010000011";
when 2208 => note <= "001111001101111";
when 2209 => note <= "010111110011011";
when 2210 => note <= "011101110110110";
when 2211 => note <= "011111110011011";
when 2212 => note <= "011101000100110";
when 2213 => note <= "010110010000011";
when 2214 => note <= "001100111100011";
when 2215 => note <= "000011010100001";
when 2216 => note <= "111011100011001";
when 2217 => note <= "110111010000111";
when 2218 => note <= "110111000101101";
when 2219 => note <= "111010100000010";
when 2220 => note <= "000000000000000";
when 2221 => note <= "000101011111110";
when 2222 => note <= "001000111010011";
when 2223 => note <= "001000101111001";
when 2224 => note <= "000100011100111";
when 2225 => note <= "111100101011111";
when 2226 => note <= "110011000011101";
when 2227 => note <= "101001101111101";
when 2228 => note <= "100010111011010";
when 2229 => note <= "100000001100101";
when 2230 => note <= "100010001001010";
when 2231 => note <= "101000001100101";
when 2232 => note <= "110000110010001";
when 2233 => note <= "111001101111101";
when 2234 => note <= "000000111010011";
when 2235 => note <= "000100101011111";
when 2236 => note <= "000100011100111";
when 2237 => note <= "000000101111001";
when 2238 => note <= "111011000011101";
when 2239 => note <= "110101011111110";
when 2240 => note <= "110010001001010";
when 2241 => note <= "110010100000010";
when 2242 => note <= "110111000101101";
when 2243 => note <= "111111010000111";
when 2244 => note <= "001001011001111";
when 2245 => note <= "010011010100001";
when 2246 => note <= "011010110011010";
when 2247 => note <= "011110010000011";
when 2248 => note <= "011101000100110";
when 2249 => note <= "010111110011011";
when 2250 => note <= "010000000000000";
when 2251 => note <= "000111110011011";
when 2252 => note <= "000001010111001";
when 2253 => note <= "111110010000011";
when 2254 => note <= "111111000101101";
when 2255 => note <= "000011010100001";
when 2256 => note <= "001001011001111";
when 2257 => note <= "001111010000111";
when 2258 => note <= "010010110011010";
when 2259 => note <= "010010100000010";
when 2260 => note <= "001101110110110";
when 2261 => note <= "000101011111110";
when 2262 => note <= "111011000011101";
when 2263 => note <= "110000101111001";
when 2264 => note <= "101000101111010";
when 2265 => note <= "100100101011111";
when 2266 => note <= "100101001100110";
when 2267 => note <= "101001101111101";
when 2268 => note <= "110000110010001";
when 2269 => note <= "111000001100101";
when 2270 => note <= "111101110110110";
when 2271 => note <= "000000001100101";
when 2272 => note <= "111110101000111";
when 2273 => note <= "111001101111101";
when 2274 => note <= "110011000011101";
when 2275 => note <= "101100101011111";
when 2276 => note <= "101000101111010";
when 2277 => note <= "101000101111001";
when 2278 => note <= "101101001100110";
when 2279 => note <= "110101011111110";
when 2280 => note <= "000000000000000";
when 2281 => note <= "001010100000010";
when 2282 => note <= "010010110011010";
when 2283 => note <= "010111010000111";
when 2284 => note <= "010111010000110";
when 2285 => note <= "010011010100001";
when 2286 => note <= "001100111100011";
when 2287 => note <= "000110010000011";
when 2288 => note <= "000001010111001";
when 2289 => note <= "111111110011011";
when 2290 => note <= "000010001001010";
when 2291 => note <= "000111110011011";
when 2292 => note <= "001111001101111";
when 2293 => note <= "010110010000011";
when 2294 => note <= "011010110011010";
when 2295 => note <= "011011010100001";
when 2296 => note <= "010111010000110";
when 2297 => note <= "001111010000111";
when 2298 => note <= "000100111100011";
when 2299 => note <= "111010100000010";
when 2300 => note <= "110010001001010";
when 2301 => note <= "101101011111110";
when 2302 => note <= "101101001100110";
when 2303 => note <= "110000101111001";
when 2304 => note <= "110110100110001";
when 2305 => note <= "111100101011111";
when 2306 => note <= "000000111010011";
when 2307 => note <= "000001101111101";
when 2308 => note <= "111110101000111";
when 2309 => note <= "111000001100101";
when 2310 => note <= "110000000000000";
when 2311 => note <= "101000001100101";
when 2312 => note <= "100010111011010";
when 2313 => note <= "100001101111101";
when 2314 => note <= "100101001100110";
when 2315 => note <= "101100101011111";
when 2316 => note <= "110110100110001";
when 2317 => note <= "000000101111001";
when 2318 => note <= "001000111010011";
when 2319 => note <= "001101011111110";
when 2320 => note <= "001101110110110";
when 2321 => note <= "001010100000010";
when 2322 => note <= "000100111100011";
when 2323 => note <= "111111010000111";
when 2324 => note <= "111011100011001";
when 2325 => note <= "111011010100001";
when 2326 => note <= "111111000101101";
when 2327 => note <= "000110010000011";
when 2328 => note <= "001111001101111";
when 2329 => note <= "010111110011011";
when 2330 => note <= "011101110110110";
when 2331 => note <= "011111110011011";
when 2332 => note <= "011101000100110";
when 2333 => note <= "010110010000011";
when 2334 => note <= "001100111100011";
when 2335 => note <= "000011010100001";
when 2336 => note <= "111011100011001";
when 2337 => note <= "110111010000111";
when 2338 => note <= "110111000101101";
when 2339 => note <= "111010100000010";
when 2340 => note <= "000000000000000";
when 2341 => note <= "000101011111110";
when 2342 => note <= "001000111010011";
when 2343 => note <= "001000101111001";
when 2344 => note <= "000100011100111";
when 2345 => note <= "111100101011111";
when 2346 => note <= "110011000011101";
when 2347 => note <= "101001101111101";
when 2348 => note <= "100010111011010";
when 2349 => note <= "100000001100101";
when 2350 => note <= "100010001001010";
when 2351 => note <= "101000001100101";
when 2352 => note <= "110000110010001";
when 2353 => note <= "111001101111101";
when 2354 => note <= "000000111010011";
when 2355 => note <= "000100101011111";
when 2356 => note <= "000100011100111";
when 2357 => note <= "000000101111001";
when 2358 => note <= "111011000011101";
when 2359 => note <= "110101011111110";
when 2360 => note <= "110010001001010";
when 2361 => note <= "110010100000010";
when 2362 => note <= "110111000101101";
when 2363 => note <= "111111010000111";
when 2364 => note <= "001001011001111";
when 2365 => note <= "010011010100001";
when 2366 => note <= "011010110011010";
when 2367 => note <= "011110010000011";
when 2368 => note <= "011101000100110";
when 2369 => note <= "010111110011011";
when 2370 => note <= "010000000000000";
when 2371 => note <= "000111110011011";
when 2372 => note <= "000001010111001";
when 2373 => note <= "111110010000011";
when 2374 => note <= "111111000101101";
when 2375 => note <= "000011010100001";
when 2376 => note <= "001001011001111";
when 2377 => note <= "001111010000111";
when 2378 => note <= "010010110011010";
when 2379 => note <= "010010100000010";
when 2380 => note <= "001101110110110";
when 2381 => note <= "000101011111110";
when 2382 => note <= "111011000011101";
when 2383 => note <= "110000101111001";
when 2384 => note <= "101000101111010";
when 2385 => note <= "100100101011111";
when 2386 => note <= "100101001100110";
when 2387 => note <= "101001101111101";
when 2388 => note <= "110000110010001";
when 2389 => note <= "111000001100101";
when 2390 => note <= "111101110110110";
when 2391 => note <= "000000001100101";
when 2392 => note <= "111110101000111";
when 2393 => note <= "111001101111101";
when 2394 => note <= "110011000011101";
when 2395 => note <= "101100101011111";
when 2396 => note <= "101000101111010";
when 2397 => note <= "101000101111001";
when 2398 => note <= "101101001100110";
when 2399 => note <= "110101011111110";
when 2400 => note <= "000000000000000";
when 2401 => note <= "001010100000010";
when 2402 => note <= "010010110011010";
when 2403 => note <= "010111010000111";
when 2404 => note <= "010111010000110";
when 2405 => note <= "010011010100001";
when 2406 => note <= "001100111100011";
when 2407 => note <= "000110010000011";
when 2408 => note <= "000001010111001";
when 2409 => note <= "111111110011011";
when 2410 => note <= "000010001001010";
when 2411 => note <= "000111110011011";
when 2412 => note <= "001111001101111";
when 2413 => note <= "010110010000011";
when 2414 => note <= "011010110011010";
when 2415 => note <= "011011010100001";
when 2416 => note <= "010111010000110";
when 2417 => note <= "001111010000111";
when 2418 => note <= "000100111100011";
when 2419 => note <= "111010100000010";
when 2420 => note <= "110010001001010";
when 2421 => note <= "101101011111110";
when 2422 => note <= "101101001100110";
when 2423 => note <= "110000101111001";
when 2424 => note <= "110110100110001";
when 2425 => note <= "111100101011111";
when 2426 => note <= "000000111010011";
when 2427 => note <= "000001101111101";
when 2428 => note <= "111110101000111";
when 2429 => note <= "111000001100101";
when 2430 => note <= "110000000000000";
when 2431 => note <= "101000001100101";
when 2432 => note <= "100010111011010";
when 2433 => note <= "100001101111101";
when 2434 => note <= "100101001100110";
when 2435 => note <= "101100101011111";
when 2436 => note <= "110110100110001";
when 2437 => note <= "000000101111001";
when 2438 => note <= "001000111010011";
when 2439 => note <= "001101011111110";
when 2440 => note <= "001101110110110";
when 2441 => note <= "001010100000010";
when 2442 => note <= "000100111100011";
when 2443 => note <= "111111010000111";
when 2444 => note <= "111011100011001";
when 2445 => note <= "111011010100001";
when 2446 => note <= "111111000101101";
when 2447 => note <= "000110010000011";
when 2448 => note <= "001111001101111";
when 2449 => note <= "010111110011011";
when 2450 => note <= "011101110110110";
when 2451 => note <= "011111110011011";
when 2452 => note <= "011101000100110";
when 2453 => note <= "010110010000011";
when 2454 => note <= "001100111100011";
when 2455 => note <= "000011010100001";
when 2456 => note <= "111011100011001";
when 2457 => note <= "110111010000111";
when 2458 => note <= "110111000101101";
when 2459 => note <= "111010100000010";
when 2460 => note <= "000000000000000";
when 2461 => note <= "000101011111110";
when 2462 => note <= "001000111010011";
when 2463 => note <= "001000101111001";
when 2464 => note <= "000100011100111";
when 2465 => note <= "111100101011111";
when 2466 => note <= "110011000011101";
when 2467 => note <= "101001101111101";
when 2468 => note <= "100010111011010";
when 2469 => note <= "100000001100101";
when 2470 => note <= "100010001001010";
when 2471 => note <= "101000001100101";
when 2472 => note <= "110000110010001";
when 2473 => note <= "111001101111101";
when 2474 => note <= "000000111010011";
when 2475 => note <= "000100101011111";
when 2476 => note <= "000100011100111";
when 2477 => note <= "000000101111001";
when 2478 => note <= "111011000011101";
when 2479 => note <= "110101011111110";
when 2480 => note <= "110010001001010";
when 2481 => note <= "110010100000010";
when 2482 => note <= "110111000101101";
when 2483 => note <= "111111010000111";
when 2484 => note <= "001001011001111";
when 2485 => note <= "010011010100001";
when 2486 => note <= "011010110011010";
when 2487 => note <= "011110010000011";
when 2488 => note <= "011101000100110";
when 2489 => note <= "010111110011011";
when 2490 => note <= "010000000000000";
when 2491 => note <= "000111110011011";
when 2492 => note <= "000001010111001";
when 2493 => note <= "111110010000011";
when 2494 => note <= "111111000101101";
when 2495 => note <= "000011010100001";
when 2496 => note <= "001001011001111";
when 2497 => note <= "001111010000111";
when 2498 => note <= "010010110011010";
when 2499 => note <= "010010100000010";
when 2500 => note <= "001101110110110";
when 2501 => note <= "000101011111110";
when 2502 => note <= "111011000011101";
when 2503 => note <= "110000101111001";
when 2504 => note <= "101000101111010";
when 2505 => note <= "100100101011111";
when 2506 => note <= "100101001100110";
when 2507 => note <= "101001101111101";
when 2508 => note <= "110000110010001";
when 2509 => note <= "111000001100101";
when 2510 => note <= "111101110110110";
when 2511 => note <= "000000001100101";
when 2512 => note <= "111110101000111";
when 2513 => note <= "111001101111101";
when 2514 => note <= "110011000011101";
when 2515 => note <= "101100101011111";
when 2516 => note <= "101000101111010";
when 2517 => note <= "101000101111001";
when 2518 => note <= "101101001100110";
when 2519 => note <= "110101011111110";
when 2520 => note <= "000000000000000";
when 2521 => note <= "001010100000010";
when 2522 => note <= "010010110011010";
when 2523 => note <= "010111010000111";
when 2524 => note <= "010111010000110";
when 2525 => note <= "010011010100001";
when 2526 => note <= "001100111100011";
when 2527 => note <= "000110010000011";
when 2528 => note <= "000001010111001";
when 2529 => note <= "111111110011011";
when 2530 => note <= "000010001001010";
when 2531 => note <= "000111110011011";
when 2532 => note <= "001111001101111";
when 2533 => note <= "010110010000011";
when 2534 => note <= "011010110011010";
when 2535 => note <= "011011010100001";
when 2536 => note <= "010111010000110";
when 2537 => note <= "001111010000111";
when 2538 => note <= "000100111100011";
when 2539 => note <= "111010100000010";
when 2540 => note <= "110010001001010";
when 2541 => note <= "101101011111110";
when 2542 => note <= "101101001100110";
when 2543 => note <= "110000101111001";
when 2544 => note <= "110110100110001";
when 2545 => note <= "111100101011111";
when 2546 => note <= "000000111010011";
when 2547 => note <= "000001101111101";
when 2548 => note <= "111110101000111";
when 2549 => note <= "111000001100101";
when 2550 => note <= "110000000000000";
when 2551 => note <= "101000001100101";
when 2552 => note <= "100010111011010";
when 2553 => note <= "100001101111101";
when 2554 => note <= "100101001100110";
when 2555 => note <= "101100101011111";
when 2556 => note <= "110110100110001";
when 2557 => note <= "000000101111001";
when 2558 => note <= "001000111010011";
when 2559 => note <= "001101011111110";
when 2560 => note <= "001101110110110";
when 2561 => note <= "001010100000010";
when 2562 => note <= "000100111100011";
when 2563 => note <= "111111010000111";
when 2564 => note <= "111011100011001";
when 2565 => note <= "111011010100001";
when 2566 => note <= "111111000101101";
when 2567 => note <= "000110010000011";
when 2568 => note <= "001111001101111";
when 2569 => note <= "010111110011011";
when 2570 => note <= "011101110110110";
when 2571 => note <= "011111110011011";
when 2572 => note <= "011101000100110";
when 2573 => note <= "010110010000011";
when 2574 => note <= "001100111100011";
when 2575 => note <= "000011010100001";
when 2576 => note <= "111011100011001";
when 2577 => note <= "110111010000111";
when 2578 => note <= "110111000101101";
when 2579 => note <= "111010100000010";
when 2580 => note <= "000000000000000";
when 2581 => note <= "000101011111110";
when 2582 => note <= "001000111010011";
when 2583 => note <= "001000101111001";
when 2584 => note <= "000100011100111";
when 2585 => note <= "111100101011111";
when 2586 => note <= "110011000011101";
when 2587 => note <= "101001101111101";
when 2588 => note <= "100010111011010";
when 2589 => note <= "100000001100101";
when 2590 => note <= "100010001001010";
when 2591 => note <= "101000001100101";
when 2592 => note <= "110000110010001";
when 2593 => note <= "111001101111101";
when 2594 => note <= "000000111010011";
when 2595 => note <= "000100101011111";
when 2596 => note <= "000100011100111";
when 2597 => note <= "000000101111001";
when 2598 => note <= "111011000011101";
when 2599 => note <= "110101011111110";
when 2600 => note <= "110010001001010";
when 2601 => note <= "110010100000010";
when 2602 => note <= "110111000101101";
when 2603 => note <= "111111010000111";
when 2604 => note <= "001001011001111";
when 2605 => note <= "010011010100001";
when 2606 => note <= "011010110011010";
when 2607 => note <= "011110010000011";
when 2608 => note <= "011101000100110";
when 2609 => note <= "010111110011011";
when 2610 => note <= "010000000000000";
when 2611 => note <= "000111110011011";
when 2612 => note <= "000001010111001";
when 2613 => note <= "111110010000011";
when 2614 => note <= "111111000101101";
when 2615 => note <= "000011010100001";
when 2616 => note <= "001001011001111";
when 2617 => note <= "001111010000111";
when 2618 => note <= "010010110011010";
when 2619 => note <= "010010100000010";
when 2620 => note <= "001101110110110";
when 2621 => note <= "000101011111110";
when 2622 => note <= "111011000011101";
when 2623 => note <= "110000101111001";
when 2624 => note <= "101000101111010";
when 2625 => note <= "100100101011111";
when 2626 => note <= "100101001100110";
when 2627 => note <= "101001101111101";
when 2628 => note <= "110000110010001";
when 2629 => note <= "111000001100101";
when 2630 => note <= "111101110110110";
when 2631 => note <= "000000001100101";
when 2632 => note <= "111110101000111";
when 2633 => note <= "111001101111101";
when 2634 => note <= "110011000011101";
when 2635 => note <= "101100101011111";
when 2636 => note <= "101000101111010";
when 2637 => note <= "101000101111001";
when 2638 => note <= "101101001100110";
when 2639 => note <= "110101011111110";
when 2640 => note <= "000000000000000";
when 2641 => note <= "001010100000010";
when 2642 => note <= "010010110011010";
when 2643 => note <= "010111010000111";
when 2644 => note <= "010111010000110";
when 2645 => note <= "010011010100001";
when 2646 => note <= "001100111100011";
when 2647 => note <= "000110010000011";
when 2648 => note <= "000001010111001";
when 2649 => note <= "111111110011011";
when 2650 => note <= "000010001001010";
when 2651 => note <= "000111110011011";
when 2652 => note <= "001111001101111";
when 2653 => note <= "010110010000011";
when 2654 => note <= "011010110011010";
when 2655 => note <= "011011010100001";
when 2656 => note <= "010111010000110";
when 2657 => note <= "001111010000111";
when 2658 => note <= "000100111100011";
when 2659 => note <= "111010100000010";
when 2660 => note <= "110010001001010";
when 2661 => note <= "101101011111110";
when 2662 => note <= "101101001100110";
when 2663 => note <= "110000101111001";
when 2664 => note <= "110110100110001";
when 2665 => note <= "111100101011111";
when 2666 => note <= "000000111010011";
when 2667 => note <= "000001101111101";
when 2668 => note <= "111110101000111";
when 2669 => note <= "111000001100101";
when 2670 => note <= "110000000000000";
when 2671 => note <= "101000001100101";
when 2672 => note <= "100010111011010";
when 2673 => note <= "100001101111101";
when 2674 => note <= "100101001100110";
when 2675 => note <= "101100101011111";
when 2676 => note <= "110110100110001";
when 2677 => note <= "000000101111001";
when 2678 => note <= "001000111010011";
when 2679 => note <= "001101011111110";
when 2680 => note <= "001101110110110";
when 2681 => note <= "001010100000010";
when 2682 => note <= "000100111100011";
when 2683 => note <= "111111010000111";
when 2684 => note <= "111011100011001";
when 2685 => note <= "111011010100001";
when 2686 => note <= "111111000101101";
when 2687 => note <= "000110010000011";
when 2688 => note <= "001111001101111";
when 2689 => note <= "010111110011011";
when 2690 => note <= "011101110110110";
when 2691 => note <= "011111110011011";
when 2692 => note <= "011101000100110";
when 2693 => note <= "010110010000011";
when 2694 => note <= "001100111100011";
when 2695 => note <= "000011010100001";
when 2696 => note <= "111011100011001";
when 2697 => note <= "110111010000111";
when 2698 => note <= "110111000101101";
when 2699 => note <= "111010100000010";
when 2700 => note <= "000000000000000";
when 2701 => note <= "000101011111110";
when 2702 => note <= "001000111010011";
when 2703 => note <= "001000101111001";
when 2704 => note <= "000100011100111";
when 2705 => note <= "111100101011111";
when 2706 => note <= "110011000011101";
when 2707 => note <= "101001101111101";
when 2708 => note <= "100010111011010";
when 2709 => note <= "100000001100101";
when 2710 => note <= "100010001001010";
when 2711 => note <= "101000001100101";
when 2712 => note <= "110000110010001";
when 2713 => note <= "111001101111101";
when 2714 => note <= "000000111010011";
when 2715 => note <= "000100101011111";
when 2716 => note <= "000100011100111";
when 2717 => note <= "000000101111001";
when 2718 => note <= "111011000011101";
when 2719 => note <= "110101011111110";
when 2720 => note <= "110010001001010";
when 2721 => note <= "110010100000010";
when 2722 => note <= "110111000101101";
when 2723 => note <= "111111010000111";
when 2724 => note <= "001001011001111";
when 2725 => note <= "010011010100001";
when 2726 => note <= "011010110011010";
when 2727 => note <= "011110010000011";
when 2728 => note <= "011101000100110";
when 2729 => note <= "010111110011011";
when 2730 => note <= "010000000000000";
when 2731 => note <= "000111110011011";
when 2732 => note <= "000001010111001";
when 2733 => note <= "111110010000011";
when 2734 => note <= "111111000101101";
when 2735 => note <= "000011010100001";
when 2736 => note <= "001001011001111";
when 2737 => note <= "001111010000111";
when 2738 => note <= "010010110011010";
when 2739 => note <= "010010100000010";
when 2740 => note <= "001101110110110";
when 2741 => note <= "000101011111110";
when 2742 => note <= "111011000011101";
when 2743 => note <= "110000101111001";
when 2744 => note <= "101000101111010";
when 2745 => note <= "100100101011111";
when 2746 => note <= "100101001100110";
when 2747 => note <= "101001101111101";
when 2748 => note <= "110000110010001";
when 2749 => note <= "111000001100101";
when 2750 => note <= "111101110110110";
when 2751 => note <= "000000001100101";
when 2752 => note <= "111110101000111";
when 2753 => note <= "111001101111101";
when 2754 => note <= "110011000011101";
when 2755 => note <= "101100101011111";
when 2756 => note <= "101000101111010";
when 2757 => note <= "101000101111001";
when 2758 => note <= "101101001100110";
when 2759 => note <= "110101011111110";
when 2760 => note <= "000000000000000";
when 2761 => note <= "001010100000010";
when 2762 => note <= "010010110011010";
when 2763 => note <= "010111010000111";
when 2764 => note <= "010111010000110";
when 2765 => note <= "010011010100001";
when 2766 => note <= "001100111100011";
when 2767 => note <= "000110010000011";
when 2768 => note <= "000001010111001";
when 2769 => note <= "111111110011011";
when 2770 => note <= "000010001001010";
when 2771 => note <= "000111110011011";
when 2772 => note <= "001111001101111";
when 2773 => note <= "010110010000011";
when 2774 => note <= "011010110011010";
when 2775 => note <= "011011010100001";
when 2776 => note <= "010111010000110";
when 2777 => note <= "001111010000111";
when 2778 => note <= "000100111100011";
when 2779 => note <= "111010100000010";
when 2780 => note <= "110010001001010";
when 2781 => note <= "101101011111110";
when 2782 => note <= "101101001100110";
when 2783 => note <= "110000101111001";
when 2784 => note <= "110110100110001";
when 2785 => note <= "111100101011111";
when 2786 => note <= "000000111010011";
when 2787 => note <= "000001101111101";
when 2788 => note <= "111110101000111";
when 2789 => note <= "111000001100101";
when 2790 => note <= "110000000000000";
when 2791 => note <= "101000001100101";
when 2792 => note <= "100010111011010";
when 2793 => note <= "100001101111101";
when 2794 => note <= "100101001100110";
when 2795 => note <= "101100101011111";
when 2796 => note <= "110110100110001";
when 2797 => note <= "000000101111001";
when 2798 => note <= "001000111010011";
when 2799 => note <= "001101011111110";
when 2800 => note <= "001101110110110";
when 2801 => note <= "001010100000010";
when 2802 => note <= "000100111100011";
when 2803 => note <= "111111010000111";
when 2804 => note <= "111011100011001";
when 2805 => note <= "111011010100001";
when 2806 => note <= "111111000101101";
when 2807 => note <= "000110010000011";
when 2808 => note <= "001111001101111";
when 2809 => note <= "010111110011011";
when 2810 => note <= "011101110110110";
when 2811 => note <= "011111110011011";
when 2812 => note <= "011101000100110";
when 2813 => note <= "010110010000011";
when 2814 => note <= "001100111100011";
when 2815 => note <= "000011010100001";
when 2816 => note <= "111011100011001";
when 2817 => note <= "110111010000111";
when 2818 => note <= "110111000101101";
when 2819 => note <= "111010100000010";
when 2820 => note <= "000000000000000";
when 2821 => note <= "000101011111110";
when 2822 => note <= "001000111010011";
when 2823 => note <= "001000101111001";
when 2824 => note <= "000100011100111";
when 2825 => note <= "111100101011111";
when 2826 => note <= "110011000011101";
when 2827 => note <= "101001101111101";
when 2828 => note <= "100010111011010";
when 2829 => note <= "100000001100101";
when 2830 => note <= "100010001001010";
when 2831 => note <= "101000001100101";
when 2832 => note <= "110000110010001";
when 2833 => note <= "111001101111101";
when 2834 => note <= "000000111010011";
when 2835 => note <= "000100101011111";
when 2836 => note <= "000100011100111";
when 2837 => note <= "000000101111001";
when 2838 => note <= "111011000011101";
when 2839 => note <= "110101011111110";
when 2840 => note <= "110010001001010";
when 2841 => note <= "110010100000010";
when 2842 => note <= "110111000101101";
when 2843 => note <= "111111010000111";
when 2844 => note <= "001001011001111";
when 2845 => note <= "010011010100001";
when 2846 => note <= "011010110011010";
when 2847 => note <= "011110010000011";
when 2848 => note <= "011101000100110";
when 2849 => note <= "010111110011011";
when 2850 => note <= "010000000000000";
when 2851 => note <= "000111110011011";
when 2852 => note <= "000001010111001";
when 2853 => note <= "111110010000011";
when 2854 => note <= "111111000101101";
when 2855 => note <= "000011010100001";
when 2856 => note <= "001001011001111";
when 2857 => note <= "001111010000111";
when 2858 => note <= "010010110011010";
when 2859 => note <= "010010100000010";
when 2860 => note <= "001101110110110";
when 2861 => note <= "000101011111110";
when 2862 => note <= "111011000011101";
when 2863 => note <= "110000101111001";
when 2864 => note <= "101000101111010";
when 2865 => note <= "100100101011111";
when 2866 => note <= "100101001100110";
when 2867 => note <= "101001101111101";
when 2868 => note <= "110000110010001";
when 2869 => note <= "111000001100101";
when 2870 => note <= "111101110110110";
when 2871 => note <= "000000001100101";
when 2872 => note <= "111110101000111";
when 2873 => note <= "111001101111101";
when 2874 => note <= "110011000011101";
when 2875 => note <= "101100101011111";
when 2876 => note <= "101000101111010";
when 2877 => note <= "101000101111001";
when 2878 => note <= "101101001100110";
when 2879 => note <= "110101011111110";
when 2880 => note <= "000000000000000";
when 2881 => note <= "001010100000010";
when 2882 => note <= "010010110011010";
when 2883 => note <= "010111010000111";
when 2884 => note <= "010111010000110";
when 2885 => note <= "010011010100001";
when 2886 => note <= "001100111100011";
when 2887 => note <= "000110010000011";
when 2888 => note <= "000001010111001";
when 2889 => note <= "111111110011011";
when 2890 => note <= "000010001001010";
when 2891 => note <= "000111110011011";
when 2892 => note <= "001111001101111";
when 2893 => note <= "010110010000011";
when 2894 => note <= "011010110011010";
when 2895 => note <= "011011010100001";
when 2896 => note <= "010111010000110";
when 2897 => note <= "001111010000111";
when 2898 => note <= "000100111100011";
when 2899 => note <= "111010100000010";
when 2900 => note <= "110010001001010";
when 2901 => note <= "101101011111110";
when 2902 => note <= "101101001100110";
when 2903 => note <= "110000101111001";
when 2904 => note <= "110110100110001";
when 2905 => note <= "111100101011111";
when 2906 => note <= "000000111010011";
when 2907 => note <= "000001101111101";
when 2908 => note <= "111110101000111";
when 2909 => note <= "111000001100101";
when 2910 => note <= "110000000000000";
when 2911 => note <= "101000001100101";
when 2912 => note <= "100010111011010";
when 2913 => note <= "100001101111101";
when 2914 => note <= "100101001100110";
when 2915 => note <= "101100101011111";
when 2916 => note <= "110110100110001";
when 2917 => note <= "000000101111001";
when 2918 => note <= "001000111010011";
when 2919 => note <= "001101011111110";
when 2920 => note <= "001101110110110";
when 2921 => note <= "001010100000010";
when 2922 => note <= "000100111100011";
when 2923 => note <= "111111010000111";
when 2924 => note <= "111011100011001";
when 2925 => note <= "111011010100001";
when 2926 => note <= "111111000101101";
when 2927 => note <= "000110010000011";
when 2928 => note <= "001111001101111";
when 2929 => note <= "010111110011011";
when 2930 => note <= "011101110110110";
when 2931 => note <= "011111110011011";
when 2932 => note <= "011101000100110";
when 2933 => note <= "010110010000011";
when 2934 => note <= "001100111100011";
when 2935 => note <= "000011010100001";
when 2936 => note <= "111011100011001";
when 2937 => note <= "110111010000111";
when 2938 => note <= "110111000101101";
when 2939 => note <= "111010100000010";
when 2940 => note <= "000000000000000";
when 2941 => note <= "000101011111110";
when 2942 => note <= "001000111010011";
when 2943 => note <= "001000101111001";
when 2944 => note <= "000100011100111";
when 2945 => note <= "111100101011111";
when 2946 => note <= "110011000011101";
when 2947 => note <= "101001101111101";
when 2948 => note <= "100010111011010";
when 2949 => note <= "100000001100101";
when 2950 => note <= "100010001001010";
when 2951 => note <= "101000001100101";
when 2952 => note <= "110000110010001";
when 2953 => note <= "111001101111101";
when 2954 => note <= "000000111010011";
when 2955 => note <= "000100101011111";
when 2956 => note <= "000100011100111";
when 2957 => note <= "000000101111001";
when 2958 => note <= "111011000011101";
when 2959 => note <= "110101011111110";
when 2960 => note <= "110010001001010";
when 2961 => note <= "110010100000010";
when 2962 => note <= "110111000101101";
when 2963 => note <= "111111010000111";
when 2964 => note <= "001001011001111";
when 2965 => note <= "010011010100001";
when 2966 => note <= "011010110011010";
when 2967 => note <= "011110010000011";
when 2968 => note <= "011101000100110";
when 2969 => note <= "010111110011011";
when 2970 => note <= "010000000000000";
when 2971 => note <= "000111110011011";
when 2972 => note <= "000001010111001";
when 2973 => note <= "111110010000011";
when 2974 => note <= "111111000101101";
when 2975 => note <= "000011010100001";
when 2976 => note <= "001001011001111";
when 2977 => note <= "001111010000111";
when 2978 => note <= "010010110011010";
when 2979 => note <= "010010100000010";
when 2980 => note <= "001101110110110";
when 2981 => note <= "000101011111110";
when 2982 => note <= "111011000011101";
when 2983 => note <= "110000101111001";
when 2984 => note <= "101000101111010";
when 2985 => note <= "100100101011111";
when 2986 => note <= "100101001100110";
when 2987 => note <= "101001101111101";
when 2988 => note <= "110000110010001";
when 2989 => note <= "111000001100101";
when 2990 => note <= "111101110110110";
when 2991 => note <= "000000001100101";
when 2992 => note <= "111110101000111";
when 2993 => note <= "111001101111101";
when 2994 => note <= "110011000011101";
when 2995 => note <= "101100101011111";
when 2996 => note <= "101000101111010";
when 2997 => note <= "101000101111001";
when 2998 => note <= "101101001100110";
when 2999 => note <= "110101011111110";
when 3000 => note <= "000000000000000";
when 3001 => note <= "001010100000010";
when 3002 => note <= "010010110011010";
when 3003 => note <= "010111010000111";
when 3004 => note <= "010111010000110";
when 3005 => note <= "010011010100001";
when 3006 => note <= "001100111100011";
when 3007 => note <= "000110010000011";
when 3008 => note <= "000001010111001";
when 3009 => note <= "111111110011011";
when 3010 => note <= "000010001001010";
when 3011 => note <= "000111110011011";
when 3012 => note <= "001111001101111";
when 3013 => note <= "010110010000011";
when 3014 => note <= "011010110011010";
when 3015 => note <= "011011010100001";
when 3016 => note <= "010111010000110";
when 3017 => note <= "001111010000111";
when 3018 => note <= "000100111100011";
when 3019 => note <= "111010100000010";
when 3020 => note <= "110010001001010";
when 3021 => note <= "101101011111110";
when 3022 => note <= "101101001100110";
when 3023 => note <= "110000101111001";
when 3024 => note <= "110110100110001";
when 3025 => note <= "111100101011111";
when 3026 => note <= "000000111010011";
when 3027 => note <= "000001101111101";
when 3028 => note <= "111110101000111";
when 3029 => note <= "111000001100101";
when 3030 => note <= "110000000000000";
when 3031 => note <= "101000001100101";
when 3032 => note <= "100010111011010";
when 3033 => note <= "100001101111101";
when 3034 => note <= "100101001100110";
when 3035 => note <= "101100101011111";
when 3036 => note <= "110110100110001";
when 3037 => note <= "000000101111001";
when 3038 => note <= "001000111010011";
when 3039 => note <= "001101011111110";
when 3040 => note <= "001101110110110";
when 3041 => note <= "001010100000010";
when 3042 => note <= "000100111100011";
when 3043 => note <= "111111010000111";
when 3044 => note <= "111011100011001";
when 3045 => note <= "111011010100001";
when 3046 => note <= "111111000101101";
when 3047 => note <= "000110010000011";
when 3048 => note <= "001111001101111";
when 3049 => note <= "010111110011011";
when 3050 => note <= "011101110110110";
when 3051 => note <= "011111110011011";
when 3052 => note <= "011101000100110";
when 3053 => note <= "010110010000011";
when 3054 => note <= "001100111100011";
when 3055 => note <= "000011010100001";
when 3056 => note <= "111011100011001";
when 3057 => note <= "110111010000111";
when 3058 => note <= "110111000101101";
when 3059 => note <= "111010100000010";
when 3060 => note <= "000000000000000";
when 3061 => note <= "000101011111110";
when 3062 => note <= "001000111010011";
when 3063 => note <= "001000101111001";
when 3064 => note <= "000100011100111";
when 3065 => note <= "111100101011111";
when 3066 => note <= "110011000011101";
when 3067 => note <= "101001101111101";
when 3068 => note <= "100010111011010";
when 3069 => note <= "100000001100101";
when 3070 => note <= "100010001001010";
when 3071 => note <= "101000001100101";
when 3072 => note <= "110000110010001";
when 3073 => note <= "111001101111101";
when 3074 => note <= "000000111010011";
when 3075 => note <= "000100101011111";
when 3076 => note <= "000100011100111";
when 3077 => note <= "000000101111001";
when 3078 => note <= "111011000011101";
when 3079 => note <= "110101011111110";
when 3080 => note <= "110010001001010";
when 3081 => note <= "110010100000010";
when 3082 => note <= "110111000101101";
when 3083 => note <= "111111010000111";
when 3084 => note <= "001001011001111";
when 3085 => note <= "010011010100001";
when 3086 => note <= "011010110011010";
when 3087 => note <= "011110010000011";
when 3088 => note <= "011101000100110";
when 3089 => note <= "010111110011011";
when 3090 => note <= "010000000000000";
when 3091 => note <= "000111110011011";
when 3092 => note <= "000001010111001";
when 3093 => note <= "111110010000011";
when 3094 => note <= "111111000101101";
when 3095 => note <= "000011010100001";
when 3096 => note <= "001001011001111";
when 3097 => note <= "001111010000111";
when 3098 => note <= "010010110011010";
when 3099 => note <= "010010100000010";
when 3100 => note <= "001101110110110";
when 3101 => note <= "000101011111110";
when 3102 => note <= "111011000011101";
when 3103 => note <= "110000101111001";
when 3104 => note <= "101000101111010";
when 3105 => note <= "100100101011111";
when 3106 => note <= "100101001100110";
when 3107 => note <= "101001101111101";
when 3108 => note <= "110000110010001";
when 3109 => note <= "111000001100101";
when 3110 => note <= "111101110110110";
when 3111 => note <= "000000001100101";
when 3112 => note <= "111110101000111";
when 3113 => note <= "111001101111101";
when 3114 => note <= "110011000011101";
when 3115 => note <= "101100101011111";
when 3116 => note <= "101000101111010";
when 3117 => note <= "101000101111001";
when 3118 => note <= "101101001100110";
when 3119 => note <= "110101011111110";
when 3120 => note <= "000000000000000";
when 3121 => note <= "001010100000010";
when 3122 => note <= "010010110011010";
when 3123 => note <= "010111010000111";
when 3124 => note <= "010111010000110";
when 3125 => note <= "010011010100001";
when 3126 => note <= "001100111100011";
when 3127 => note <= "000110010000011";
when 3128 => note <= "000001010111001";
when 3129 => note <= "111111110011011";
when 3130 => note <= "000010001001010";
when 3131 => note <= "000111110011011";
when 3132 => note <= "001111001101111";
when 3133 => note <= "010110010000011";
when 3134 => note <= "011010110011010";
when 3135 => note <= "011011010100001";
when 3136 => note <= "010111010000110";
when 3137 => note <= "001111010000111";
when 3138 => note <= "000100111100011";
when 3139 => note <= "111010100000010";
when 3140 => note <= "110010001001010";
when 3141 => note <= "101101011111110";
when 3142 => note <= "101101001100110";
when 3143 => note <= "110000101111001";
when 3144 => note <= "110110100110001";
when 3145 => note <= "111100101011111";
when 3146 => note <= "000000111010011";
when 3147 => note <= "000001101111101";
when 3148 => note <= "111110101000111";
when 3149 => note <= "111000001100101";
when 3150 => note <= "110000000000000";
when 3151 => note <= "101000001100101";
when 3152 => note <= "100010111011010";
when 3153 => note <= "100001101111101";
when 3154 => note <= "100101001100110";
when 3155 => note <= "101100101011111";
when 3156 => note <= "110110100110001";
when 3157 => note <= "000000101111001";
when 3158 => note <= "001000111010011";
when 3159 => note <= "001101011111110";
when 3160 => note <= "001101110110110";
when 3161 => note <= "001010100000010";
when 3162 => note <= "000100111100011";
when 3163 => note <= "111111010000111";
when 3164 => note <= "111011100011001";
when 3165 => note <= "111011010100001";
when 3166 => note <= "111111000101101";
when 3167 => note <= "000110010000011";
when 3168 => note <= "001111001101111";
when 3169 => note <= "010111110011011";
when 3170 => note <= "011101110110110";
when 3171 => note <= "011111110011011";
when 3172 => note <= "011101000100110";
when 3173 => note <= "010110010000011";
when 3174 => note <= "001100111100011";
when 3175 => note <= "000011010100001";
when 3176 => note <= "111011100011001";
when 3177 => note <= "110111010000111";
when 3178 => note <= "110111000101101";
when 3179 => note <= "111010100000010";
when 3180 => note <= "000000000000000";
when 3181 => note <= "000101011111110";
when 3182 => note <= "001000111010011";
when 3183 => note <= "001000101111001";
when 3184 => note <= "000100011100111";
when 3185 => note <= "111100101011111";
when 3186 => note <= "110011000011101";
when 3187 => note <= "101001101111101";
when 3188 => note <= "100010111011010";
when 3189 => note <= "100000001100101";
when 3190 => note <= "100010001001010";
when 3191 => note <= "101000001100101";
when 3192 => note <= "110000110010001";
when 3193 => note <= "111001101111101";
when 3194 => note <= "000000111010011";
when 3195 => note <= "000100101011111";
when 3196 => note <= "000100011100111";
when 3197 => note <= "000000101111001";
when 3198 => note <= "111011000011101";
when 3199 => note <= "110101011111110";
when 3200 => note <= "110010001001010";
when 3201 => note <= "110010100000010";
when 3202 => note <= "110111000101101";
when 3203 => note <= "111111010000111";
when 3204 => note <= "001001011001111";
when 3205 => note <= "010011010100001";
when 3206 => note <= "011010110011010";
when 3207 => note <= "011110010000011";
when 3208 => note <= "011101000100110";
when 3209 => note <= "010111110011011";
when 3210 => note <= "010000000000000";
when 3211 => note <= "000111110011011";
when 3212 => note <= "000001010111001";
when 3213 => note <= "111110010000011";
when 3214 => note <= "111111000101101";
when 3215 => note <= "000011010100001";
when 3216 => note <= "001001011001111";
when 3217 => note <= "001111010000111";
when 3218 => note <= "010010110011010";
when 3219 => note <= "010010100000010";
when 3220 => note <= "001101110110110";
when 3221 => note <= "000101011111110";
when 3222 => note <= "111011000011101";
when 3223 => note <= "110000101111001";
when 3224 => note <= "101000101111010";
when 3225 => note <= "100100101011111";
when 3226 => note <= "100101001100110";
when 3227 => note <= "101001101111101";
when 3228 => note <= "110000110010001";
when 3229 => note <= "111000001100101";
when 3230 => note <= "111101110110110";
when 3231 => note <= "000000001100101";
when 3232 => note <= "111110101000111";
when 3233 => note <= "111001101111101";
when 3234 => note <= "110011000011101";
when 3235 => note <= "101100101011111";
when 3236 => note <= "101000101111010";
when 3237 => note <= "101000101111001";
when 3238 => note <= "101101001100110";
when 3239 => note <= "110101011111110";
when 3240 => note <= "000000000000000";
when 3241 => note <= "001010100000010";
when 3242 => note <= "010010110011010";
when 3243 => note <= "010111010000111";
when 3244 => note <= "010111010000110";
when 3245 => note <= "010011010100001";
when 3246 => note <= "001100111100011";
when 3247 => note <= "000110010000011";
when 3248 => note <= "000001010111001";
when 3249 => note <= "111111110011011";
when 3250 => note <= "000010001001010";
when 3251 => note <= "000111110011011";
when 3252 => note <= "001111001101111";
when 3253 => note <= "010110010000011";
when 3254 => note <= "011010110011010";
when 3255 => note <= "011011010100001";
when 3256 => note <= "010111010000110";
when 3257 => note <= "001111010000111";
when 3258 => note <= "000100111100011";
when 3259 => note <= "111010100000010";
when 3260 => note <= "110010001001010";
when 3261 => note <= "101101011111110";
when 3262 => note <= "101101001100110";
when 3263 => note <= "110000101111001";
when 3264 => note <= "110110100110001";
when 3265 => note <= "111100101011111";
when 3266 => note <= "000000111010011";
when 3267 => note <= "000001101111101";
when 3268 => note <= "111110101000111";
when 3269 => note <= "111000001100101";
when 3270 => note <= "110000000000000";
when 3271 => note <= "101000001100101";
when 3272 => note <= "100010111011010";
when 3273 => note <= "100001101111101";
when 3274 => note <= "100101001100110";
when 3275 => note <= "101100101011111";
when 3276 => note <= "110110100110001";
when 3277 => note <= "000000101111001";
when 3278 => note <= "001000111010011";
when 3279 => note <= "001101011111110";
when 3280 => note <= "001101110110110";
when 3281 => note <= "001010100000010";
when 3282 => note <= "000100111100011";
when 3283 => note <= "111111010000111";
when 3284 => note <= "111011100011001";
when 3285 => note <= "111011010100001";
when 3286 => note <= "111111000101101";
when 3287 => note <= "000110010000011";
when 3288 => note <= "001111001101111";
when 3289 => note <= "010111110011011";
when 3290 => note <= "011101110110110";
when 3291 => note <= "011111110011011";
when 3292 => note <= "011101000100110";
when 3293 => note <= "010110010000011";
when 3294 => note <= "001100111100011";
when 3295 => note <= "000011010100001";
when 3296 => note <= "111011100011001";
when 3297 => note <= "110111010000111";
when 3298 => note <= "110111000101101";
when 3299 => note <= "111010100000010";
when 3300 => note <= "000000000000000";
when 3301 => note <= "000101011111110";
when 3302 => note <= "001000111010011";
when 3303 => note <= "001000101111001";
when 3304 => note <= "000100011100111";
when 3305 => note <= "111100101011111";
when 3306 => note <= "110011000011101";
when 3307 => note <= "101001101111101";
when 3308 => note <= "100010111011010";
when 3309 => note <= "100000001100101";
when 3310 => note <= "100010001001010";
when 3311 => note <= "101000001100101";
when 3312 => note <= "110000110010001";
when 3313 => note <= "111001101111101";
when 3314 => note <= "000000111010011";
when 3315 => note <= "000100101011111";
when 3316 => note <= "000100011100111";
when 3317 => note <= "000000101111001";
when 3318 => note <= "111011000011101";
when 3319 => note <= "110101011111110";
when 3320 => note <= "110010001001010";
when 3321 => note <= "110010100000010";
when 3322 => note <= "110111000101101";
when 3323 => note <= "111111010000111";
when 3324 => note <= "001001011001111";
when 3325 => note <= "010011010100001";
when 3326 => note <= "011010110011010";
when 3327 => note <= "011110010000011";
when 3328 => note <= "011101000100110";
when 3329 => note <= "010111110011011";
when 3330 => note <= "010000000000000";
when 3331 => note <= "000111110011011";
when 3332 => note <= "000001010111001";
when 3333 => note <= "111110010000011";
when 3334 => note <= "111111000101101";
when 3335 => note <= "000011010100001";
when 3336 => note <= "001001011001111";
when 3337 => note <= "001111010000111";
when 3338 => note <= "010010110011010";
when 3339 => note <= "010010100000010";
when 3340 => note <= "001101110110110";
when 3341 => note <= "000101011111110";
when 3342 => note <= "111011000011101";
when 3343 => note <= "110000101111001";
when 3344 => note <= "101000101111010";
when 3345 => note <= "100100101011111";
when 3346 => note <= "100101001100110";
when 3347 => note <= "101001101111101";
when 3348 => note <= "110000110010001";
when 3349 => note <= "111000001100101";
when 3350 => note <= "111101110110110";
when 3351 => note <= "000000001100101";
when 3352 => note <= "111110101000111";
when 3353 => note <= "111001101111101";
when 3354 => note <= "110011000011101";
when 3355 => note <= "101100101011111";
when 3356 => note <= "101000101111010";
when 3357 => note <= "101000101111001";
when 3358 => note <= "101101001100110";
when 3359 => note <= "110101011111110";
when 3360 => note <= "000000000000000";
when 3361 => note <= "001010100000010";
when 3362 => note <= "010010110011010";
when 3363 => note <= "010111010000111";
when 3364 => note <= "010111010000110";
when 3365 => note <= "010011010100001";
when 3366 => note <= "001100111100011";
when 3367 => note <= "000110010000011";
when 3368 => note <= "000001010111001";
when 3369 => note <= "111111110011011";
when 3370 => note <= "000010001001010";
when 3371 => note <= "000111110011011";
when 3372 => note <= "001111001101111";
when 3373 => note <= "010110010000011";
when 3374 => note <= "011010110011010";
when 3375 => note <= "011011010100001";
when 3376 => note <= "010111010000110";
when 3377 => note <= "001111010000111";
when 3378 => note <= "000100111100011";
when 3379 => note <= "111010100000010";
when 3380 => note <= "110010001001010";
when 3381 => note <= "101101011111110";
when 3382 => note <= "101101001100110";
when 3383 => note <= "110000101111001";
when 3384 => note <= "110110100110001";
when 3385 => note <= "111100101011111";
when 3386 => note <= "000000111010011";
when 3387 => note <= "000001101111101";
when 3388 => note <= "111110101000111";
when 3389 => note <= "111000001100101";
when 3390 => note <= "110000000000000";
when 3391 => note <= "101000001100101";
when 3392 => note <= "100010111011010";
when 3393 => note <= "100001101111101";
when 3394 => note <= "100101001100110";
when 3395 => note <= "101100101011111";
when 3396 => note <= "110110100110001";
when 3397 => note <= "000000101111001";
when 3398 => note <= "001000111010011";
when 3399 => note <= "001101011111110";
when 3400 => note <= "001101110110110";
when 3401 => note <= "001010100000010";
when 3402 => note <= "000100111100011";
when 3403 => note <= "111111010000111";
when 3404 => note <= "111011100011001";
when 3405 => note <= "111011010100001";
when 3406 => note <= "111111000101101";
when 3407 => note <= "000110010000011";
when 3408 => note <= "001111001101111";
when 3409 => note <= "010111110011011";
when 3410 => note <= "011101110110110";
when 3411 => note <= "011111110011011";
when 3412 => note <= "011101000100110";
when 3413 => note <= "010110010000011";
when 3414 => note <= "001100111100011";
when 3415 => note <= "000011010100001";
when 3416 => note <= "111011100011001";
when 3417 => note <= "110111010000111";
when 3418 => note <= "110111000101101";
when 3419 => note <= "111010100000010";
when 3420 => note <= "000000000000000";
when 3421 => note <= "000101011111110";
when 3422 => note <= "001000111010011";
when 3423 => note <= "001000101111001";
when 3424 => note <= "000100011100111";
when 3425 => note <= "111100101011111";
when 3426 => note <= "110011000011101";
when 3427 => note <= "101001101111101";
when 3428 => note <= "100010111011010";
when 3429 => note <= "100000001100101";
when 3430 => note <= "100010001001010";
when 3431 => note <= "101000001100101";
when 3432 => note <= "110000110010001";
when 3433 => note <= "111001101111101";
when 3434 => note <= "000000111010011";
when 3435 => note <= "000100101011111";
when 3436 => note <= "000100011100111";
when 3437 => note <= "000000101111001";
when 3438 => note <= "111011000011101";
when 3439 => note <= "110101011111110";
when 3440 => note <= "110010001001010";
when 3441 => note <= "110010100000010";
when 3442 => note <= "110111000101101";
when 3443 => note <= "111111010000111";
when 3444 => note <= "001001011001111";
when 3445 => note <= "010011010100001";
when 3446 => note <= "011010110011010";
when 3447 => note <= "011110010000011";
when 3448 => note <= "011101000100110";
when 3449 => note <= "010111110011011";
when 3450 => note <= "010000000000000";
when 3451 => note <= "000111110011011";
when 3452 => note <= "000001010111001";
when 3453 => note <= "111110010000011";
when 3454 => note <= "111111000101101";
when 3455 => note <= "000011010100001";
when 3456 => note <= "001001011001111";
when 3457 => note <= "001111010000111";
when 3458 => note <= "010010110011010";
when 3459 => note <= "010010100000010";
when 3460 => note <= "001101110110110";
when 3461 => note <= "000101011111110";
when 3462 => note <= "111011000011101";
when 3463 => note <= "110000101111001";
when 3464 => note <= "101000101111010";
when 3465 => note <= "100100101011111";
when 3466 => note <= "100101001100110";
when 3467 => note <= "101001101111101";
when 3468 => note <= "110000110010001";
when 3469 => note <= "111000001100101";
when 3470 => note <= "111101110110110";
when 3471 => note <= "000000001100101";
when 3472 => note <= "111110101000111";
when 3473 => note <= "111001101111101";
when 3474 => note <= "110011000011101";
when 3475 => note <= "101100101011111";
when 3476 => note <= "101000101111010";
when 3477 => note <= "101000101111001";
when 3478 => note <= "101101001100110";
when 3479 => note <= "110101011111110";
when 3480 => note <= "000000000000000";
when 3481 => note <= "001010100000010";
when 3482 => note <= "010010110011010";
when 3483 => note <= "010111010000111";
when 3484 => note <= "010111010000110";
when 3485 => note <= "010011010100001";
when 3486 => note <= "001100111100011";
when 3487 => note <= "000110010000011";
when 3488 => note <= "000001010111001";
when 3489 => note <= "111111110011011";
when 3490 => note <= "000010001001010";
when 3491 => note <= "000111110011011";
when 3492 => note <= "001111001101111";
when 3493 => note <= "010110010000011";
when 3494 => note <= "011010110011010";
when 3495 => note <= "011011010100001";
when 3496 => note <= "010111010000110";
when 3497 => note <= "001111010000111";
when 3498 => note <= "000100111100011";
when 3499 => note <= "111010100000010";
when 3500 => note <= "110010001001010";
when 3501 => note <= "101101011111110";
when 3502 => note <= "101101001100110";
when 3503 => note <= "110000101111001";
when 3504 => note <= "110110100110001";
when 3505 => note <= "111100101011111";
when 3506 => note <= "000000111010011";
when 3507 => note <= "000001101111101";
when 3508 => note <= "111110101000111";
when 3509 => note <= "111000001100101";
when 3510 => note <= "110000000000000";
when 3511 => note <= "101000001100101";
when 3512 => note <= "100010111011010";
when 3513 => note <= "100001101111101";
when 3514 => note <= "100101001100110";
when 3515 => note <= "101100101011111";
when 3516 => note <= "110110100110001";
when 3517 => note <= "000000101111001";
when 3518 => note <= "001000111010011";
when 3519 => note <= "001101011111110";
when 3520 => note <= "001101110110110";
when 3521 => note <= "001010100000010";
when 3522 => note <= "000100111100011";
when 3523 => note <= "111111010000111";
when 3524 => note <= "111011100011001";
when 3525 => note <= "111011010100001";
when 3526 => note <= "111111000101101";
when 3527 => note <= "000110010000011";
when 3528 => note <= "001111001101111";
when 3529 => note <= "010111110011011";
when 3530 => note <= "011101110110110";
when 3531 => note <= "011111110011011";
when 3532 => note <= "011101000100110";
when 3533 => note <= "010110010000011";
when 3534 => note <= "001100111100011";
when 3535 => note <= "000011010100001";
when 3536 => note <= "111011100011001";
when 3537 => note <= "110111010000111";
when 3538 => note <= "110111000101101";
when 3539 => note <= "111010100000010";
when 3540 => note <= "000000000000000";
when 3541 => note <= "000101011111110";
when 3542 => note <= "001000111010011";
when 3543 => note <= "001000101111001";
when 3544 => note <= "000100011100111";
when 3545 => note <= "111100101011111";
when 3546 => note <= "110011000011101";
when 3547 => note <= "101001101111101";
when 3548 => note <= "100010111011010";
when 3549 => note <= "100000001100101";
when 3550 => note <= "100010001001010";
when 3551 => note <= "101000001100101";
when 3552 => note <= "110000110010001";
when 3553 => note <= "111001101111101";
when 3554 => note <= "000000111010011";
when 3555 => note <= "000100101011111";
when 3556 => note <= "000100011100111";
when 3557 => note <= "000000101111001";
when 3558 => note <= "111011000011101";
when 3559 => note <= "110101011111110";
when 3560 => note <= "110010001001010";
when 3561 => note <= "110010100000010";
when 3562 => note <= "110111000101101";
when 3563 => note <= "111111010000111";
when 3564 => note <= "001001011001111";
when 3565 => note <= "010011010100001";
when 3566 => note <= "011010110011010";
when 3567 => note <= "011110010000011";
when 3568 => note <= "011101000100110";
when 3569 => note <= "010111110011011";
when 3570 => note <= "010000000000000";
when 3571 => note <= "000111110011011";
when 3572 => note <= "000001010111001";
when 3573 => note <= "111110010000011";
when 3574 => note <= "111111000101101";
when 3575 => note <= "000011010100001";
when 3576 => note <= "001001011001111";
when 3577 => note <= "001111010000111";
when 3578 => note <= "010010110011010";
when 3579 => note <= "010010100000010";
when 3580 => note <= "001101110110110";
when 3581 => note <= "000101011111110";
when 3582 => note <= "111011000011101";
when 3583 => note <= "110000101111001";
when 3584 => note <= "101000101111010";
when 3585 => note <= "100100101011111";
when 3586 => note <= "100101001100110";
when 3587 => note <= "101001101111101";
when 3588 => note <= "110000110010001";
when 3589 => note <= "111000001100101";
when 3590 => note <= "111101110110110";
when 3591 => note <= "000000001100101";
when 3592 => note <= "111110101000111";
when 3593 => note <= "111001101111101";
when 3594 => note <= "110011000011101";
when 3595 => note <= "101100101011111";
when 3596 => note <= "101000101111010";
when 3597 => note <= "101000101111001";
when 3598 => note <= "101101001100110";
when 3599 => note <= "110101011111110";
when 3600 => note <= "000000000000000";
when 3601 => note <= "001010100000010";
when 3602 => note <= "010010110011010";
when 3603 => note <= "010111010000111";
when 3604 => note <= "010111010000110";
when 3605 => note <= "010011010100001";
when 3606 => note <= "001100111100011";
when 3607 => note <= "000110010000011";
when 3608 => note <= "000001010111001";
when 3609 => note <= "111111110011011";
when 3610 => note <= "000010001001010";
when 3611 => note <= "000111110011011";
when 3612 => note <= "001111001101111";
when 3613 => note <= "010110010000011";
when 3614 => note <= "011010110011010";
when 3615 => note <= "011011010100001";
when 3616 => note <= "010111010000110";
when 3617 => note <= "001111010000111";
when 3618 => note <= "000100111100011";
when 3619 => note <= "111010100000010";
when 3620 => note <= "110010001001010";
when 3621 => note <= "101101011111110";
when 3622 => note <= "101101001100110";
when 3623 => note <= "110000101111001";
when 3624 => note <= "110110100110001";
when 3625 => note <= "111100101011111";
when 3626 => note <= "000000111010011";
when 3627 => note <= "000001101111101";
when 3628 => note <= "111110101000111";
when 3629 => note <= "111000001100101";
when 3630 => note <= "110000000000000";
when 3631 => note <= "101000001100101";
when 3632 => note <= "100010111011010";
when 3633 => note <= "100001101111101";
when 3634 => note <= "100101001100110";
when 3635 => note <= "101100101011111";
when 3636 => note <= "110110100110001";
when 3637 => note <= "000000101111001";
when 3638 => note <= "001000111010011";
when 3639 => note <= "001101011111110";
when 3640 => note <= "001101110110110";
when 3641 => note <= "001010100000010";
when 3642 => note <= "000100111100011";
when 3643 => note <= "111111010000111";
when 3644 => note <= "111011100011001";
when 3645 => note <= "111011010100001";
when 3646 => note <= "111111000101101";
when 3647 => note <= "000110010000011";
when 3648 => note <= "001111001101111";
when 3649 => note <= "010111110011011";
when 3650 => note <= "011101110110110";
when 3651 => note <= "011111110011011";
when 3652 => note <= "011101000100110";
when 3653 => note <= "010110010000011";
when 3654 => note <= "001100111100011";
when 3655 => note <= "000011010100001";
when 3656 => note <= "111011100011001";
when 3657 => note <= "110111010000111";
when 3658 => note <= "110111000101101";
when 3659 => note <= "111010100000010";
when 3660 => note <= "000000000000000";
when 3661 => note <= "000101011111110";
when 3662 => note <= "001000111010011";
when 3663 => note <= "001000101111001";
when 3664 => note <= "000100011100111";
when 3665 => note <= "111100101011111";
when 3666 => note <= "110011000011101";
when 3667 => note <= "101001101111101";
when 3668 => note <= "100010111011010";
when 3669 => note <= "100000001100101";
when 3670 => note <= "100010001001010";
when 3671 => note <= "101000001100101";
when 3672 => note <= "110000110010001";
when 3673 => note <= "111001101111101";
when 3674 => note <= "000000111010011";
when 3675 => note <= "000100101011111";
when 3676 => note <= "000100011100111";
when 3677 => note <= "000000101111001";
when 3678 => note <= "111011000011101";
when 3679 => note <= "110101011111110";
when 3680 => note <= "110010001001010";
when 3681 => note <= "110010100000010";
when 3682 => note <= "110111000101101";
when 3683 => note <= "111111010000111";
when 3684 => note <= "001001011001111";
when 3685 => note <= "010011010100001";
when 3686 => note <= "011010110011010";
when 3687 => note <= "011110010000011";
when 3688 => note <= "011101000100110";
when 3689 => note <= "010111110011011";
when 3690 => note <= "010000000000000";
when 3691 => note <= "000111110011011";
when 3692 => note <= "000001010111001";
when 3693 => note <= "111110010000011";
when 3694 => note <= "111111000101101";
when 3695 => note <= "000011010100001";
when 3696 => note <= "001001011001111";
when 3697 => note <= "001111010000111";
when 3698 => note <= "010010110011010";
when 3699 => note <= "010010100000010";
when 3700 => note <= "001101110110110";
when 3701 => note <= "000101011111110";
when 3702 => note <= "111011000011101";
when 3703 => note <= "110000101111001";
when 3704 => note <= "101000101111010";
when 3705 => note <= "100100101011111";
when 3706 => note <= "100101001100110";
when 3707 => note <= "101001101111101";
when 3708 => note <= "110000110010001";
when 3709 => note <= "111000001100101";
when 3710 => note <= "111101110110110";
when 3711 => note <= "000000001100101";
when 3712 => note <= "111110101000111";
when 3713 => note <= "111001101111101";
when 3714 => note <= "110011000011101";
when 3715 => note <= "101100101011111";
when 3716 => note <= "101000101111010";
when 3717 => note <= "101000101111001";
when 3718 => note <= "101101001100110";
when 3719 => note <= "110101011111110";
when 3720 => note <= "000000000000000";
when 3721 => note <= "001010100000010";
when 3722 => note <= "010010110011010";
when 3723 => note <= "010111010000111";
when 3724 => note <= "010111010000110";
when 3725 => note <= "010011010100001";
when 3726 => note <= "001100111100011";
when 3727 => note <= "000110010000011";
when 3728 => note <= "000001010111001";
when 3729 => note <= "111111110011011";
when 3730 => note <= "000010001001010";
when 3731 => note <= "000111110011011";
when 3732 => note <= "001111001101111";
when 3733 => note <= "010110010000011";
when 3734 => note <= "011010110011010";
when 3735 => note <= "011011010100001";
when 3736 => note <= "010111010000110";
when 3737 => note <= "001111010000111";
when 3738 => note <= "000100111100011";
when 3739 => note <= "111010100000010";
when 3740 => note <= "110010001001010";
when 3741 => note <= "101101011111110";
when 3742 => note <= "101101001100110";
when 3743 => note <= "110000101111001";
when 3744 => note <= "110110100110001";
when 3745 => note <= "111100101011111";
when 3746 => note <= "000000111010011";
when 3747 => note <= "000001101111101";
when 3748 => note <= "111110101000111";
when 3749 => note <= "111000001100101";
when 3750 => note <= "110000000000000";
when 3751 => note <= "101000001100101";
when 3752 => note <= "100010111011010";
when 3753 => note <= "100001101111101";
when 3754 => note <= "100101001100110";
when 3755 => note <= "101100101011111";
when 3756 => note <= "110110100110001";
when 3757 => note <= "000000101111001";
when 3758 => note <= "001000111010011";
when 3759 => note <= "001101011111110";
when 3760 => note <= "001101110110110";
when 3761 => note <= "001010100000010";
when 3762 => note <= "000100111100011";
when 3763 => note <= "111111010000111";
when 3764 => note <= "111011100011001";
when 3765 => note <= "111011010100001";
when 3766 => note <= "111111000101101";
when 3767 => note <= "000110010000011";
when 3768 => note <= "001111001101111";
when 3769 => note <= "010111110011011";
when 3770 => note <= "011101110110110";
when 3771 => note <= "011111110011011";
when 3772 => note <= "011101000100110";
when 3773 => note <= "010110010000011";
when 3774 => note <= "001100111100011";
when 3775 => note <= "000011010100001";
when 3776 => note <= "111011100011001";
when 3777 => note <= "110111010000111";
when 3778 => note <= "110111000101101";
when 3779 => note <= "111010100000010";
when 3780 => note <= "000000000000000";
when 3781 => note <= "000101011111110";
when 3782 => note <= "001000111010011";
when 3783 => note <= "001000101111001";
when 3784 => note <= "000100011100111";
when 3785 => note <= "111100101011111";
when 3786 => note <= "110011000011101";
when 3787 => note <= "101001101111101";
when 3788 => note <= "100010111011010";
when 3789 => note <= "100000001100101";
when 3790 => note <= "100010001001010";
when 3791 => note <= "101000001100101";
when 3792 => note <= "110000110010001";
when 3793 => note <= "111001101111101";
when 3794 => note <= "000000111010011";
when 3795 => note <= "000100101011111";
when 3796 => note <= "000100011100111";
when 3797 => note <= "000000101111001";
when 3798 => note <= "111011000011101";
when 3799 => note <= "110101011111110";
when 3800 => note <= "110010001001010";
when 3801 => note <= "110010100000010";
when 3802 => note <= "110111000101101";
when 3803 => note <= "111111010000111";
when 3804 => note <= "001001011001111";
when 3805 => note <= "010011010100001";
when 3806 => note <= "011010110011010";
when 3807 => note <= "011110010000011";
when 3808 => note <= "011101000100110";
when 3809 => note <= "010111110011011";
when 3810 => note <= "010000000000000";
when 3811 => note <= "000111110011011";
when 3812 => note <= "000001010111001";
when 3813 => note <= "111110010000011";
when 3814 => note <= "111111000101101";
when 3815 => note <= "000011010100001";
when 3816 => note <= "001001011001111";
when 3817 => note <= "001111010000111";
when 3818 => note <= "010010110011010";
when 3819 => note <= "010010100000010";
when 3820 => note <= "001101110110110";
when 3821 => note <= "000101011111110";
when 3822 => note <= "111011000011101";
when 3823 => note <= "110000101111001";
when 3824 => note <= "101000101111010";
when 3825 => note <= "100100101011111";
when 3826 => note <= "100101001100110";
when 3827 => note <= "101001101111101";
when 3828 => note <= "110000110010001";
when 3829 => note <= "111000001100101";
when 3830 => note <= "111101110110110";
when 3831 => note <= "000000001100101";
when 3832 => note <= "111110101000111";
when 3833 => note <= "111001101111101";
when 3834 => note <= "110011000011101";
when 3835 => note <= "101100101011111";
when 3836 => note <= "101000101111010";
when 3837 => note <= "101000101111001";
when 3838 => note <= "101101001100110";
when 3839 => note <= "110101011111110";
when 3840 => note <= "000000000000000";
when 3841 => note <= "001010100000010";
when 3842 => note <= "010010110011010";
when 3843 => note <= "010111010000111";
when 3844 => note <= "010111010000110";
when 3845 => note <= "010011010100001";
when 3846 => note <= "001100111100011";
when 3847 => note <= "000110010000011";
when 3848 => note <= "000001010111001";
when 3849 => note <= "111111110011011";
when 3850 => note <= "000010001001010";
when 3851 => note <= "000111110011011";
when 3852 => note <= "001111001101111";
when 3853 => note <= "010110010000011";
when 3854 => note <= "011010110011010";
when 3855 => note <= "011011010100001";
when 3856 => note <= "010111010000110";
when 3857 => note <= "001111010000111";
when 3858 => note <= "000100111100011";
when 3859 => note <= "111010100000010";
when 3860 => note <= "110010001001010";
when 3861 => note <= "101101011111110";
when 3862 => note <= "101101001100110";
when 3863 => note <= "110000101111001";
when 3864 => note <= "110110100110001";
when 3865 => note <= "111100101011111";
when 3866 => note <= "000000111010011";
when 3867 => note <= "000001101111101";
when 3868 => note <= "111110101000111";
when 3869 => note <= "111000001100101";
when 3870 => note <= "110000000000000";
when 3871 => note <= "101000001100101";
when 3872 => note <= "100010111011010";
when 3873 => note <= "100001101111101";
when 3874 => note <= "100101001100110";
when 3875 => note <= "101100101011111";
when 3876 => note <= "110110100110001";
when 3877 => note <= "000000101111001";
when 3878 => note <= "001000111010011";
when 3879 => note <= "001101011111110";
when 3880 => note <= "001101110110110";
when 3881 => note <= "001010100000010";
when 3882 => note <= "000100111100011";
when 3883 => note <= "111111010000111";
when 3884 => note <= "111011100011001";
when 3885 => note <= "111011010100001";
when 3886 => note <= "111111000101101";
when 3887 => note <= "000110010000011";
when 3888 => note <= "001111001101111";
when 3889 => note <= "010111110011011";
when 3890 => note <= "011101110110110";
when 3891 => note <= "011111110011011";
when 3892 => note <= "011101000100110";
when 3893 => note <= "010110010000011";
when 3894 => note <= "001100111100011";
when 3895 => note <= "000011010100001";
when 3896 => note <= "111011100011001";
when 3897 => note <= "110111010000111";
when 3898 => note <= "110111000101101";
when 3899 => note <= "111010100000010";
when 3900 => note <= "000000000000000";
when 3901 => note <= "000101011111110";
when 3902 => note <= "001000111010011";
when 3903 => note <= "001000101111001";
when 3904 => note <= "000100011100111";
when 3905 => note <= "111100101011111";
when 3906 => note <= "110011000011101";
when 3907 => note <= "101001101111101";
when 3908 => note <= "100010111011010";
when 3909 => note <= "100000001100101";
when 3910 => note <= "100010001001010";
when 3911 => note <= "101000001100101";
when 3912 => note <= "110000110010001";
when 3913 => note <= "111001101111101";
when 3914 => note <= "000000111010011";
when 3915 => note <= "000100101011111";
when 3916 => note <= "000100011100111";
when 3917 => note <= "000000101111001";
when 3918 => note <= "111011000011101";
when 3919 => note <= "110101011111110";
when 3920 => note <= "110010001001010";
when 3921 => note <= "110010100000010";
when 3922 => note <= "110111000101101";
when 3923 => note <= "111111010000111";
when 3924 => note <= "001001011001111";
when 3925 => note <= "010011010100001";
when 3926 => note <= "011010110011010";
when 3927 => note <= "011110010000011";
when 3928 => note <= "011101000100110";
when 3929 => note <= "010111110011011";
when 3930 => note <= "010000000000000";
when 3931 => note <= "000111110011011";
when 3932 => note <= "000001010111001";
when 3933 => note <= "111110010000011";
when 3934 => note <= "111111000101101";
when 3935 => note <= "000011010100001";
when 3936 => note <= "001001011001111";
when 3937 => note <= "001111010000111";
when 3938 => note <= "010010110011010";
when 3939 => note <= "010010100000010";
when 3940 => note <= "001101110110110";
when 3941 => note <= "000101011111110";
when 3942 => note <= "111011000011101";
when 3943 => note <= "110000101111001";
when 3944 => note <= "101000101111010";
when 3945 => note <= "100100101011111";
when 3946 => note <= "100101001100110";
when 3947 => note <= "101001101111101";
when 3948 => note <= "110000110010001";
when 3949 => note <= "111000001100101";
when 3950 => note <= "111101110110110";
when 3951 => note <= "000000001100101";
when 3952 => note <= "111110101000111";
when 3953 => note <= "111001101111101";
when 3954 => note <= "110011000011101";
when 3955 => note <= "101100101011111";
when 3956 => note <= "101000101111010";
when 3957 => note <= "101000101111001";
when 3958 => note <= "101101001100110";
when 3959 => note <= "110101011111110";
when 3960 => note <= "000000000000000";
when 3961 => note <= "001010100000010";
when 3962 => note <= "010010110011010";
when 3963 => note <= "010111010000111";
when 3964 => note <= "010111010000110";
when 3965 => note <= "010011010100001";
when 3966 => note <= "001100111100011";
when 3967 => note <= "000110010000011";
when 3968 => note <= "000001010111001";
when 3969 => note <= "111111110011011";
when 3970 => note <= "000010001001010";
when 3971 => note <= "000111110011011";
when 3972 => note <= "001111001101111";
when 3973 => note <= "010110010000011";
when 3974 => note <= "011010110011010";
when 3975 => note <= "011011010100001";
when 3976 => note <= "010111010000110";
when 3977 => note <= "001111010000111";
when 3978 => note <= "000100111100011";
when 3979 => note <= "111010100000010";
when 3980 => note <= "110010001001010";
when 3981 => note <= "101101011111110";
when 3982 => note <= "101101001100110";
when 3983 => note <= "110000101111001";
when 3984 => note <= "110110100110001";
when 3985 => note <= "111100101011111";
when 3986 => note <= "000000111010011";
when 3987 => note <= "000001101111101";
when 3988 => note <= "111110101000111";
when 3989 => note <= "111000001100101";
when 3990 => note <= "110000000000000";
when 3991 => note <= "101000001100101";
when 3992 => note <= "100010111011010";
when 3993 => note <= "100001101111101";
when 3994 => note <= "100101001100110";
when 3995 => note <= "101100101011111";
when 3996 => note <= "110110100110001";
when 3997 => note <= "000000101111001";
when 3998 => note <= "001000111010011";
when 3999 => note <= "001101011111110";
when 4000 => note <= "001101110110110";
when 4001 => note <= "001010100000010";
when 4002 => note <= "000100111100011";
when 4003 => note <= "111111010000111";
when 4004 => note <= "111011100011001";
when 4005 => note <= "111011010100001";
when 4006 => note <= "111111000101101";
when 4007 => note <= "000110010000011";
when 4008 => note <= "001111001101111";
when 4009 => note <= "010111110011011";
when 4010 => note <= "011101110110110";
when 4011 => note <= "011111110011011";
when 4012 => note <= "011101000100110";
when 4013 => note <= "010110010000011";
when 4014 => note <= "001100111100011";
when 4015 => note <= "000011010100001";
when 4016 => note <= "111011100011001";
when 4017 => note <= "110111010000111";
when 4018 => note <= "110111000101101";
when 4019 => note <= "111010100000010";
when 4020 => note <= "000000000000000";
when 4021 => note <= "000101011111110";
when 4022 => note <= "001000111010011";
when 4023 => note <= "001000101111001";
when 4024 => note <= "000100011100111";
when 4025 => note <= "111100101011111";
when 4026 => note <= "110011000011101";
when 4027 => note <= "101001101111101";
when 4028 => note <= "100010111011010";
when 4029 => note <= "100000001100101";
when 4030 => note <= "100010001001010";
when 4031 => note <= "101000001100101";
when 4032 => note <= "110000110010001";
when 4033 => note <= "111001101111101";
when 4034 => note <= "000000111010011";
when 4035 => note <= "000100101011111";
when 4036 => note <= "000100011100111";
when 4037 => note <= "000000101111001";
when 4038 => note <= "111011000011101";
when 4039 => note <= "110101011111110";
when 4040 => note <= "110010001001010";
when 4041 => note <= "110010100000010";
when 4042 => note <= "110111000101101";
when 4043 => note <= "111111010000111";
when 4044 => note <= "001001011001111";
when 4045 => note <= "010011010100001";
when 4046 => note <= "011010110011010";
when 4047 => note <= "011110010000011";
when 4048 => note <= "011101000100110";
when 4049 => note <= "010111110011011";
when 4050 => note <= "010000000000000";
when 4051 => note <= "000111110011011";
when 4052 => note <= "000001010111001";
when 4053 => note <= "111110010000011";
when 4054 => note <= "111111000101101";
when 4055 => note <= "000011010100001";
when 4056 => note <= "001001011001111";
when 4057 => note <= "001111010000111";
when 4058 => note <= "010010110011010";
when 4059 => note <= "010010100000010";
when 4060 => note <= "001101110110110";
when 4061 => note <= "000101011111110";
when 4062 => note <= "111011000011101";
when 4063 => note <= "110000101111001";
when 4064 => note <= "101000101111010";
when 4065 => note <= "100100101011111";
when 4066 => note <= "100101001100110";
when 4067 => note <= "101001101111101";
when 4068 => note <= "110000110010001";
when 4069 => note <= "111000001100101";
when 4070 => note <= "111101110110110";
when 4071 => note <= "000000001100101";
when 4072 => note <= "111110101000111";
when 4073 => note <= "111001101111101";
when 4074 => note <= "110011000011101";
when 4075 => note <= "101100101011111";
when 4076 => note <= "101000101111010";
when 4077 => note <= "101000101111001";
when 4078 => note <= "101101001100110";
when 4079 => note <= "110101011111110";
when 4080 => note <= "000000000000000";
when 4081 => note <= "001010100000010";
when 4082 => note <= "010010110011010";
when 4083 => note <= "010111010000111";
when 4084 => note <= "010111010000110";
when 4085 => note <= "010011010100001";
when 4086 => note <= "001100111100011";
when 4087 => note <= "000110010000011";
when 4088 => note <= "000001010111001";
when 4089 => note <= "111111110011011";
when 4090 => note <= "000010001001010";
when 4091 => note <= "000111110011011";
when 4092 => note <= "001111001101111";
when 4093 => note <= "010110010000011";
when 4094 => note <= "011010110011010";
when 4095 => note <= "011011010100001";
when 4096 => note <= "010111010000110";
when 4097 => note <= "001111010000111";
when 4098 => note <= "000100111100011";
when 4099 => note <= "111010100000010";
when 4100 => note <= "110010001001010";
when 4101 => note <= "101101011111110";
when 4102 => note <= "101101001100110";
when 4103 => note <= "110000101111001";
when 4104 => note <= "110110100110001";
when 4105 => note <= "111100101011111";
when 4106 => note <= "000000111010011";
when 4107 => note <= "000001101111101";
when 4108 => note <= "111110101000111";
when 4109 => note <= "111000001100101";
when 4110 => note <= "110000000000000";
when 4111 => note <= "101000001100101";
when 4112 => note <= "100010111011010";
when 4113 => note <= "100001101111101";
when 4114 => note <= "100101001100110";
when 4115 => note <= "101100101011111";
when 4116 => note <= "110110100110001";
when 4117 => note <= "000000101111001";
when 4118 => note <= "001000111010011";
when 4119 => note <= "001101011111110";
when 4120 => note <= "001101110110110";
when 4121 => note <= "001010100000010";
when 4122 => note <= "000100111100011";
when 4123 => note <= "111111010000111";
when 4124 => note <= "111011100011001";
when 4125 => note <= "111011010100001";
when 4126 => note <= "111111000101101";
when 4127 => note <= "000110010000011";
when 4128 => note <= "001111001101111";
when 4129 => note <= "010111110011011";
when 4130 => note <= "011101110110110";
when 4131 => note <= "011111110011011";
when 4132 => note <= "011101000100110";
when 4133 => note <= "010110010000011";
when 4134 => note <= "001100111100011";
when 4135 => note <= "000011010100001";
when 4136 => note <= "111011100011001";
when 4137 => note <= "110111010000111";
when 4138 => note <= "110111000101101";
when 4139 => note <= "111010100000010";
when 4140 => note <= "000000000000000";
when 4141 => note <= "000101011111110";
when 4142 => note <= "001000111010011";
when 4143 => note <= "001000101111001";
when 4144 => note <= "000100011100111";
when 4145 => note <= "111100101011111";
when 4146 => note <= "110011000011101";
when 4147 => note <= "101001101111101";
when 4148 => note <= "100010111011010";
when 4149 => note <= "100000001100101";
when 4150 => note <= "100010001001010";
when 4151 => note <= "101000001100101";
when 4152 => note <= "110000110010001";
when 4153 => note <= "111001101111101";
when 4154 => note <= "000000111010011";
when 4155 => note <= "000100101011111";
when 4156 => note <= "000100011100111";
when 4157 => note <= "000000101111001";
when 4158 => note <= "111011000011101";
when 4159 => note <= "110101011111110";
when 4160 => note <= "110010001001010";
when 4161 => note <= "110010100000010";
when 4162 => note <= "110111000101101";
when 4163 => note <= "111111010000111";
when 4164 => note <= "001001011001111";
when 4165 => note <= "010011010100001";
when 4166 => note <= "011010110011010";
when 4167 => note <= "011110010000011";
when 4168 => note <= "011101000100110";
when 4169 => note <= "010111110011011";
when 4170 => note <= "010000000000000";
when 4171 => note <= "000111110011011";
when 4172 => note <= "000001010111001";
when 4173 => note <= "111110010000011";
when 4174 => note <= "111111000101101";
when 4175 => note <= "000011010100001";
when 4176 => note <= "001001011001111";
when 4177 => note <= "001111010000111";
when 4178 => note <= "010010110011010";
when 4179 => note <= "010010100000010";
when 4180 => note <= "001101110110110";
when 4181 => note <= "000101011111110";
when 4182 => note <= "111011000011101";
when 4183 => note <= "110000101111001";
when 4184 => note <= "101000101111010";
when 4185 => note <= "100100101011111";
when 4186 => note <= "100101001100110";
when 4187 => note <= "101001101111101";
when 4188 => note <= "110000110010001";
when 4189 => note <= "111000001100101";
when 4190 => note <= "111101110110110";
when 4191 => note <= "000000001100101";
when 4192 => note <= "111110101000111";
when 4193 => note <= "111001101111101";
when 4194 => note <= "110011000011101";
when 4195 => note <= "101100101011111";
when 4196 => note <= "101000101111010";
when 4197 => note <= "101000101111001";
when 4198 => note <= "101101001100110";
when 4199 => note <= "110101011111110";
when 4200 => note <= "000000000000000";
when 4201 => note <= "001010100000010";
when 4202 => note <= "010010110011010";
when 4203 => note <= "010111010000111";
when 4204 => note <= "010111010000110";
when 4205 => note <= "010011010100001";
when 4206 => note <= "001100111100011";
when 4207 => note <= "000110010000011";
when 4208 => note <= "000001010111001";
when 4209 => note <= "111111110011011";
when 4210 => note <= "000010001001010";
when 4211 => note <= "000111110011011";
when 4212 => note <= "001111001101111";
when 4213 => note <= "010110010000011";
when 4214 => note <= "011010110011010";
when 4215 => note <= "011011010100001";
when 4216 => note <= "010111010000110";
when 4217 => note <= "001111010000111";
when 4218 => note <= "000100111100011";
when 4219 => note <= "111010100000010";
when 4220 => note <= "110010001001010";
when 4221 => note <= "101101011111110";
when 4222 => note <= "101101001100110";
when 4223 => note <= "110000101111001";
when 4224 => note <= "110110100110001";
when 4225 => note <= "111100101011111";
when 4226 => note <= "000000111010011";
when 4227 => note <= "000001101111101";
when 4228 => note <= "111110101000111";
when 4229 => note <= "111000001100101";
when 4230 => note <= "110000000000000";
when 4231 => note <= "101000001100101";
when 4232 => note <= "100010111011010";
when 4233 => note <= "100001101111101";
when 4234 => note <= "100101001100110";
when 4235 => note <= "101100101011111";
when 4236 => note <= "110110100110001";
when 4237 => note <= "000000101111001";
when 4238 => note <= "001000111010011";
when 4239 => note <= "001101011111110";
when 4240 => note <= "001101110110110";
when 4241 => note <= "001010100000010";
when 4242 => note <= "000100111100011";
when 4243 => note <= "111111010000111";
when 4244 => note <= "111011100011001";
when 4245 => note <= "111011010100001";
when 4246 => note <= "111111000101101";
when 4247 => note <= "000110010000011";
when 4248 => note <= "001111001101111";
when 4249 => note <= "010111110011011";
when 4250 => note <= "011101110110110";
when 4251 => note <= "011111110011011";
when 4252 => note <= "011101000100110";
when 4253 => note <= "010110010000011";
when 4254 => note <= "001100111100011";
when 4255 => note <= "000011010100001";
when 4256 => note <= "111011100011001";
when 4257 => note <= "110111010000111";
when 4258 => note <= "110111000101101";
when 4259 => note <= "111010100000010";
when 4260 => note <= "000000000000000";
when 4261 => note <= "000101011111110";
when 4262 => note <= "001000111010011";
when 4263 => note <= "001000101111001";
when 4264 => note <= "000100011100111";
when 4265 => note <= "111100101011111";
when 4266 => note <= "110011000011101";
when 4267 => note <= "101001101111101";
when 4268 => note <= "100010111011010";
when 4269 => note <= "100000001100101";
when 4270 => note <= "100010001001010";
when 4271 => note <= "101000001100101";
when 4272 => note <= "110000110010001";
when 4273 => note <= "111001101111101";
when 4274 => note <= "000000111010011";
when 4275 => note <= "000100101011111";
when 4276 => note <= "000100011100111";
when 4277 => note <= "000000101111001";
when 4278 => note <= "111011000011101";
when 4279 => note <= "110101011111110";
when 4280 => note <= "110010001001010";
when 4281 => note <= "110010100000010";
when 4282 => note <= "110111000101101";
when 4283 => note <= "111111010000111";
when 4284 => note <= "001001011001111";
when 4285 => note <= "010011010100001";
when 4286 => note <= "011010110011010";
when 4287 => note <= "011110010000011";
when 4288 => note <= "011101000100110";
when 4289 => note <= "010111110011011";
when 4290 => note <= "010000000000000";
when 4291 => note <= "000111110011011";
when 4292 => note <= "000001010111001";
when 4293 => note <= "111110010000011";
when 4294 => note <= "111111000101101";
when 4295 => note <= "000011010100001";
when 4296 => note <= "001001011001111";
when 4297 => note <= "001111010000111";
when 4298 => note <= "010010110011010";
when 4299 => note <= "010010100000010";
when 4300 => note <= "001101110110110";
when 4301 => note <= "000101011111110";
when 4302 => note <= "111011000011101";
when 4303 => note <= "110000101111001";
when 4304 => note <= "101000101111010";
when 4305 => note <= "100100101011111";
when 4306 => note <= "100101001100110";
when 4307 => note <= "101001101111101";
when 4308 => note <= "110000110010001";
when 4309 => note <= "111000001100101";
when 4310 => note <= "111101110110110";
when 4311 => note <= "000000001100101";
when 4312 => note <= "111110101000111";
when 4313 => note <= "111001101111101";
when 4314 => note <= "110011000011101";
when 4315 => note <= "101100101011111";
when 4316 => note <= "101000101111010";
when 4317 => note <= "101000101111001";
when 4318 => note <= "101101001100110";
when 4319 => note <= "110101011111110";
when 4320 => note <= "000000000000000";
when 4321 => note <= "001010100000010";
when 4322 => note <= "010010110011010";
when 4323 => note <= "010111010000111";
when 4324 => note <= "010111010000110";
when 4325 => note <= "010011010100001";
when 4326 => note <= "001100111100011";
when 4327 => note <= "000110010000011";
when 4328 => note <= "000001010111001";
when 4329 => note <= "111111110011011";
when 4330 => note <= "000010001001010";
when 4331 => note <= "000111110011011";
when 4332 => note <= "001111001101111";
when 4333 => note <= "010110010000011";
when 4334 => note <= "011010110011010";
when 4335 => note <= "011011010100001";
when 4336 => note <= "010111010000110";
when 4337 => note <= "001111010000111";
when 4338 => note <= "000100111100011";
when 4339 => note <= "111010100000010";
when 4340 => note <= "110010001001010";
when 4341 => note <= "101101011111110";
when 4342 => note <= "101101001100110";
when 4343 => note <= "110000101111001";
when 4344 => note <= "110110100110001";
when 4345 => note <= "111100101011111";
when 4346 => note <= "000000111010011";
when 4347 => note <= "000001101111101";
when 4348 => note <= "111110101000111";
when 4349 => note <= "111000001100101";
when 4350 => note <= "110000000000000";
when 4351 => note <= "101000001100101";
when 4352 => note <= "100010111011010";
when 4353 => note <= "100001101111101";
when 4354 => note <= "100101001100110";
when 4355 => note <= "101100101011111";
when 4356 => note <= "110110100110001";
when 4357 => note <= "000000101111001";
when 4358 => note <= "001000111010011";
when 4359 => note <= "001101011111110";
when 4360 => note <= "001101110110110";
when 4361 => note <= "001010100000010";
when 4362 => note <= "000100111100011";
when 4363 => note <= "111111010000111";
when 4364 => note <= "111011100011001";
when 4365 => note <= "111011010100001";
when 4366 => note <= "111111000101101";
when 4367 => note <= "000110010000011";
when 4368 => note <= "001111001101111";
when 4369 => note <= "010111110011011";
when 4370 => note <= "011101110110110";
when 4371 => note <= "011111110011011";
when 4372 => note <= "011101000100110";
when 4373 => note <= "010110010000011";
when 4374 => note <= "001100111100011";
when 4375 => note <= "000011010100001";
when 4376 => note <= "111011100011001";
when 4377 => note <= "110111010000111";
when 4378 => note <= "110111000101101";
when 4379 => note <= "111010100000010";
when 4380 => note <= "000000000000000";
when 4381 => note <= "000101011111110";
when 4382 => note <= "001000111010011";
when 4383 => note <= "001000101111001";
when 4384 => note <= "000100011100111";
when 4385 => note <= "111100101011111";
when 4386 => note <= "110011000011101";
when 4387 => note <= "101001101111101";
when 4388 => note <= "100010111011010";
when 4389 => note <= "100000001100101";
when 4390 => note <= "100010001001010";
when 4391 => note <= "101000001100101";
when 4392 => note <= "110000110010001";
when 4393 => note <= "111001101111101";
when 4394 => note <= "000000111010011";
when 4395 => note <= "000100101011111";
when 4396 => note <= "000100011100111";
when 4397 => note <= "000000101111001";
when 4398 => note <= "111011000011101";
when 4399 => note <= "110101011111110";
when 4400 => note <= "110010001001010";
when 4401 => note <= "110010100000010";
when 4402 => note <= "110111000101101";
when 4403 => note <= "111111010000111";
when 4404 => note <= "001001011001111";
when 4405 => note <= "010011010100001";
when 4406 => note <= "011010110011010";
when 4407 => note <= "011110010000011";
when 4408 => note <= "011101000100110";
when 4409 => note <= "010111110011011";
when 4410 => note <= "010000000000000";
when 4411 => note <= "000111110011011";
when 4412 => note <= "000001010111001";
when 4413 => note <= "111110010000011";
when 4414 => note <= "111111000101101";
when 4415 => note <= "000011010100001";
when 4416 => note <= "001001011001111";
when 4417 => note <= "001111010000111";
when 4418 => note <= "010010110011010";
when 4419 => note <= "010010100000010";
when 4420 => note <= "001101110110110";
when 4421 => note <= "000101011111110";
when 4422 => note <= "111011000011101";
when 4423 => note <= "110000101111001";
when 4424 => note <= "101000101111010";
when 4425 => note <= "100100101011111";
when 4426 => note <= "100101001100110";
when 4427 => note <= "101001101111101";
when 4428 => note <= "110000110010001";
when 4429 => note <= "111000001100101";
when 4430 => note <= "111101110110110";
when 4431 => note <= "000000001100101";
when 4432 => note <= "111110101000111";
when 4433 => note <= "111001101111101";
when 4434 => note <= "110011000011101";
when 4435 => note <= "101100101011111";
when 4436 => note <= "101000101111010";
when 4437 => note <= "101000101111001";
when 4438 => note <= "101101001100110";
when 4439 => note <= "110101011111110";
when 4440 => note <= "000000000000000";
when 4441 => note <= "001010100000010";
when 4442 => note <= "010010110011010";
when 4443 => note <= "010111010000111";
when 4444 => note <= "010111010000110";
when 4445 => note <= "010011010100001";
when 4446 => note <= "001100111100011";
when 4447 => note <= "000110010000011";
when 4448 => note <= "000001010111001";
when 4449 => note <= "111111110011011";
when 4450 => note <= "000010001001010";
when 4451 => note <= "000111110011011";
when 4452 => note <= "001111001101111";
when 4453 => note <= "010110010000011";
when 4454 => note <= "011010110011010";
when 4455 => note <= "011011010100001";
when 4456 => note <= "010111010000110";
when 4457 => note <= "001111010000111";
when 4458 => note <= "000100111100011";
when 4459 => note <= "111010100000010";
when 4460 => note <= "110010001001010";
when 4461 => note <= "101101011111110";
when 4462 => note <= "101101001100110";
when 4463 => note <= "110000101111001";
when 4464 => note <= "110110100110001";
when 4465 => note <= "111100101011111";
when 4466 => note <= "000000111010011";
when 4467 => note <= "000001101111101";
when 4468 => note <= "111110101000111";
when 4469 => note <= "111000001100101";
when 4470 => note <= "110000000000000";
when 4471 => note <= "101000001100101";
when 4472 => note <= "100010111011010";
when 4473 => note <= "100001101111101";
when 4474 => note <= "100101001100110";
when 4475 => note <= "101100101011111";
when 4476 => note <= "110110100110001";
when 4477 => note <= "000000101111001";
when 4478 => note <= "001000111010011";
when 4479 => note <= "001101011111110";
when 4480 => note <= "001101110110110";
when 4481 => note <= "001010100000010";
when 4482 => note <= "000100111100011";
when 4483 => note <= "111111010000111";
when 4484 => note <= "111011100011001";
when 4485 => note <= "111011010100001";
when 4486 => note <= "111111000101101";
when 4487 => note <= "000110010000011";
when 4488 => note <= "001111001101111";
when 4489 => note <= "010111110011011";
when 4490 => note <= "011101110110110";
when 4491 => note <= "011111110011011";
when 4492 => note <= "011101000100110";
when 4493 => note <= "010110010000011";
when 4494 => note <= "001100111100011";
when 4495 => note <= "000011010100001";
when 4496 => note <= "111011100011001";
when 4497 => note <= "110111010000111";
when 4498 => note <= "110111000101101";
when 4499 => note <= "111010100000010";
when 4500 => note <= "000000000000000";
when 4501 => note <= "000101011111110";
when 4502 => note <= "001000111010011";
when 4503 => note <= "001000101111001";
when 4504 => note <= "000100011100111";
when 4505 => note <= "111100101011111";
when 4506 => note <= "110011000011101";
when 4507 => note <= "101001101111101";
when 4508 => note <= "100010111011010";
when 4509 => note <= "100000001100101";
when 4510 => note <= "100010001001010";
when 4511 => note <= "101000001100101";
when 4512 => note <= "110000110010001";
when 4513 => note <= "111001101111101";
when 4514 => note <= "000000111010011";
when 4515 => note <= "000100101011111";
when 4516 => note <= "000100011100111";
when 4517 => note <= "000000101111001";
when 4518 => note <= "111011000011101";
when 4519 => note <= "110101011111110";
when 4520 => note <= "110010001001010";
when 4521 => note <= "110010100000010";
when 4522 => note <= "110111000101101";
when 4523 => note <= "111111010000111";
when 4524 => note <= "001001011001111";
when 4525 => note <= "010011010100001";
when 4526 => note <= "011010110011010";
when 4527 => note <= "011110010000011";
when 4528 => note <= "011101000100110";
when 4529 => note <= "010111110011011";
when 4530 => note <= "010000000000000";
when 4531 => note <= "000111110011011";
when 4532 => note <= "000001010111001";
when 4533 => note <= "111110010000011";
when 4534 => note <= "111111000101101";
when 4535 => note <= "000011010100001";
when 4536 => note <= "001001011001111";
when 4537 => note <= "001111010000111";
when 4538 => note <= "010010110011010";
when 4539 => note <= "010010100000010";
when 4540 => note <= "001101110110110";
when 4541 => note <= "000101011111110";
when 4542 => note <= "111011000011101";
when 4543 => note <= "110000101111001";
when 4544 => note <= "101000101111010";
when 4545 => note <= "100100101011111";
when 4546 => note <= "100101001100110";
when 4547 => note <= "101001101111101";
when 4548 => note <= "110000110010001";
when 4549 => note <= "111000001100101";
when 4550 => note <= "111101110110110";
when 4551 => note <= "000000001100101";
when 4552 => note <= "111110101000111";
when 4553 => note <= "111001101111101";
when 4554 => note <= "110011000011101";
when 4555 => note <= "101100101011111";
when 4556 => note <= "101000101111010";
when 4557 => note <= "101000101111001";
when 4558 => note <= "101101001100110";
when 4559 => note <= "110101011111110";
when 4560 => note <= "000000000000000";
when 4561 => note <= "001010100000010";
when 4562 => note <= "010010110011010";
when 4563 => note <= "010111010000111";
when 4564 => note <= "010111010000110";
when 4565 => note <= "010011010100001";
when 4566 => note <= "001100111100011";
when 4567 => note <= "000110010000011";
when 4568 => note <= "000001010111001";
when 4569 => note <= "111111110011011";
when 4570 => note <= "000010001001010";
when 4571 => note <= "000111110011011";
when 4572 => note <= "001111001101111";
when 4573 => note <= "010110010000011";
when 4574 => note <= "011010110011010";
when 4575 => note <= "011011010100001";
when 4576 => note <= "010111010000110";
when 4577 => note <= "001111010000111";
when 4578 => note <= "000100111100011";
when 4579 => note <= "111010100000010";
when 4580 => note <= "110010001001010";
when 4581 => note <= "101101011111110";
when 4582 => note <= "101101001100110";
when 4583 => note <= "110000101111001";
when 4584 => note <= "110110100110001";
when 4585 => note <= "111100101011111";
when 4586 => note <= "000000111010011";
when 4587 => note <= "000001101111101";
when 4588 => note <= "111110101000111";
when 4589 => note <= "111000001100101";
when 4590 => note <= "110000000000000";
when 4591 => note <= "101000001100101";
when 4592 => note <= "100010111011010";
when 4593 => note <= "100001101111101";
when 4594 => note <= "100101001100110";
when 4595 => note <= "101100101011111";
when 4596 => note <= "110110100110001";
when 4597 => note <= "000000101111001";
when 4598 => note <= "001000111010011";
when 4599 => note <= "001101011111110";
when 4600 => note <= "001101110110110";
when 4601 => note <= "001010100000010";
when 4602 => note <= "000100111100011";
when 4603 => note <= "111111010000111";
when 4604 => note <= "111011100011001";
when 4605 => note <= "111011010100001";
when 4606 => note <= "111111000101101";
when 4607 => note <= "000110010000011";
when 4608 => note <= "001111001101111";
when 4609 => note <= "010111110011011";
when 4610 => note <= "011101110110110";
when 4611 => note <= "011111110011011";
when 4612 => note <= "011101000100110";
when 4613 => note <= "010110010000011";
when 4614 => note <= "001100111100011";
when 4615 => note <= "000011010100001";
when 4616 => note <= "111011100011001";
when 4617 => note <= "110111010000111";
when 4618 => note <= "110111000101101";
when 4619 => note <= "111010100000010";
when 4620 => note <= "000000000000000";
when 4621 => note <= "000101011111110";
when 4622 => note <= "001000111010011";
when 4623 => note <= "001000101111001";
when 4624 => note <= "000100011100111";
when 4625 => note <= "111100101011111";
when 4626 => note <= "110011000011101";
when 4627 => note <= "101001101111101";
when 4628 => note <= "100010111011010";
when 4629 => note <= "100000001100101";
when 4630 => note <= "100010001001010";
when 4631 => note <= "101000001100101";
when 4632 => note <= "110000110010001";
when 4633 => note <= "111001101111101";
when 4634 => note <= "000000111010011";
when 4635 => note <= "000100101011111";
when 4636 => note <= "000100011100111";
when 4637 => note <= "000000101111001";
when 4638 => note <= "111011000011101";
when 4639 => note <= "110101011111110";
when 4640 => note <= "110010001001010";
when 4641 => note <= "110010100000010";
when 4642 => note <= "110111000101101";
when 4643 => note <= "111111010000111";
when 4644 => note <= "001001011001111";
when 4645 => note <= "010011010100001";
when 4646 => note <= "011010110011010";
when 4647 => note <= "011110010000011";
when 4648 => note <= "011101000100110";
when 4649 => note <= "010111110011011";
when 4650 => note <= "010000000000000";
when 4651 => note <= "000111110011011";
when 4652 => note <= "000001010111001";
when 4653 => note <= "111110010000011";
when 4654 => note <= "111111000101101";
when 4655 => note <= "000011010100001";
when 4656 => note <= "001001011001111";
when 4657 => note <= "001111010000111";
when 4658 => note <= "010010110011010";
when 4659 => note <= "010010100000010";
when 4660 => note <= "001101110110110";
when 4661 => note <= "000101011111110";
when 4662 => note <= "111011000011101";
when 4663 => note <= "110000101111001";
when 4664 => note <= "101000101111010";
when 4665 => note <= "100100101011111";
when 4666 => note <= "100101001100110";
when 4667 => note <= "101001101111101";
when 4668 => note <= "110000110010001";
when 4669 => note <= "111000001100101";
when 4670 => note <= "111101110110110";
when 4671 => note <= "000000001100101";
when 4672 => note <= "111110101000111";
when 4673 => note <= "111001101111101";
when 4674 => note <= "110011000011101";
when 4675 => note <= "101100101011111";
when 4676 => note <= "101000101111010";
when 4677 => note <= "101000101111001";
when 4678 => note <= "101101001100110";
when 4679 => note <= "110101011111110";
when 4680 => note <= "000000000000000";
when 4681 => note <= "001010100000010";
when 4682 => note <= "010010110011010";
when 4683 => note <= "010111010000111";
when 4684 => note <= "010111010000110";
when 4685 => note <= "010011010100001";
when 4686 => note <= "001100111100011";
when 4687 => note <= "000110010000011";
when 4688 => note <= "000001010111001";
when 4689 => note <= "111111110011011";
when 4690 => note <= "000010001001010";
when 4691 => note <= "000111110011011";
when 4692 => note <= "001111001101111";
when 4693 => note <= "010110010000011";
when 4694 => note <= "011010110011010";
when 4695 => note <= "011011010100001";
when 4696 => note <= "010111010000110";
when 4697 => note <= "001111010000111";
when 4698 => note <= "000100111100011";
when 4699 => note <= "111010100000010";
when 4700 => note <= "110010001001010";
when 4701 => note <= "101101011111110";
when 4702 => note <= "101101001100110";
when 4703 => note <= "110000101111001";
when 4704 => note <= "110110100110001";
when 4705 => note <= "111100101011111";
when 4706 => note <= "000000111010011";
when 4707 => note <= "000001101111101";
when 4708 => note <= "111110101000111";
when 4709 => note <= "111000001100101";
when 4710 => note <= "110000000000000";
when 4711 => note <= "101000001100101";
when 4712 => note <= "100010111011010";
when 4713 => note <= "100001101111101";
when 4714 => note <= "100101001100110";
when 4715 => note <= "101100101011111";
when 4716 => note <= "110110100110001";
when 4717 => note <= "000000101111001";
when 4718 => note <= "001000111010011";
when 4719 => note <= "001101011111110";
when 4720 => note <= "001101110110110";
when 4721 => note <= "001010100000010";
when 4722 => note <= "000100111100011";
when 4723 => note <= "111111010000111";
when 4724 => note <= "111011100011001";
when 4725 => note <= "111011010100001";
when 4726 => note <= "111111000101101";
when 4727 => note <= "000110010000011";
when 4728 => note <= "001111001101111";
when 4729 => note <= "010111110011011";
when 4730 => note <= "011101110110110";
when 4731 => note <= "011111110011011";
when 4732 => note <= "011101000100110";
when 4733 => note <= "010110010000011";
when 4734 => note <= "001100111100011";
when 4735 => note <= "000011010100001";
when 4736 => note <= "111011100011001";
when 4737 => note <= "110111010000111";
when 4738 => note <= "110111000101101";
when 4739 => note <= "111010100000010";
when 4740 => note <= "000000000000000";
when 4741 => note <= "000101011111110";
when 4742 => note <= "001000111010011";
when 4743 => note <= "001000101111001";
when 4744 => note <= "000100011100111";
when 4745 => note <= "111100101011111";
when 4746 => note <= "110011000011101";
when 4747 => note <= "101001101111101";
when 4748 => note <= "100010111011010";
when 4749 => note <= "100000001100101";
when 4750 => note <= "100010001001010";
when 4751 => note <= "101000001100101";
when 4752 => note <= "110000110010001";
when 4753 => note <= "111001101111101";
when 4754 => note <= "000000111010011";
when 4755 => note <= "000100101011111";
when 4756 => note <= "000100011100111";
when 4757 => note <= "000000101111001";
when 4758 => note <= "111011000011101";
when 4759 => note <= "110101011111110";
when 4760 => note <= "110010001001010";
when 4761 => note <= "110010100000010";
when 4762 => note <= "110111000101101";
when 4763 => note <= "111111010000111";
when 4764 => note <= "001001011001111";
when 4765 => note <= "010011010100001";
when 4766 => note <= "011010110011010";
when 4767 => note <= "011110010000011";
when 4768 => note <= "011101000100110";
when 4769 => note <= "010111110011011";
when 4770 => note <= "010000000000000";
when 4771 => note <= "000111110011011";
when 4772 => note <= "000001010111001";
when 4773 => note <= "111110010000011";
when 4774 => note <= "111111000101101";
when 4775 => note <= "000011010100001";
when 4776 => note <= "001001011001111";
when 4777 => note <= "001111010000111";
when 4778 => note <= "010010110011010";
when 4779 => note <= "010010100000010";
when 4780 => note <= "001101110110110";
when 4781 => note <= "000101011111110";
when 4782 => note <= "111011000011101";
when 4783 => note <= "110000101111001";
when 4784 => note <= "101000101111010";
when 4785 => note <= "100100101011111";
when 4786 => note <= "100101001100110";
when 4787 => note <= "101001101111101";
when 4788 => note <= "110000110010001";
when 4789 => note <= "111000001100101";
when 4790 => note <= "111101110110110";
when 4791 => note <= "000000001100101";
when 4792 => note <= "111110101000111";
when 4793 => note <= "111001101111101";
when 4794 => note <= "110011000011101";
when 4795 => note <= "101100101011111";
when 4796 => note <= "101000101111010";
when 4797 => note <= "101000101111001";
when 4798 => note <= "101101001100110";
when 4799 => note <= "110101011111110";
when 4800 => note <= "000000000000000";
when 4801 => note <= "001010100000010";
when 4802 => note <= "010010110011010";
when 4803 => note <= "010111010000111";
when 4804 => note <= "010111010000110";
when 4805 => note <= "010011010100001";
when 4806 => note <= "001100111100011";
when 4807 => note <= "000110010000011";
when 4808 => note <= "000001010111001";
when 4809 => note <= "111111110011011";
when 4810 => note <= "000010001001010";
when 4811 => note <= "000111110011011";
when 4812 => note <= "001111001101111";
when 4813 => note <= "010110010000011";
when 4814 => note <= "011010110011010";
when 4815 => note <= "011011010100001";
when 4816 => note <= "010111010000110";
when 4817 => note <= "001111010000111";
when 4818 => note <= "000100111100011";
when 4819 => note <= "111010100000010";
when 4820 => note <= "110010001001010";
when 4821 => note <= "101101011111110";
when 4822 => note <= "101101001100110";
when 4823 => note <= "110000101111001";
when 4824 => note <= "110110100110001";
when 4825 => note <= "111100101011111";
when 4826 => note <= "000000111010011";
when 4827 => note <= "000001101111101";
when 4828 => note <= "111110101000111";
when 4829 => note <= "111000001100101";
when 4830 => note <= "110000000000000";
when 4831 => note <= "101000001100101";
when 4832 => note <= "100010111011010";
when 4833 => note <= "100001101111101";
when 4834 => note <= "100101001100110";
when 4835 => note <= "101100101011111";
when 4836 => note <= "110110100110001";
when 4837 => note <= "000000101111001";
when 4838 => note <= "001000111010011";
when 4839 => note <= "001101011111110";
when 4840 => note <= "001101110110110";
when 4841 => note <= "001010100000010";
when 4842 => note <= "000100111100011";
when 4843 => note <= "111111010000111";
when 4844 => note <= "111011100011001";
when 4845 => note <= "111011010100001";
when 4846 => note <= "111111000101101";
when 4847 => note <= "000110010000011";
when 4848 => note <= "001111001101111";
when 4849 => note <= "010111110011011";
when 4850 => note <= "011101110110110";
when 4851 => note <= "011111110011011";
when 4852 => note <= "011101000100110";
when 4853 => note <= "010110010000011";
when 4854 => note <= "001100111100011";
when 4855 => note <= "000011010100001";
when 4856 => note <= "111011100011001";
when 4857 => note <= "110111010000111";
when 4858 => note <= "110111000101101";
when 4859 => note <= "111010100000010";
when 4860 => note <= "000000000000000";
when 4861 => note <= "000101011111110";
when 4862 => note <= "001000111010011";
when 4863 => note <= "001000101111001";
when 4864 => note <= "000100011100111";
when 4865 => note <= "111100101011111";
when 4866 => note <= "110011000011101";
when 4867 => note <= "101001101111101";
when 4868 => note <= "100010111011010";
when 4869 => note <= "100000001100101";
when 4870 => note <= "100010001001010";
when 4871 => note <= "101000001100101";
when 4872 => note <= "110000110010001";
when 4873 => note <= "111001101111101";
when 4874 => note <= "000000111010011";
when 4875 => note <= "000100101011111";
when 4876 => note <= "000100011100111";
when 4877 => note <= "000000101111001";
when 4878 => note <= "111011000011101";
when 4879 => note <= "110101011111110";
when 4880 => note <= "110010001001010";
when 4881 => note <= "110010100000010";
when 4882 => note <= "110111000101101";
when 4883 => note <= "111111010000111";
when 4884 => note <= "001001011001111";
when 4885 => note <= "010011010100001";
when 4886 => note <= "011010110011010";
when 4887 => note <= "011110010000011";
when 4888 => note <= "011101000100110";
when 4889 => note <= "010111110011011";
when 4890 => note <= "010000000000000";
when 4891 => note <= "000111110011011";
when 4892 => note <= "000001010111001";
when 4893 => note <= "111110010000011";
when 4894 => note <= "111111000101101";
when 4895 => note <= "000011010100001";
when 4896 => note <= "001001011001111";
when 4897 => note <= "001111010000111";
when 4898 => note <= "010010110011010";
when 4899 => note <= "010010100000010";
when 4900 => note <= "001101110110110";
when 4901 => note <= "000101011111110";
when 4902 => note <= "111011000011101";
when 4903 => note <= "110000101111001";
when 4904 => note <= "101000101111010";
when 4905 => note <= "100100101011111";
when 4906 => note <= "100101001100110";
when 4907 => note <= "101001101111101";
when 4908 => note <= "110000110010001";
when 4909 => note <= "111000001100101";
when 4910 => note <= "111101110110110";
when 4911 => note <= "000000001100101";
when 4912 => note <= "111110101000111";
when 4913 => note <= "111001101111101";
when 4914 => note <= "110011000011101";
when 4915 => note <= "101100101011111";
when 4916 => note <= "101000101111010";
when 4917 => note <= "101000101111001";
when 4918 => note <= "101101001100110";
when 4919 => note <= "110101011111110";
when 4920 => note <= "000000000000000";
when 4921 => note <= "001010100000010";
when 4922 => note <= "010010110011010";
when 4923 => note <= "010111010000111";
when 4924 => note <= "010111010000110";
when 4925 => note <= "010011010100001";
when 4926 => note <= "001100111100011";
when 4927 => note <= "000110010000011";
when 4928 => note <= "000001010111001";
when 4929 => note <= "111111110011011";
when 4930 => note <= "000010001001010";
when 4931 => note <= "000111110011011";
when 4932 => note <= "001111001101111";
when 4933 => note <= "010110010000011";
when 4934 => note <= "011010110011010";
when 4935 => note <= "011011010100001";
when 4936 => note <= "010111010000110";
when 4937 => note <= "001111010000111";
when 4938 => note <= "000100111100011";
when 4939 => note <= "111010100000010";
when 4940 => note <= "110010001001010";
when 4941 => note <= "101101011111110";
when 4942 => note <= "101101001100110";
when 4943 => note <= "110000101111001";
when 4944 => note <= "110110100110001";
when 4945 => note <= "111100101011111";
when 4946 => note <= "000000111010011";
when 4947 => note <= "000001101111101";
when 4948 => note <= "111110101000111";
when 4949 => note <= "111000001100101";
when 4950 => note <= "110000000000000";
when 4951 => note <= "101000001100101";
when 4952 => note <= "100010111011010";
when 4953 => note <= "100001101111101";
when 4954 => note <= "100101001100110";
when 4955 => note <= "101100101011111";
when 4956 => note <= "110110100110001";
when 4957 => note <= "000000101111001";
when 4958 => note <= "001000111010011";
when 4959 => note <= "001101011111110";
when 4960 => note <= "001101110110110";
when 4961 => note <= "001010100000010";
when 4962 => note <= "000100111100011";
when 4963 => note <= "111111010000111";
when 4964 => note <= "111011100011001";
when 4965 => note <= "111011010100001";
when 4966 => note <= "111111000101101";
when 4967 => note <= "000110010000011";
when 4968 => note <= "001111001101111";
when 4969 => note <= "010111110011011";
when 4970 => note <= "011101110110110";
when 4971 => note <= "011111110011011";
when 4972 => note <= "011101000100110";
when 4973 => note <= "010110010000011";
when 4974 => note <= "001100111100011";
when 4975 => note <= "000011010100001";
when 4976 => note <= "111011100011001";
when 4977 => note <= "110111010000111";
when 4978 => note <= "110111000101101";
when 4979 => note <= "111010100000010";
when 4980 => note <= "000000000000000";
when 4981 => note <= "000101011111110";
when 4982 => note <= "001000111010011";
when 4983 => note <= "001000101111001";
when 4984 => note <= "000100011100111";
when 4985 => note <= "111100101011111";
when 4986 => note <= "110011000011101";
when 4987 => note <= "101001101111101";
when 4988 => note <= "100010111011010";
when 4989 => note <= "100000001100101";
when 4990 => note <= "100010001001010";
when 4991 => note <= "101000001100101";
when 4992 => note <= "110000110010001";
when 4993 => note <= "111001101111101";
when 4994 => note <= "000000111010011";
when 4995 => note <= "000100101011111";
when 4996 => note <= "000100011100111";
when 4997 => note <= "000000101111001";
when 4998 => note <= "111011000011101";
when 4999 => note <= "110101011111110";
when 5000 => note <= "110010001001010";
when 5001 => note <= "110010100000010";
when 5002 => note <= "110111000101101";
when 5003 => note <= "111111010000111";
when 5004 => note <= "001001011001111";
when 5005 => note <= "010011010100001";
when 5006 => note <= "011010110011010";
when 5007 => note <= "011110010000011";
when 5008 => note <= "011101000100110";
when 5009 => note <= "010111110011011";
when 5010 => note <= "010000000000000";
when 5011 => note <= "000111110011011";
when 5012 => note <= "000001010111001";
when 5013 => note <= "111110010000011";
when 5014 => note <= "111111000101101";
when 5015 => note <= "000011010100001";
when 5016 => note <= "001001011001111";
when 5017 => note <= "001111010000111";
when 5018 => note <= "010010110011010";
when 5019 => note <= "010010100000010";
when 5020 => note <= "001101110110110";
when 5021 => note <= "000101011111110";
when 5022 => note <= "111011000011101";
when 5023 => note <= "110000101111001";
when 5024 => note <= "101000101111010";
when 5025 => note <= "100100101011111";
when 5026 => note <= "100101001100110";
when 5027 => note <= "101001101111101";
when 5028 => note <= "110000110010001";
when 5029 => note <= "111000001100101";
when 5030 => note <= "111101110110110";
when 5031 => note <= "000000001100101";
when 5032 => note <= "111110101000111";
when 5033 => note <= "111001101111101";
when 5034 => note <= "110011000011101";
when 5035 => note <= "101100101011111";
when 5036 => note <= "101000101111010";
when 5037 => note <= "101000101111001";
when 5038 => note <= "101101001100110";
when 5039 => note <= "110101011111110";
when 5040 => note <= "000000000000000";
when 5041 => note <= "001010100000010";
when 5042 => note <= "010010110011010";
when 5043 => note <= "010111010000111";
when 5044 => note <= "010111010000110";
when 5045 => note <= "010011010100001";
when 5046 => note <= "001100111100011";
when 5047 => note <= "000110010000011";
when 5048 => note <= "000001010111001";
when 5049 => note <= "111111110011011";
when 5050 => note <= "000010001001010";
when 5051 => note <= "000111110011011";
when 5052 => note <= "001111001101111";
when 5053 => note <= "010110010000011";
when 5054 => note <= "011010110011010";
when 5055 => note <= "011011010100001";
when 5056 => note <= "010111010000110";
when 5057 => note <= "001111010000111";
when 5058 => note <= "000100111100011";
when 5059 => note <= "111010100000010";
when 5060 => note <= "110010001001010";
when 5061 => note <= "101101011111110";
when 5062 => note <= "101101001100110";
when 5063 => note <= "110000101111001";
when 5064 => note <= "110110100110001";
when 5065 => note <= "111100101011111";
when 5066 => note <= "000000111010011";
when 5067 => note <= "000001101111101";
when 5068 => note <= "111110101000111";
when 5069 => note <= "111000001100101";
when 5070 => note <= "110000000000000";
when 5071 => note <= "101000001100101";
when 5072 => note <= "100010111011010";
when 5073 => note <= "100001101111101";
when 5074 => note <= "100101001100110";
when 5075 => note <= "101100101011111";
when 5076 => note <= "110110100110001";
when 5077 => note <= "000000101111001";
when 5078 => note <= "001000111010011";
when 5079 => note <= "001101011111110";
when 5080 => note <= "001101110110110";
when 5081 => note <= "001010100000010";
when 5082 => note <= "000100111100011";
when 5083 => note <= "111111010000111";
when 5084 => note <= "111011100011001";
when 5085 => note <= "111011010100001";
when 5086 => note <= "111111000101101";
when 5087 => note <= "000110010000011";
when 5088 => note <= "001111001101111";
when 5089 => note <= "010111110011011";
when 5090 => note <= "011101110110110";
when 5091 => note <= "011111110011011";
when 5092 => note <= "011101000100110";
when 5093 => note <= "010110010000011";
when 5094 => note <= "001100111100011";
when 5095 => note <= "000011010100001";
when 5096 => note <= "111011100011001";
when 5097 => note <= "110111010000111";
when 5098 => note <= "110111000101101";
when 5099 => note <= "111010100000010";
when 5100 => note <= "000000000000000";
when 5101 => note <= "000101011111110";
when 5102 => note <= "001000111010011";
when 5103 => note <= "001000101111001";
when 5104 => note <= "000100011100111";
when 5105 => note <= "111100101011111";
when 5106 => note <= "110011000011101";
when 5107 => note <= "101001101111101";
when 5108 => note <= "100010111011010";
when 5109 => note <= "100000001100101";
when 5110 => note <= "100010001001010";
when 5111 => note <= "101000001100101";
when 5112 => note <= "110000110010001";
when 5113 => note <= "111001101111101";
when 5114 => note <= "000000111010011";
when 5115 => note <= "000100101011111";
when 5116 => note <= "000100011100111";
when 5117 => note <= "000000101111001";
when 5118 => note <= "111011000011101";
when 5119 => note <= "110101011111110";
when 5120 => note <= "110010001001010";
when 5121 => note <= "110010100000010";
when 5122 => note <= "110111000101101";
when 5123 => note <= "111111010000111";
when 5124 => note <= "001001011001111";
when 5125 => note <= "010011010100001";
when 5126 => note <= "011010110011010";
when 5127 => note <= "011110010000011";
when 5128 => note <= "011101000100110";
when 5129 => note <= "010111110011011";
when 5130 => note <= "010000000000000";
when 5131 => note <= "000111110011011";
when 5132 => note <= "000001010111001";
when 5133 => note <= "111110010000011";
when 5134 => note <= "111111000101101";
when 5135 => note <= "000011010100001";
when 5136 => note <= "001001011001111";
when 5137 => note <= "001111010000111";
when 5138 => note <= "010010110011010";
when 5139 => note <= "010010100000010";
when 5140 => note <= "001101110110110";
when 5141 => note <= "000101011111110";
when 5142 => note <= "111011000011101";
when 5143 => note <= "110000101111001";
when 5144 => note <= "101000101111010";
when 5145 => note <= "100100101011111";
when 5146 => note <= "100101001100110";
when 5147 => note <= "101001101111101";
when 5148 => note <= "110000110010001";
when 5149 => note <= "111000001100101";
when 5150 => note <= "111101110110110";
when 5151 => note <= "000000001100101";
when 5152 => note <= "111110101000111";
when 5153 => note <= "111001101111101";
when 5154 => note <= "110011000011101";
when 5155 => note <= "101100101011111";
when 5156 => note <= "101000101111010";
when 5157 => note <= "101000101111001";
when 5158 => note <= "101101001100110";
when 5159 => note <= "110101011111110";
when 5160 => note <= "000000000000000";
when 5161 => note <= "001010100000010";
when 5162 => note <= "010010110011010";
when 5163 => note <= "010111010000111";
when 5164 => note <= "010111010000110";
when 5165 => note <= "010011010100001";
when 5166 => note <= "001100111100011";
when 5167 => note <= "000110010000011";
when 5168 => note <= "000001010111001";
when 5169 => note <= "111111110011011";
when 5170 => note <= "000010001001010";
when 5171 => note <= "000111110011011";
when 5172 => note <= "001111001101111";
when 5173 => note <= "010110010000011";
when 5174 => note <= "011010110011010";
when 5175 => note <= "011011010100001";
when 5176 => note <= "010111010000110";
when 5177 => note <= "001111010000111";
when 5178 => note <= "000100111100011";
when 5179 => note <= "111010100000010";
when 5180 => note <= "110010001001010";
when 5181 => note <= "101101011111110";
when 5182 => note <= "101101001100110";
when 5183 => note <= "110000101111001";
when 5184 => note <= "110110100110001";
when 5185 => note <= "111100101011111";
when 5186 => note <= "000000111010011";
when 5187 => note <= "000001101111101";
when 5188 => note <= "111110101000111";
when 5189 => note <= "111000001100101";
when 5190 => note <= "110000000000000";
when 5191 => note <= "101000001100101";
when 5192 => note <= "100010111011010";
when 5193 => note <= "100001101111101";
when 5194 => note <= "100101001100110";
when 5195 => note <= "101100101011111";
when 5196 => note <= "110110100110001";
when 5197 => note <= "000000101111001";
when 5198 => note <= "001000111010011";
when 5199 => note <= "001101011111110";
when 5200 => note <= "001101110110110";
when 5201 => note <= "001010100000010";
when 5202 => note <= "000100111100011";
when 5203 => note <= "111111010000111";
when 5204 => note <= "111011100011001";
when 5205 => note <= "111011010100001";
when 5206 => note <= "111111000101101";
when 5207 => note <= "000110010000011";
when 5208 => note <= "001111001101111";
when 5209 => note <= "010111110011011";
when 5210 => note <= "011101110110110";
when 5211 => note <= "011111110011011";
when 5212 => note <= "011101000100110";
when 5213 => note <= "010110010000011";
when 5214 => note <= "001100111100011";
when 5215 => note <= "000011010100001";
when 5216 => note <= "111011100011001";
when 5217 => note <= "110111010000111";
when 5218 => note <= "110111000101101";
when 5219 => note <= "111010100000010";
when 5220 => note <= "000000000000000";
when 5221 => note <= "000101011111110";
when 5222 => note <= "001000111010011";
when 5223 => note <= "001000101111001";
when 5224 => note <= "000100011100111";
when 5225 => note <= "111100101011111";
when 5226 => note <= "110011000011101";
when 5227 => note <= "101001101111101";
when 5228 => note <= "100010111011010";
when 5229 => note <= "100000001100101";
when 5230 => note <= "100010001001010";
when 5231 => note <= "101000001100101";
when 5232 => note <= "110000110010001";
when 5233 => note <= "111001101111101";
when 5234 => note <= "000000111010011";
when 5235 => note <= "000100101011111";
when 5236 => note <= "000100011100111";
when 5237 => note <= "000000101111001";
when 5238 => note <= "111011000011101";
when 5239 => note <= "110101011111110";
when 5240 => note <= "110010001001010";
when 5241 => note <= "110010100000010";
when 5242 => note <= "110111000101101";
when 5243 => note <= "111111010000111";
when 5244 => note <= "001001011001111";
when 5245 => note <= "010011010100001";
when 5246 => note <= "011010110011010";
when 5247 => note <= "011110010000011";
when 5248 => note <= "011101000100110";
when 5249 => note <= "010111110011011";
when 5250 => note <= "010000000000000";
when 5251 => note <= "000111110011011";
when 5252 => note <= "000001010111001";
when 5253 => note <= "111110010000011";
when 5254 => note <= "111111000101101";
when 5255 => note <= "000011010100001";
when 5256 => note <= "001001011001111";
when 5257 => note <= "001111010000111";
when 5258 => note <= "010010110011010";
when 5259 => note <= "010010100000010";
when 5260 => note <= "001101110110110";
when 5261 => note <= "000101011111110";
when 5262 => note <= "111011000011101";
when 5263 => note <= "110000101111001";
when 5264 => note <= "101000101111010";
when 5265 => note <= "100100101011111";
when 5266 => note <= "100101001100110";
when 5267 => note <= "101001101111101";
when 5268 => note <= "110000110010001";
when 5269 => note <= "111000001100101";
when 5270 => note <= "111101110110110";
when 5271 => note <= "000000001100101";
when 5272 => note <= "111110101000111";
when 5273 => note <= "111001101111101";
when 5274 => note <= "110011000011101";
when 5275 => note <= "101100101011111";
when 5276 => note <= "101000101111010";
when 5277 => note <= "101000101111001";
when 5278 => note <= "101101001100110";
when 5279 => note <= "110101011111110";
when 5280 => note <= "000000000000000";
when 5281 => note <= "001010100000010";
when 5282 => note <= "010010110011010";
when 5283 => note <= "010111010000111";
when 5284 => note <= "010111010000110";
when 5285 => note <= "010011010100001";
when 5286 => note <= "001100111100011";
when 5287 => note <= "000110010000011";
when 5288 => note <= "000001010111001";
when 5289 => note <= "111111110011011";
when 5290 => note <= "000010001001010";
when 5291 => note <= "000111110011011";
when 5292 => note <= "001111001101111";
when 5293 => note <= "010110010000011";
when 5294 => note <= "011010110011010";
when 5295 => note <= "011011010100001";
when 5296 => note <= "010111010000110";
when 5297 => note <= "001111010000111";
when 5298 => note <= "000100111100011";
when 5299 => note <= "111010100000010";
when 5300 => note <= "110010001001010";
when 5301 => note <= "101101011111110";
when 5302 => note <= "101101001100110";
when 5303 => note <= "110000101111001";
when 5304 => note <= "110110100110001";
when 5305 => note <= "111100101011111";
when 5306 => note <= "000000111010011";
when 5307 => note <= "000001101111101";
when 5308 => note <= "111110101000111";
when 5309 => note <= "111000001100101";
when 5310 => note <= "110000000000000";
when 5311 => note <= "101000001100101";
when 5312 => note <= "100010111011010";
when 5313 => note <= "100001101111101";
when 5314 => note <= "100101001100110";
when 5315 => note <= "101100101011111";
when 5316 => note <= "110110100110001";
when 5317 => note <= "000000101111001";
when 5318 => note <= "001000111010011";
when 5319 => note <= "001101011111110";
when 5320 => note <= "001101110110110";
when 5321 => note <= "001010100000010";
when 5322 => note <= "000100111100011";
when 5323 => note <= "111111010000111";
when 5324 => note <= "111011100011001";
when 5325 => note <= "111011010100001";
when 5326 => note <= "111111000101101";
when 5327 => note <= "000110010000011";
when 5328 => note <= "001111001101111";
when 5329 => note <= "010111110011011";
when 5330 => note <= "011101110110110";
when 5331 => note <= "011111110011011";
when 5332 => note <= "011101000100110";
when 5333 => note <= "010110010000011";
when 5334 => note <= "001100111100011";
when 5335 => note <= "000011010100001";
when 5336 => note <= "111011100011001";
when 5337 => note <= "110111010000111";
when 5338 => note <= "110111000101101";
when 5339 => note <= "111010100000010";
when 5340 => note <= "000000000000000";
when 5341 => note <= "000101011111110";
when 5342 => note <= "001000111010011";
when 5343 => note <= "001000101111001";
when 5344 => note <= "000100011100111";
when 5345 => note <= "111100101011111";
when 5346 => note <= "110011000011101";
when 5347 => note <= "101001101111101";
when 5348 => note <= "100010111011010";
when 5349 => note <= "100000001100101";
when 5350 => note <= "100010001001010";
when 5351 => note <= "101000001100101";
when 5352 => note <= "110000110010001";
when 5353 => note <= "111001101111101";
when 5354 => note <= "000000111010011";
when 5355 => note <= "000100101011111";
when 5356 => note <= "000100011100111";
when 5357 => note <= "000000101111001";
when 5358 => note <= "111011000011101";
when 5359 => note <= "110101011111110";
when 5360 => note <= "110010001001010";
when 5361 => note <= "110010100000010";
when 5362 => note <= "110111000101101";
when 5363 => note <= "111111010000111";
when 5364 => note <= "001001011001111";
when 5365 => note <= "010011010100001";
when 5366 => note <= "011010110011010";
when 5367 => note <= "011110010000011";
when 5368 => note <= "011101000100110";
when 5369 => note <= "010111110011011";
when 5370 => note <= "010000000000000";
when 5371 => note <= "000111110011011";
when 5372 => note <= "000001010111001";
when 5373 => note <= "111110010000011";
when 5374 => note <= "111111000101101";
when 5375 => note <= "000011010100001";
when 5376 => note <= "001001011001111";
when 5377 => note <= "001111010000111";
when 5378 => note <= "010010110011010";
when 5379 => note <= "010010100000010";
when 5380 => note <= "001101110110110";
when 5381 => note <= "000101011111110";
when 5382 => note <= "111011000011101";
when 5383 => note <= "110000101111001";
when 5384 => note <= "101000101111010";
when 5385 => note <= "100100101011111";
when 5386 => note <= "100101001100110";
when 5387 => note <= "101001101111101";
when 5388 => note <= "110000110010001";
when 5389 => note <= "111000001100101";
when 5390 => note <= "111101110110110";
when 5391 => note <= "000000001100101";
when 5392 => note <= "111110101000111";
when 5393 => note <= "111001101111101";
when 5394 => note <= "110011000011101";
when 5395 => note <= "101100101011111";
when 5396 => note <= "101000101111010";
when 5397 => note <= "101000101111001";
when 5398 => note <= "101101001100110";
when 5399 => note <= "110101011111110";
when 5400 => note <= "000000000000000";
when 5401 => note <= "001010100000010";
when 5402 => note <= "010010110011010";
when 5403 => note <= "010111010000111";
when 5404 => note <= "010111010000110";
when 5405 => note <= "010011010100001";
when 5406 => note <= "001100111100011";
when 5407 => note <= "000110010000011";
when 5408 => note <= "000001010111001";
when 5409 => note <= "111111110011011";
when 5410 => note <= "000010001001010";
when 5411 => note <= "000111110011011";
when 5412 => note <= "001111001101111";
when 5413 => note <= "010110010000011";
when 5414 => note <= "011010110011010";
when 5415 => note <= "011011010100001";
when 5416 => note <= "010111010000110";
when 5417 => note <= "001111010000111";
when 5418 => note <= "000100111100011";
when 5419 => note <= "111010100000010";
when 5420 => note <= "110010001001010";
when 5421 => note <= "101101011111110";
when 5422 => note <= "101101001100110";
when 5423 => note <= "110000101111001";
when 5424 => note <= "110110100110001";
when 5425 => note <= "111100101011111";
when 5426 => note <= "000000111010011";
when 5427 => note <= "000001101111101";
when 5428 => note <= "111110101000111";
when 5429 => note <= "111000001100101";
when 5430 => note <= "110000000000000";
when 5431 => note <= "101000001100101";
when 5432 => note <= "100010111011010";
when 5433 => note <= "100001101111101";
when 5434 => note <= "100101001100110";
when 5435 => note <= "101100101011111";
when 5436 => note <= "110110100110001";
when 5437 => note <= "000000101111001";
when 5438 => note <= "001000111010011";
when 5439 => note <= "001101011111110";
when 5440 => note <= "001101110110110";
when 5441 => note <= "001010100000010";
when 5442 => note <= "000100111100011";
when 5443 => note <= "111111010000111";
when 5444 => note <= "111011100011001";
when 5445 => note <= "111011010100001";
when 5446 => note <= "111111000101101";
when 5447 => note <= "000110010000011";
when 5448 => note <= "001111001101111";
when 5449 => note <= "010111110011011";
when 5450 => note <= "011101110110110";
when 5451 => note <= "011111110011011";
when 5452 => note <= "011101000100110";
when 5453 => note <= "010110010000011";
when 5454 => note <= "001100111100011";
when 5455 => note <= "000011010100001";
when 5456 => note <= "111011100011001";
when 5457 => note <= "110111010000111";
when 5458 => note <= "110111000101101";
when 5459 => note <= "111010100000010";
when 5460 => note <= "000000000000000";
when 5461 => note <= "000101011111110";
when 5462 => note <= "001000111010011";
when 5463 => note <= "001000101111001";
when 5464 => note <= "000100011100111";
when 5465 => note <= "111100101011111";
when 5466 => note <= "110011000011101";
when 5467 => note <= "101001101111101";
when 5468 => note <= "100010111011010";
when 5469 => note <= "100000001100101";
when 5470 => note <= "100010001001010";
when 5471 => note <= "101000001100101";
when 5472 => note <= "110000110010001";
when 5473 => note <= "111001101111101";
when 5474 => note <= "000000111010011";
when 5475 => note <= "000100101011111";
when 5476 => note <= "000100011100111";
when 5477 => note <= "000000101111001";
when 5478 => note <= "111011000011101";
when 5479 => note <= "110101011111110";
when 5480 => note <= "110010001001010";
when 5481 => note <= "110010100000010";
when 5482 => note <= "110111000101101";
when 5483 => note <= "111111010000111";
when 5484 => note <= "001001011001111";
when 5485 => note <= "010011010100001";
when 5486 => note <= "011010110011010";
when 5487 => note <= "011110010000011";
when 5488 => note <= "011101000100110";
when 5489 => note <= "010111110011011";
when 5490 => note <= "010000000000000";
when 5491 => note <= "000111110011011";
when 5492 => note <= "000001010111001";
when 5493 => note <= "111110010000011";
when 5494 => note <= "111111000101101";
when 5495 => note <= "000011010100001";
when 5496 => note <= "001001011001111";
when 5497 => note <= "001111010000111";
when 5498 => note <= "010010110011010";
when 5499 => note <= "010010100000010";
when 5500 => note <= "001101110110110";
when 5501 => note <= "000101011111110";
when 5502 => note <= "111011000011101";
when 5503 => note <= "110000101111001";
when 5504 => note <= "101000101111010";
when 5505 => note <= "100100101011111";
when 5506 => note <= "100101001100110";
when 5507 => note <= "101001101111101";
when 5508 => note <= "110000110010001";
when 5509 => note <= "111000001100101";
when 5510 => note <= "111101110110110";
when 5511 => note <= "000000001100101";
when 5512 => note <= "111110101000111";
when 5513 => note <= "111001101111101";
when 5514 => note <= "110011000011101";
when 5515 => note <= "101100101011111";
when 5516 => note <= "101000101111010";
when 5517 => note <= "101000101111001";
when 5518 => note <= "101101001100110";
when 5519 => note <= "110101011111110";
when 5520 => note <= "000000000000000";
when 5521 => note <= "001010100000010";
when 5522 => note <= "010010110011010";
when 5523 => note <= "010111010000111";
when 5524 => note <= "010111010000110";
when 5525 => note <= "010011010100001";
when 5526 => note <= "001100111100011";
when 5527 => note <= "000110010000011";
when 5528 => note <= "000001010111001";
when 5529 => note <= "111111110011011";
when 5530 => note <= "000010001001010";
when 5531 => note <= "000111110011011";
when 5532 => note <= "001111001101111";
when 5533 => note <= "010110010000011";
when 5534 => note <= "011010110011010";
when 5535 => note <= "011011010100001";
when 5536 => note <= "010111010000110";
when 5537 => note <= "001111010000111";
when 5538 => note <= "000100111100011";
when 5539 => note <= "111010100000010";
when 5540 => note <= "110010001001010";
when 5541 => note <= "101101011111110";
when 5542 => note <= "101101001100110";
when 5543 => note <= "110000101111001";
when 5544 => note <= "110110100110001";
when 5545 => note <= "111100101011111";
when 5546 => note <= "000000111010011";
when 5547 => note <= "000001101111101";
when 5548 => note <= "111110101000111";
when 5549 => note <= "111000001100101";
when 5550 => note <= "110000000000000";
when 5551 => note <= "101000001100101";
when 5552 => note <= "100010111011010";
when 5553 => note <= "100001101111101";
when 5554 => note <= "100101001100110";
when 5555 => note <= "101100101011111";
when 5556 => note <= "110110100110001";
when 5557 => note <= "000000101111001";
when 5558 => note <= "001000111010011";
when 5559 => note <= "001101011111110";
when 5560 => note <= "001101110110110";
when 5561 => note <= "001010100000010";
when 5562 => note <= "000100111100011";
when 5563 => note <= "111111010000111";
when 5564 => note <= "111011100011001";
when 5565 => note <= "111011010100001";
when 5566 => note <= "111111000101101";
when 5567 => note <= "000110010000011";
when 5568 => note <= "001111001101111";
when 5569 => note <= "010111110011011";
when 5570 => note <= "011101110110110";
when 5571 => note <= "011111110011011";
when 5572 => note <= "011101000100110";
when 5573 => note <= "010110010000011";
when 5574 => note <= "001100111100011";
when 5575 => note <= "000011010100001";
when 5576 => note <= "111011100011001";
when 5577 => note <= "110111010000111";
when 5578 => note <= "110111000101101";
when 5579 => note <= "111010100000010";
when 5580 => note <= "000000000000000";
when 5581 => note <= "000101011111110";
when 5582 => note <= "001000111010011";
when 5583 => note <= "001000101111001";
when 5584 => note <= "000100011100111";
when 5585 => note <= "111100101011111";
when 5586 => note <= "110011000011101";
when 5587 => note <= "101001101111101";
when 5588 => note <= "100010111011010";
when 5589 => note <= "100000001100101";
when 5590 => note <= "100010001001010";
when 5591 => note <= "101000001100101";
when 5592 => note <= "110000110010001";
when 5593 => note <= "111001101111101";
when 5594 => note <= "000000111010011";
when 5595 => note <= "000100101011111";
when 5596 => note <= "000100011100111";
when 5597 => note <= "000000101111001";
when 5598 => note <= "111011000011101";
when 5599 => note <= "110101011111110";
when 5600 => note <= "110010001001010";
when 5601 => note <= "110010100000010";
when 5602 => note <= "110111000101101";
when 5603 => note <= "111111010000111";
when 5604 => note <= "001001011001111";
when 5605 => note <= "010011010100001";
when 5606 => note <= "011010110011010";
when 5607 => note <= "011110010000011";
when 5608 => note <= "011101000100110";
when 5609 => note <= "010111110011011";
when 5610 => note <= "010000000000000";
when 5611 => note <= "000111110011011";
when 5612 => note <= "000001010111001";
when 5613 => note <= "111110010000011";
when 5614 => note <= "111111000101101";
when 5615 => note <= "000011010100001";
when 5616 => note <= "001001011001111";
when 5617 => note <= "001111010000111";
when 5618 => note <= "010010110011010";
when 5619 => note <= "010010100000010";
when 5620 => note <= "001101110110110";
when 5621 => note <= "000101011111110";
when 5622 => note <= "111011000011101";
when 5623 => note <= "110000101111001";
when 5624 => note <= "101000101111010";
when 5625 => note <= "100100101011111";
when 5626 => note <= "100101001100110";
when 5627 => note <= "101001101111101";
when 5628 => note <= "110000110010001";
when 5629 => note <= "111000001100101";
when 5630 => note <= "111101110110110";
when 5631 => note <= "000000001100101";
when 5632 => note <= "111110101000111";
when 5633 => note <= "111001101111101";
when 5634 => note <= "110011000011101";
when 5635 => note <= "101100101011111";
when 5636 => note <= "101000101111010";
when 5637 => note <= "101000101111001";
when 5638 => note <= "101101001100110";
when 5639 => note <= "110101011111110";
when 5640 => note <= "000000000000000";
when 5641 => note <= "001010100000010";
when 5642 => note <= "010010110011010";
when 5643 => note <= "010111010000111";
when 5644 => note <= "010111010000110";
when 5645 => note <= "010011010100001";
when 5646 => note <= "001100111100011";
when 5647 => note <= "000110010000011";
when 5648 => note <= "000001010111001";
when 5649 => note <= "111111110011011";
when 5650 => note <= "000010001001010";
when 5651 => note <= "000111110011011";
when 5652 => note <= "001111001101111";
when 5653 => note <= "010110010000011";
when 5654 => note <= "011010110011010";
when 5655 => note <= "011011010100001";
when 5656 => note <= "010111010000110";
when 5657 => note <= "001111010000111";
when 5658 => note <= "000100111100011";
when 5659 => note <= "111010100000010";
when 5660 => note <= "110010001001010";
when 5661 => note <= "101101011111110";
when 5662 => note <= "101101001100110";
when 5663 => note <= "110000101111001";
when 5664 => note <= "110110100110001";
when 5665 => note <= "111100101011111";
when 5666 => note <= "000000111010011";
when 5667 => note <= "000001101111101";
when 5668 => note <= "111110101000111";
when 5669 => note <= "111000001100101";
when 5670 => note <= "110000000000000";
when 5671 => note <= "101000001100101";
when 5672 => note <= "100010111011010";
when 5673 => note <= "100001101111101";
when 5674 => note <= "100101001100110";
when 5675 => note <= "101100101011111";
when 5676 => note <= "110110100110001";
when 5677 => note <= "000000101111001";
when 5678 => note <= "001000111010011";
when 5679 => note <= "001101011111110";
when 5680 => note <= "001101110110110";
when 5681 => note <= "001010100000010";
when 5682 => note <= "000100111100011";
when 5683 => note <= "111111010000111";
when 5684 => note <= "111011100011001";
when 5685 => note <= "111011010100001";
when 5686 => note <= "111111000101101";
when 5687 => note <= "000110010000011";
when 5688 => note <= "001111001101111";
when 5689 => note <= "010111110011011";
when 5690 => note <= "011101110110110";
when 5691 => note <= "011111110011011";
when 5692 => note <= "011101000100110";
when 5693 => note <= "010110010000011";
when 5694 => note <= "001100111100011";
when 5695 => note <= "000011010100001";
when 5696 => note <= "111011100011001";
when 5697 => note <= "110111010000111";
when 5698 => note <= "110111000101101";
when 5699 => note <= "111010100000010";
when 5700 => note <= "000000000000000";
when 5701 => note <= "000101011111110";
when 5702 => note <= "001000111010011";
when 5703 => note <= "001000101111001";
when 5704 => note <= "000100011100111";
when 5705 => note <= "111100101011111";
when 5706 => note <= "110011000011101";
when 5707 => note <= "101001101111101";
when 5708 => note <= "100010111011010";
when 5709 => note <= "100000001100101";
when 5710 => note <= "100010001001010";
when 5711 => note <= "101000001100101";
when 5712 => note <= "110000110010001";
when 5713 => note <= "111001101111101";
when 5714 => note <= "000000111010011";
when 5715 => note <= "000100101011111";
when 5716 => note <= "000100011100111";
when 5717 => note <= "000000101111001";
when 5718 => note <= "111011000011101";
when 5719 => note <= "110101011111110";
when 5720 => note <= "110010001001010";
when 5721 => note <= "110010100000010";
when 5722 => note <= "110111000101101";
when 5723 => note <= "111111010000111";
when 5724 => note <= "001001011001111";
when 5725 => note <= "010011010100001";
when 5726 => note <= "011010110011010";
when 5727 => note <= "011110010000011";
when 5728 => note <= "011101000100110";
when 5729 => note <= "010111110011011";
when 5730 => note <= "010000000000000";
when 5731 => note <= "000111110011011";
when 5732 => note <= "000001010111001";
when 5733 => note <= "111110010000011";
when 5734 => note <= "111111000101101";
when 5735 => note <= "000011010100001";
when 5736 => note <= "001001011001111";
when 5737 => note <= "001111010000111";
when 5738 => note <= "010010110011010";
when 5739 => note <= "010010100000010";
when 5740 => note <= "001101110110110";
when 5741 => note <= "000101011111110";
when 5742 => note <= "111011000011101";
when 5743 => note <= "110000101111001";
when 5744 => note <= "101000101111010";
when 5745 => note <= "100100101011111";
when 5746 => note <= "100101001100110";
when 5747 => note <= "101001101111101";
when 5748 => note <= "110000110010001";
when 5749 => note <= "111000001100101";
when 5750 => note <= "111101110110110";
when 5751 => note <= "000000001100101";
when 5752 => note <= "111110101000111";
when 5753 => note <= "111001101111101";
when 5754 => note <= "110011000011101";
when 5755 => note <= "101100101011111";
when 5756 => note <= "101000101111010";
when 5757 => note <= "101000101111001";
when 5758 => note <= "101101001100110";
when 5759 => note <= "110101011111110";
when 5760 => note <= "000000000000000";
when 5761 => note <= "001010100000010";
when 5762 => note <= "010010110011010";
when 5763 => note <= "010111010000111";
when 5764 => note <= "010111010000110";
when 5765 => note <= "010011010100001";
when 5766 => note <= "001100111100011";
when 5767 => note <= "000110010000011";
when 5768 => note <= "000001010111001";
when 5769 => note <= "111111110011011";
when 5770 => note <= "000010001001010";
when 5771 => note <= "000111110011011";
when 5772 => note <= "001111001101111";
when 5773 => note <= "010110010000011";
when 5774 => note <= "011010110011010";
when 5775 => note <= "011011010100001";
when 5776 => note <= "010111010000110";
when 5777 => note <= "001111010000111";
when 5778 => note <= "000100111100011";
when 5779 => note <= "111010100000010";
when 5780 => note <= "110010001001010";
when 5781 => note <= "101101011111110";
when 5782 => note <= "101101001100110";
when 5783 => note <= "110000101111001";
when 5784 => note <= "110110100110001";
when 5785 => note <= "111100101011111";
when 5786 => note <= "000000111010011";
when 5787 => note <= "000001101111101";
when 5788 => note <= "111110101000111";
when 5789 => note <= "111000001100101";
when 5790 => note <= "110000000000000";
when 5791 => note <= "101000001100101";
when 5792 => note <= "100010111011010";
when 5793 => note <= "100001101111101";
when 5794 => note <= "100101001100110";
when 5795 => note <= "101100101011111";
when 5796 => note <= "110110100110001";
when 5797 => note <= "000000101111001";
when 5798 => note <= "001000111010011";
when 5799 => note <= "001101011111110";
when 5800 => note <= "001101110110110";
when 5801 => note <= "001010100000010";
when 5802 => note <= "000100111100011";
when 5803 => note <= "111111010000111";
when 5804 => note <= "111011100011001";
when 5805 => note <= "111011010100001";
when 5806 => note <= "111111000101101";
when 5807 => note <= "000110010000011";
when 5808 => note <= "001111001101111";
when 5809 => note <= "010111110011011";
when 5810 => note <= "011101110110110";
when 5811 => note <= "011111110011011";
when 5812 => note <= "011101000100110";
when 5813 => note <= "010110010000011";
when 5814 => note <= "001100111100011";
when 5815 => note <= "000011010100001";
when 5816 => note <= "111011100011001";
when 5817 => note <= "110111010000111";
when 5818 => note <= "110111000101101";
when 5819 => note <= "111010100000010";
when 5820 => note <= "000000000000000";
when 5821 => note <= "000101011111110";
when 5822 => note <= "001000111010011";
when 5823 => note <= "001000101111001";
when 5824 => note <= "000100011100111";
when 5825 => note <= "111100101011111";
when 5826 => note <= "110011000011101";
when 5827 => note <= "101001101111101";
when 5828 => note <= "100010111011010";
when 5829 => note <= "100000001100101";
when 5830 => note <= "100010001001010";
when 5831 => note <= "101000001100101";
when 5832 => note <= "110000110010001";
when 5833 => note <= "111001101111101";
when 5834 => note <= "000000111010011";
when 5835 => note <= "000100101011111";
when 5836 => note <= "000100011100111";
when 5837 => note <= "000000101111001";
when 5838 => note <= "111011000011101";
when 5839 => note <= "110101011111110";
when 5840 => note <= "110010001001010";
when 5841 => note <= "110010100000010";
when 5842 => note <= "110111000101101";
when 5843 => note <= "111111010000111";
when 5844 => note <= "001001011001111";
when 5845 => note <= "010011010100001";
when 5846 => note <= "011010110011010";
when 5847 => note <= "011110010000011";
when 5848 => note <= "011101000100110";
when 5849 => note <= "010111110011011";
when 5850 => note <= "010000000000000";
when 5851 => note <= "000111110011011";
when 5852 => note <= "000001010111001";
when 5853 => note <= "111110010000011";
when 5854 => note <= "111111000101101";
when 5855 => note <= "000011010100001";
when 5856 => note <= "001001011001111";
when 5857 => note <= "001111010000111";
when 5858 => note <= "010010110011010";
when 5859 => note <= "010010100000010";
when 5860 => note <= "001101110110110";
when 5861 => note <= "000101011111110";
when 5862 => note <= "111011000011101";
when 5863 => note <= "110000101111001";
when 5864 => note <= "101000101111010";
when 5865 => note <= "100100101011111";
when 5866 => note <= "100101001100110";
when 5867 => note <= "101001101111101";
when 5868 => note <= "110000110010001";
when 5869 => note <= "111000001100101";
when 5870 => note <= "111101110110110";
when 5871 => note <= "000000001100101";
when 5872 => note <= "111110101000111";
when 5873 => note <= "111001101111101";
when 5874 => note <= "110011000011101";
when 5875 => note <= "101100101011111";
when 5876 => note <= "101000101111010";
when 5877 => note <= "101000101111001";
when 5878 => note <= "101101001100110";
when 5879 => note <= "110101011111110";
when 5880 => note <= "000000000000000";
when 5881 => note <= "001010100000010";
when 5882 => note <= "010010110011010";
when 5883 => note <= "010111010000111";
when 5884 => note <= "010111010000110";
when 5885 => note <= "010011010100001";
when 5886 => note <= "001100111100011";
when 5887 => note <= "000110010000011";
when 5888 => note <= "000001010111001";
when 5889 => note <= "111111110011011";
when 5890 => note <= "000010001001010";
when 5891 => note <= "000111110011011";
when 5892 => note <= "001111001101111";
when 5893 => note <= "010110010000011";
when 5894 => note <= "011010110011010";
when 5895 => note <= "011011010100001";
when 5896 => note <= "010111010000110";
when 5897 => note <= "001111010000111";
when 5898 => note <= "000100111100011";
when 5899 => note <= "111010100000010";
when 5900 => note <= "110010001001010";
when 5901 => note <= "101101011111110";
when 5902 => note <= "101101001100110";
when 5903 => note <= "110000101111001";
when 5904 => note <= "110110100110001";
when 5905 => note <= "111100101011111";
when 5906 => note <= "000000111010011";
when 5907 => note <= "000001101111101";
when 5908 => note <= "111110101000111";
when 5909 => note <= "111000001100101";
when 5910 => note <= "110000000000000";
when 5911 => note <= "101000001100101";
when 5912 => note <= "100010111011010";
when 5913 => note <= "100001101111101";
when 5914 => note <= "100101001100110";
when 5915 => note <= "101100101011111";
when 5916 => note <= "110110100110001";
when 5917 => note <= "000000101111001";
when 5918 => note <= "001000111010011";
when 5919 => note <= "001101011111110";
when 5920 => note <= "001101110110110";
when 5921 => note <= "001010100000010";
when 5922 => note <= "000100111100011";
when 5923 => note <= "111111010000111";
when 5924 => note <= "111011100011001";
when 5925 => note <= "111011010100001";
when 5926 => note <= "111111000101101";
when 5927 => note <= "000110010000011";
when 5928 => note <= "001111001101111";
when 5929 => note <= "010111110011011";
when 5930 => note <= "011101110110110";
when 5931 => note <= "011111110011011";
when 5932 => note <= "011101000100110";
when 5933 => note <= "010110010000011";
when 5934 => note <= "001100111100011";
when 5935 => note <= "000011010100001";
when 5936 => note <= "111011100011001";
when 5937 => note <= "110111010000111";
when 5938 => note <= "110111000101101";
when 5939 => note <= "111010100000010";
when 5940 => note <= "000000000000000";
when 5941 => note <= "000101011111110";
when 5942 => note <= "001000111010011";
when 5943 => note <= "001000101111001";
when 5944 => note <= "000100011100111";
when 5945 => note <= "111100101011111";
when 5946 => note <= "110011000011101";
when 5947 => note <= "101001101111101";
when 5948 => note <= "100010111011010";
when 5949 => note <= "100000001100101";
when 5950 => note <= "100010001001010";
when 5951 => note <= "101000001100101";
when 5952 => note <= "110000110010001";
when 5953 => note <= "111001101111101";
when 5954 => note <= "000000111010011";
when 5955 => note <= "000100101011111";
when 5956 => note <= "000100011100111";
when 5957 => note <= "000000101111001";
when 5958 => note <= "111011000011101";
when 5959 => note <= "110101011111110";
when 5960 => note <= "110010001001010";
when 5961 => note <= "110010100000010";
when 5962 => note <= "110111000101101";
when 5963 => note <= "111111010000111";
when 5964 => note <= "001001011001111";
when 5965 => note <= "010011010100001";
when 5966 => note <= "011010110011010";
when 5967 => note <= "011110010000011";
when 5968 => note <= "011101000100110";
when 5969 => note <= "010111110011011";
when 5970 => note <= "010000000000000";
when 5971 => note <= "000111110011011";
when 5972 => note <= "000001010111001";
when 5973 => note <= "111110010000011";
when 5974 => note <= "111111000101101";
when 5975 => note <= "000011010100001";
when 5976 => note <= "001001011001111";
when 5977 => note <= "001111010000111";
when 5978 => note <= "010010110011010";
when 5979 => note <= "010010100000010";
when 5980 => note <= "001101110110110";
when 5981 => note <= "000101011111110";
when 5982 => note <= "111011000011101";
when 5983 => note <= "110000101111001";
when 5984 => note <= "101000101111010";
when 5985 => note <= "100100101011111";
when 5986 => note <= "100101001100110";
when 5987 => note <= "101001101111101";
when 5988 => note <= "110000110010001";
when 5989 => note <= "111000001100101";
when 5990 => note <= "111101110110110";
when 5991 => note <= "000000001100101";
when 5992 => note <= "111110101000111";
when 5993 => note <= "111001101111101";
when 5994 => note <= "110011000011101";
when 5995 => note <= "101100101011111";
when 5996 => note <= "101000101111010";
when 5997 => note <= "101000101111001";
when 5998 => note <= "101101001100110";
when 5999 => note <= "110101011111110";
when 6000 => note <= "000000000000000";
when 6001 => note <= "001010100000010";
when 6002 => note <= "010010110011010";
when 6003 => note <= "010111010000111";
when 6004 => note <= "010111010000110";
when 6005 => note <= "010011010100001";
when 6006 => note <= "001100111100011";
when 6007 => note <= "000110010000011";
when 6008 => note <= "000001010111001";
when 6009 => note <= "111111110011011";
when 6010 => note <= "000010001001010";
when 6011 => note <= "000111110011011";
when 6012 => note <= "001111001101111";
when 6013 => note <= "010110010000011";
when 6014 => note <= "011010110011010";
when 6015 => note <= "011011010100001";
when 6016 => note <= "010111010000110";
when 6017 => note <= "001111010000111";
when 6018 => note <= "000100111100011";
when 6019 => note <= "111010100000010";
when 6020 => note <= "110010001001010";
when 6021 => note <= "101101011111110";
when 6022 => note <= "101101001100110";
when 6023 => note <= "110000101111001";
when 6024 => note <= "110110100110001";
when 6025 => note <= "111100101011111";
when 6026 => note <= "000000111010011";
when 6027 => note <= "000001101111101";
when 6028 => note <= "111110101000111";
when 6029 => note <= "111000001100101";
when 6030 => note <= "110000000000000";
when 6031 => note <= "101000001100101";
when 6032 => note <= "100010111011010";
when 6033 => note <= "100001101111101";
when 6034 => note <= "100101001100110";
when 6035 => note <= "101100101011111";
when 6036 => note <= "110110100110001";
when 6037 => note <= "000000101111001";
when 6038 => note <= "001000111010011";
when 6039 => note <= "001101011111110";
when 6040 => note <= "001101110110110";
when 6041 => note <= "001010100000010";
when 6042 => note <= "000100111100011";
when 6043 => note <= "111111010000111";
when 6044 => note <= "111011100011001";
when 6045 => note <= "111011010100001";
when 6046 => note <= "111111000101101";
when 6047 => note <= "000110010000011";
when 6048 => note <= "001111001101111";
when 6049 => note <= "010111110011011";
when 6050 => note <= "011101110110110";
when 6051 => note <= "011111110011011";
when 6052 => note <= "011101000100110";
when 6053 => note <= "010110010000011";
when 6054 => note <= "001100111100011";
when 6055 => note <= "000011010100001";
when 6056 => note <= "111011100011001";
when 6057 => note <= "110111010000111";
when 6058 => note <= "110111000101101";
when 6059 => note <= "111010100000010";
when 6060 => note <= "000000000000000";
when 6061 => note <= "000101011111110";
when 6062 => note <= "001000111010011";
when 6063 => note <= "001000101111001";
when 6064 => note <= "000100011100111";
when 6065 => note <= "111100101011111";
when 6066 => note <= "110011000011101";
when 6067 => note <= "101001101111101";
when 6068 => note <= "100010111011010";
when 6069 => note <= "100000001100101";
when 6070 => note <= "100010001001010";
when 6071 => note <= "101000001100101";
when 6072 => note <= "110000110010001";
when 6073 => note <= "111001101111101";
when 6074 => note <= "000000111010011";
when 6075 => note <= "000100101011111";
when 6076 => note <= "000100011100111";
when 6077 => note <= "000000101111001";
when 6078 => note <= "111011000011101";
when 6079 => note <= "110101011111110";
when 6080 => note <= "110010001001010";
when 6081 => note <= "110010100000010";
when 6082 => note <= "110111000101101";
when 6083 => note <= "111111010000111";
when 6084 => note <= "001001011001111";
when 6085 => note <= "010011010100001";
when 6086 => note <= "011010110011010";
when 6087 => note <= "011110010000011";
when 6088 => note <= "011101000100110";
when 6089 => note <= "010111110011011";
when 6090 => note <= "010000000000000";
when 6091 => note <= "000111110011011";
when 6092 => note <= "000001010111001";
when 6093 => note <= "111110010000011";
when 6094 => note <= "111111000101101";
when 6095 => note <= "000011010100001";
when 6096 => note <= "001001011001111";
when 6097 => note <= "001111010000111";
when 6098 => note <= "010010110011010";
when 6099 => note <= "010010100000010";
when 6100 => note <= "001101110110110";
when 6101 => note <= "000101011111110";
when 6102 => note <= "111011000011101";
when 6103 => note <= "110000101111001";
when 6104 => note <= "101000101111010";
when 6105 => note <= "100100101011111";
when 6106 => note <= "100101001100110";
when 6107 => note <= "101001101111101";
when 6108 => note <= "110000110010001";
when 6109 => note <= "111000001100101";
when 6110 => note <= "111101110110110";
when 6111 => note <= "000000001100101";
when 6112 => note <= "111110101000111";
when 6113 => note <= "111001101111101";
when 6114 => note <= "110011000011101";
when 6115 => note <= "101100101011111";
when 6116 => note <= "101000101111010";
when 6117 => note <= "101000101111001";
when 6118 => note <= "101101001100110";
when 6119 => note <= "110101011111110";
when 6120 => note <= "000000000000000";
when 6121 => note <= "001010100000010";
when 6122 => note <= "010010110011010";
when 6123 => note <= "010111010000111";
when 6124 => note <= "010111010000110";
when 6125 => note <= "010011010100001";
when 6126 => note <= "001100111100011";
when 6127 => note <= "000110010000011";
when 6128 => note <= "000001010111001";
when 6129 => note <= "111111110011011";
when 6130 => note <= "000010001001010";
when 6131 => note <= "000111110011011";
when 6132 => note <= "001111001101111";
when 6133 => note <= "010110010000011";
when 6134 => note <= "011010110011010";
when 6135 => note <= "011011010100001";
when 6136 => note <= "010111010000110";
when 6137 => note <= "001111010000111";
when 6138 => note <= "000100111100011";
when 6139 => note <= "111010100000010";
when 6140 => note <= "110010001001010";
when 6141 => note <= "101101011111110";
when 6142 => note <= "101101001100110";
when 6143 => note <= "110000101111001";
when 6144 => note <= "110110100110001";
when 6145 => note <= "111100101011111";
when 6146 => note <= "000000111010011";
when 6147 => note <= "000001101111101";
when 6148 => note <= "111110101000111";
when 6149 => note <= "111000001100101";
when 6150 => note <= "110000000000000";
when 6151 => note <= "101000001100101";
when 6152 => note <= "100010111011010";
when 6153 => note <= "100001101111101";
when 6154 => note <= "100101001100110";
when 6155 => note <= "101100101011111";
when 6156 => note <= "110110100110001";
when 6157 => note <= "000000101111001";
when 6158 => note <= "001000111010011";
when 6159 => note <= "001101011111110";
when 6160 => note <= "001101110110110";
when 6161 => note <= "001010100000010";
when 6162 => note <= "000100111100011";
when 6163 => note <= "111111010000111";
when 6164 => note <= "111011100011001";
when 6165 => note <= "111011010100001";
when 6166 => note <= "111111000101101";
when 6167 => note <= "000110010000011";
when 6168 => note <= "001111001101111";
when 6169 => note <= "010111110011011";
when 6170 => note <= "011101110110110";
when 6171 => note <= "011111110011011";
when 6172 => note <= "011101000100110";
when 6173 => note <= "010110010000011";
when 6174 => note <= "001100111100011";
when 6175 => note <= "000011010100001";
when 6176 => note <= "111011100011001";
when 6177 => note <= "110111010000111";
when 6178 => note <= "110111000101101";
when 6179 => note <= "111010100000010";
when 6180 => note <= "000000000000000";
when 6181 => note <= "000101011111110";
when 6182 => note <= "001000111010011";
when 6183 => note <= "001000101111001";
when 6184 => note <= "000100011100111";
when 6185 => note <= "111100101011111";
when 6186 => note <= "110011000011101";
when 6187 => note <= "101001101111101";
when 6188 => note <= "100010111011010";
when 6189 => note <= "100000001100101";
when 6190 => note <= "100010001001010";
when 6191 => note <= "101000001100101";
when 6192 => note <= "110000110010001";
when 6193 => note <= "111001101111101";
when 6194 => note <= "000000111010011";
when 6195 => note <= "000100101011111";
when 6196 => note <= "000100011100111";
when 6197 => note <= "000000101111001";
when 6198 => note <= "111011000011101";
when 6199 => note <= "110101011111110";
when 6200 => note <= "110010001001010";
when 6201 => note <= "110010100000010";
when 6202 => note <= "110111000101101";
when 6203 => note <= "111111010000111";
when 6204 => note <= "001001011001111";
when 6205 => note <= "010011010100001";
when 6206 => note <= "011010110011010";
when 6207 => note <= "011110010000011";
when 6208 => note <= "011101000100110";
when 6209 => note <= "010111110011011";
when 6210 => note <= "010000000000000";
when 6211 => note <= "000111110011011";
when 6212 => note <= "000001010111001";
when 6213 => note <= "111110010000011";
when 6214 => note <= "111111000101101";
when 6215 => note <= "000011010100001";
when 6216 => note <= "001001011001111";
when 6217 => note <= "001111010000111";
when 6218 => note <= "010010110011010";
when 6219 => note <= "010010100000010";
when 6220 => note <= "001101110110110";
when 6221 => note <= "000101011111110";
when 6222 => note <= "111011000011101";
when 6223 => note <= "110000101111001";
when 6224 => note <= "101000101111010";
when 6225 => note <= "100100101011111";
when 6226 => note <= "100101001100110";
when 6227 => note <= "101001101111101";
when 6228 => note <= "110000110010001";
when 6229 => note <= "111000001100101";
when 6230 => note <= "111101110110110";
when 6231 => note <= "000000001100101";
when 6232 => note <= "111110101000111";
when 6233 => note <= "111001101111101";
when 6234 => note <= "110011000011101";
when 6235 => note <= "101100101011111";
when 6236 => note <= "101000101111010";
when 6237 => note <= "101000101111001";
when 6238 => note <= "101101001100110";
when 6239 => note <= "110101011111110";
when 6240 => note <= "000000000000000";
when 6241 => note <= "001010100000010";
when 6242 => note <= "010010110011010";
when 6243 => note <= "010111010000111";
when 6244 => note <= "010111010000110";
when 6245 => note <= "010011010100001";
when 6246 => note <= "001100111100011";
when 6247 => note <= "000110010000011";
when 6248 => note <= "000001010111001";
when 6249 => note <= "111111110011011";
when 6250 => note <= "000010001001010";
when 6251 => note <= "000111110011011";
when 6252 => note <= "001111001101111";
when 6253 => note <= "010110010000011";
when 6254 => note <= "011010110011010";
when 6255 => note <= "011011010100001";
when 6256 => note <= "010111010000110";
when 6257 => note <= "001111010000111";
when 6258 => note <= "000100111100011";
when 6259 => note <= "111010100000010";
when 6260 => note <= "110010001001010";
when 6261 => note <= "101101011111110";
when 6262 => note <= "101101001100110";
when 6263 => note <= "110000101111001";
when 6264 => note <= "110110100110001";
when 6265 => note <= "111100101011111";
when 6266 => note <= "000000111010011";
when 6267 => note <= "000001101111101";
when 6268 => note <= "111110101000111";
when 6269 => note <= "111000001100101";
when 6270 => note <= "110000000000000";
when 6271 => note <= "101000001100101";
when 6272 => note <= "100010111011010";
when 6273 => note <= "100001101111101";
when 6274 => note <= "100101001100110";
when 6275 => note <= "101100101011111";
when 6276 => note <= "110110100110001";
when 6277 => note <= "000000101111001";
when 6278 => note <= "001000111010011";
when 6279 => note <= "001101011111110";
when 6280 => note <= "001101110110110";
when 6281 => note <= "001010100000010";
when 6282 => note <= "000100111100011";
when 6283 => note <= "111111010000111";
when 6284 => note <= "111011100011001";
when 6285 => note <= "111011010100001";
when 6286 => note <= "111111000101101";
when 6287 => note <= "000110010000011";
when 6288 => note <= "001111001101111";
when 6289 => note <= "010111110011011";
when 6290 => note <= "011101110110110";
when 6291 => note <= "011111110011011";
when 6292 => note <= "011101000100110";
when 6293 => note <= "010110010000011";
when 6294 => note <= "001100111100011";
when 6295 => note <= "000011010100001";
when 6296 => note <= "111011100011001";
when 6297 => note <= "110111010000111";
when 6298 => note <= "110111000101101";
when 6299 => note <= "111010100000010";
when 6300 => note <= "000000000000000";
when 6301 => note <= "000101011111110";
when 6302 => note <= "001000111010011";
when 6303 => note <= "001000101111001";
when 6304 => note <= "000100011100111";
when 6305 => note <= "111100101011111";
when 6306 => note <= "110011000011101";
when 6307 => note <= "101001101111101";
when 6308 => note <= "100010111011010";
when 6309 => note <= "100000001100101";
when 6310 => note <= "100010001001010";
when 6311 => note <= "101000001100101";
when 6312 => note <= "110000110010001";
when 6313 => note <= "111001101111101";
when 6314 => note <= "000000111010011";
when 6315 => note <= "000100101011111";
when 6316 => note <= "000100011100111";
when 6317 => note <= "000000101111001";
when 6318 => note <= "111011000011101";
when 6319 => note <= "110101011111110";
when 6320 => note <= "110010001001010";
when 6321 => note <= "110010100000010";
when 6322 => note <= "110111000101101";
when 6323 => note <= "111111010000111";
when 6324 => note <= "001001011001111";
when 6325 => note <= "010011010100001";
when 6326 => note <= "011010110011010";
when 6327 => note <= "011110010000011";
when 6328 => note <= "011101000100110";
when 6329 => note <= "010111110011011";
when 6330 => note <= "010000000000000";
when 6331 => note <= "000111110011011";
when 6332 => note <= "000001010111001";
when 6333 => note <= "111110010000011";
when 6334 => note <= "111111000101101";
when 6335 => note <= "000011010100001";
when 6336 => note <= "001001011001111";
when 6337 => note <= "001111010000111";
when 6338 => note <= "010010110011010";
when 6339 => note <= "010010100000010";
when 6340 => note <= "001101110110110";
when 6341 => note <= "000101011111110";
when 6342 => note <= "111011000011101";
when 6343 => note <= "110000101111001";
when 6344 => note <= "101000101111010";
when 6345 => note <= "100100101011111";
when 6346 => note <= "100101001100110";
when 6347 => note <= "101001101111101";
when 6348 => note <= "110000110010001";
when 6349 => note <= "111000001100101";
when 6350 => note <= "111101110110110";
when 6351 => note <= "000000001100101";
when 6352 => note <= "111110101000111";
when 6353 => note <= "111001101111101";
when 6354 => note <= "110011000011101";
when 6355 => note <= "101100101011111";
when 6356 => note <= "101000101111010";
when 6357 => note <= "101000101111001";
when 6358 => note <= "101101001100110";
when 6359 => note <= "110101011111110";
when 6360 => note <= "000000000000000";
when 6361 => note <= "001010100000010";
when 6362 => note <= "010010110011010";
when 6363 => note <= "010111010000111";
when 6364 => note <= "010111010000110";
when 6365 => note <= "010011010100001";
when 6366 => note <= "001100111100011";
when 6367 => note <= "000110010000011";
when 6368 => note <= "000001010111001";
when 6369 => note <= "111111110011011";
when 6370 => note <= "000010001001010";
when 6371 => note <= "000111110011011";
when 6372 => note <= "001111001101111";
when 6373 => note <= "010110010000011";
when 6374 => note <= "011010110011010";
when 6375 => note <= "011011010100001";
when 6376 => note <= "010111010000110";
when 6377 => note <= "001111010000111";
when 6378 => note <= "000100111100011";
when 6379 => note <= "111010100000010";
when 6380 => note <= "110010001001010";
when 6381 => note <= "101101011111110";
when 6382 => note <= "101101001100110";
when 6383 => note <= "110000101111001";
when 6384 => note <= "110110100110001";
when 6385 => note <= "111100101011111";
when 6386 => note <= "000000111010011";
when 6387 => note <= "000001101111101";
when 6388 => note <= "111110101000111";
when 6389 => note <= "111000001100101";
when 6390 => note <= "110000000000000";
when 6391 => note <= "101000001100101";
when 6392 => note <= "100010111011010";
when 6393 => note <= "100001101111101";
when 6394 => note <= "100101001100110";
when 6395 => note <= "101100101011111";
when 6396 => note <= "110110100110001";
when 6397 => note <= "000000101111001";
when 6398 => note <= "001000111010011";
when 6399 => note <= "001101011111110";
when 6400 => note <= "001101110110110";
when 6401 => note <= "001010100000010";
when 6402 => note <= "000100111100011";
when 6403 => note <= "111111010000111";
when 6404 => note <= "111011100011001";
when 6405 => note <= "111011010100001";
when 6406 => note <= "111111000101101";
when 6407 => note <= "000110010000011";
when 6408 => note <= "001111001101111";
when 6409 => note <= "010111110011011";
when 6410 => note <= "011101110110110";
when 6411 => note <= "011111110011011";
when 6412 => note <= "011101000100110";
when 6413 => note <= "010110010000011";
when 6414 => note <= "001100111100011";
when 6415 => note <= "000011010100001";
when 6416 => note <= "111011100011001";
when 6417 => note <= "110111010000111";
when 6418 => note <= "110111000101101";
when 6419 => note <= "111010100000010";
when 6420 => note <= "000000000000000";
when 6421 => note <= "000101011111110";
when 6422 => note <= "001000111010011";
when 6423 => note <= "001000101111001";
when 6424 => note <= "000100011100111";
when 6425 => note <= "111100101011111";
when 6426 => note <= "110011000011101";
when 6427 => note <= "101001101111101";
when 6428 => note <= "100010111011010";
when 6429 => note <= "100000001100101";
when 6430 => note <= "100010001001010";
when 6431 => note <= "101000001100101";
when 6432 => note <= "110000110010001";
when 6433 => note <= "111001101111101";
when 6434 => note <= "000000111010011";
when 6435 => note <= "000100101011111";
when 6436 => note <= "000100011100111";
when 6437 => note <= "000000101111001";
when 6438 => note <= "111011000011101";
when 6439 => note <= "110101011111110";
when 6440 => note <= "110010001001010";
when 6441 => note <= "110010100000010";
when 6442 => note <= "110111000101101";
when 6443 => note <= "111111010000111";
when 6444 => note <= "001001011001111";
when 6445 => note <= "010011010100001";
when 6446 => note <= "011010110011010";
when 6447 => note <= "011110010000011";
when 6448 => note <= "011101000100110";
when 6449 => note <= "010111110011011";
when 6450 => note <= "010000000000000";
when 6451 => note <= "000111110011011";
when 6452 => note <= "000001010111001";
when 6453 => note <= "111110010000011";
when 6454 => note <= "111111000101101";
when 6455 => note <= "000011010100001";
when 6456 => note <= "001001011001111";
when 6457 => note <= "001111010000111";
when 6458 => note <= "010010110011010";
when 6459 => note <= "010010100000010";
when 6460 => note <= "001101110110110";
when 6461 => note <= "000101011111110";
when 6462 => note <= "111011000011101";
when 6463 => note <= "110000101111001";
when 6464 => note <= "101000101111010";
when 6465 => note <= "100100101011111";
when 6466 => note <= "100101001100110";
when 6467 => note <= "101001101111101";
when 6468 => note <= "110000110010001";
when 6469 => note <= "111000001100101";
when 6470 => note <= "111101110110110";
when 6471 => note <= "000000001100101";
when 6472 => note <= "111110101000111";
when 6473 => note <= "111001101111101";
when 6474 => note <= "110011000011101";
when 6475 => note <= "101100101011111";
when 6476 => note <= "101000101111010";
when 6477 => note <= "101000101111001";
when 6478 => note <= "101101001100110";
when 6479 => note <= "110101011111110";
when 6480 => note <= "000000000000000";
when 6481 => note <= "001010100000010";
when 6482 => note <= "010010110011010";
when 6483 => note <= "010111010000111";
when 6484 => note <= "010111010000110";
when 6485 => note <= "010011010100001";
when 6486 => note <= "001100111100011";
when 6487 => note <= "000110010000011";
when 6488 => note <= "000001010111001";
when 6489 => note <= "111111110011011";
when 6490 => note <= "000010001001010";
when 6491 => note <= "000111110011011";
when 6492 => note <= "001111001101111";
when 6493 => note <= "010110010000011";
when 6494 => note <= "011010110011010";
when 6495 => note <= "011011010100001";
when 6496 => note <= "010111010000110";
when 6497 => note <= "001111010000111";
when 6498 => note <= "000100111100011";
when 6499 => note <= "111010100000010";
when 6500 => note <= "110010001001010";
when 6501 => note <= "101101011111110";
when 6502 => note <= "101101001100110";
when 6503 => note <= "110000101111001";
when 6504 => note <= "110110100110001";
when 6505 => note <= "111100101011111";
when 6506 => note <= "000000111010011";
when 6507 => note <= "000001101111101";
when 6508 => note <= "111110101000111";
when 6509 => note <= "111000001100101";
when 6510 => note <= "110000000000000";
when 6511 => note <= "101000001100101";
when 6512 => note <= "100010111011010";
when 6513 => note <= "100001101111101";
when 6514 => note <= "100101001100110";
when 6515 => note <= "101100101011111";
when 6516 => note <= "110110100110001";
when 6517 => note <= "000000101111001";
when 6518 => note <= "001000111010011";
when 6519 => note <= "001101011111110";
when 6520 => note <= "001101110110110";
when 6521 => note <= "001010100000010";
when 6522 => note <= "000100111100011";
when 6523 => note <= "111111010000111";
when 6524 => note <= "111011100011001";
when 6525 => note <= "111011010100001";
when 6526 => note <= "111111000101101";
when 6527 => note <= "000110010000011";
when 6528 => note <= "001111001101111";
when 6529 => note <= "010111110011011";
when 6530 => note <= "011101110110110";
when 6531 => note <= "011111110011011";
when 6532 => note <= "011101000100110";
when 6533 => note <= "010110010000011";
when 6534 => note <= "001100111100011";
when 6535 => note <= "000011010100001";
when 6536 => note <= "111011100011001";
when 6537 => note <= "110111010000111";
when 6538 => note <= "110111000101101";
when 6539 => note <= "111010100000010";
when 6540 => note <= "000000000000000";
when 6541 => note <= "000101011111110";
when 6542 => note <= "001000111010011";
when 6543 => note <= "001000101111001";
when 6544 => note <= "000100011100111";
when 6545 => note <= "111100101011111";
when 6546 => note <= "110011000011101";
when 6547 => note <= "101001101111101";
when 6548 => note <= "100010111011010";
when 6549 => note <= "100000001100101";
when 6550 => note <= "100010001001010";
when 6551 => note <= "101000001100101";
when 6552 => note <= "110000110010001";
when 6553 => note <= "111001101111101";
when 6554 => note <= "000000111010011";
when 6555 => note <= "000100101011111";
when 6556 => note <= "000100011100111";
when 6557 => note <= "000000101111001";
when 6558 => note <= "111011000011101";
when 6559 => note <= "110101011111110";
when 6560 => note <= "110010001001010";
when 6561 => note <= "110010100000010";
when 6562 => note <= "110111000101101";
when 6563 => note <= "111111010000111";
when 6564 => note <= "001001011001111";
when 6565 => note <= "010011010100001";
when 6566 => note <= "011010110011010";
when 6567 => note <= "011110010000011";
when 6568 => note <= "011101000100110";
when 6569 => note <= "010111110011011";
when 6570 => note <= "010000000000000";
when 6571 => note <= "000111110011011";
when 6572 => note <= "000001010111001";
when 6573 => note <= "111110010000011";
when 6574 => note <= "111111000101101";
when 6575 => note <= "000011010100001";
when 6576 => note <= "001001011001111";
when 6577 => note <= "001111010000111";
when 6578 => note <= "010010110011010";
when 6579 => note <= "010010100000010";
when 6580 => note <= "001101110110110";
when 6581 => note <= "000101011111110";
when 6582 => note <= "111011000011101";
when 6583 => note <= "110000101111001";
when 6584 => note <= "101000101111010";
when 6585 => note <= "100100101011111";
when 6586 => note <= "100101001100110";
when 6587 => note <= "101001101111101";
when 6588 => note <= "110000110010001";
when 6589 => note <= "111000001100101";
when 6590 => note <= "111101110110110";
when 6591 => note <= "000000001100101";
when 6592 => note <= "111110101000111";
when 6593 => note <= "111001101111101";
when 6594 => note <= "110011000011101";
when 6595 => note <= "101100101011111";
when 6596 => note <= "101000101111010";
when 6597 => note <= "101000101111001";
when 6598 => note <= "101101001100110";
when 6599 => note <= "110101011111110";
when 6600 => note <= "000000000000000";
when 6601 => note <= "001010100000010";
when 6602 => note <= "010010110011010";
when 6603 => note <= "010111010000111";
when 6604 => note <= "010111010000110";
when 6605 => note <= "010011010100001";
when 6606 => note <= "001100111100011";
when 6607 => note <= "000110010000011";
when 6608 => note <= "000001010111001";
when 6609 => note <= "111111110011011";
when 6610 => note <= "000010001001010";
when 6611 => note <= "000111110011011";
when 6612 => note <= "001111001101111";
when 6613 => note <= "010110010000011";
when 6614 => note <= "011010110011010";
when 6615 => note <= "011011010100001";
when 6616 => note <= "010111010000110";
when 6617 => note <= "001111010000111";
when 6618 => note <= "000100111100011";
when 6619 => note <= "111010100000010";
when 6620 => note <= "110010001001010";
when 6621 => note <= "101101011111110";
when 6622 => note <= "101101001100110";
when 6623 => note <= "110000101111001";
when 6624 => note <= "110110100110001";
when 6625 => note <= "111100101011111";
when 6626 => note <= "000000111010011";
when 6627 => note <= "000001101111101";
when 6628 => note <= "111110101000111";
when 6629 => note <= "111000001100101";
when 6630 => note <= "110000000000000";
when 6631 => note <= "101000001100101";
when 6632 => note <= "100010111011010";
when 6633 => note <= "100001101111101";
when 6634 => note <= "100101001100110";
when 6635 => note <= "101100101011111";
when 6636 => note <= "110110100110001";
when 6637 => note <= "000000101111001";
when 6638 => note <= "001000111010011";
when 6639 => note <= "001101011111110";
when 6640 => note <= "001101110110110";
when 6641 => note <= "001010100000010";
when 6642 => note <= "000100111100011";
when 6643 => note <= "111111010000111";
when 6644 => note <= "111011100011001";
when 6645 => note <= "111011010100001";
when 6646 => note <= "111111000101101";
when 6647 => note <= "000110010000011";
when 6648 => note <= "001111001101111";
when 6649 => note <= "010111110011011";
when 6650 => note <= "011101110110110";
when 6651 => note <= "011111110011011";
when 6652 => note <= "011101000100110";
when 6653 => note <= "010110010000011";
when 6654 => note <= "001100111100011";
when 6655 => note <= "000011010100001";
when 6656 => note <= "111011100011001";
when 6657 => note <= "110111010000111";
when 6658 => note <= "110111000101101";
when 6659 => note <= "111010100000010";
when 6660 => note <= "000000000000000";
when 6661 => note <= "000101011111110";
when 6662 => note <= "001000111010011";
when 6663 => note <= "001000101111001";
when 6664 => note <= "000100011100111";
when 6665 => note <= "111100101011111";
when 6666 => note <= "110011000011101";
when 6667 => note <= "101001101111101";
when 6668 => note <= "100010111011010";
when 6669 => note <= "100000001100101";
when 6670 => note <= "100010001001010";
when 6671 => note <= "101000001100101";
when 6672 => note <= "110000110010001";
when 6673 => note <= "111001101111101";
when 6674 => note <= "000000111010011";
when 6675 => note <= "000100101011111";
when 6676 => note <= "000100011100111";
when 6677 => note <= "000000101111001";
when 6678 => note <= "111011000011101";
when 6679 => note <= "110101011111110";
when 6680 => note <= "110010001001010";
when 6681 => note <= "110010100000010";
when 6682 => note <= "110111000101101";
when 6683 => note <= "111111010000111";
when 6684 => note <= "001001011001111";
when 6685 => note <= "010011010100001";
when 6686 => note <= "011010110011010";
when 6687 => note <= "011110010000011";
when 6688 => note <= "011101000100110";
when 6689 => note <= "010111110011011";
when 6690 => note <= "010000000000000";
when 6691 => note <= "000111110011011";
when 6692 => note <= "000001010111001";
when 6693 => note <= "111110010000011";
when 6694 => note <= "111111000101101";
when 6695 => note <= "000011010100001";
when 6696 => note <= "001001011001111";
when 6697 => note <= "001111010000111";
when 6698 => note <= "010010110011010";
when 6699 => note <= "010010100000010";
when 6700 => note <= "001101110110110";
when 6701 => note <= "000101011111110";
when 6702 => note <= "111011000011101";
when 6703 => note <= "110000101111001";
when 6704 => note <= "101000101111010";
when 6705 => note <= "100100101011111";
when 6706 => note <= "100101001100110";
when 6707 => note <= "101001101111101";
when 6708 => note <= "110000110010001";
when 6709 => note <= "111000001100101";
when 6710 => note <= "111101110110110";
when 6711 => note <= "000000001100101";
when 6712 => note <= "111110101000111";
when 6713 => note <= "111001101111101";
when 6714 => note <= "110011000011101";
when 6715 => note <= "101100101011111";
when 6716 => note <= "101000101111010";
when 6717 => note <= "101000101111001";
when 6718 => note <= "101101001100110";
when 6719 => note <= "110101011111110";
when 6720 => note <= "000000000000000";
when 6721 => note <= "001010100000010";
when 6722 => note <= "010010110011010";
when 6723 => note <= "010111010000111";
when 6724 => note <= "010111010000110";
when 6725 => note <= "010011010100001";
when 6726 => note <= "001100111100011";
when 6727 => note <= "000110010000011";
when 6728 => note <= "000001010111001";
when 6729 => note <= "111111110011011";
when 6730 => note <= "000010001001010";
when 6731 => note <= "000111110011011";
when 6732 => note <= "001111001101111";
when 6733 => note <= "010110010000011";
when 6734 => note <= "011010110011010";
when 6735 => note <= "011011010100001";
when 6736 => note <= "010111010000110";
when 6737 => note <= "001111010000111";
when 6738 => note <= "000100111100011";
when 6739 => note <= "111010100000010";
when 6740 => note <= "110010001001010";
when 6741 => note <= "101101011111110";
when 6742 => note <= "101101001100110";
when 6743 => note <= "110000101111001";
when 6744 => note <= "110110100110001";
when 6745 => note <= "111100101011111";
when 6746 => note <= "000000111010011";
when 6747 => note <= "000001101111101";
when 6748 => note <= "111110101000111";
when 6749 => note <= "111000001100101";
when 6750 => note <= "110000000000000";
when 6751 => note <= "101000001100101";
when 6752 => note <= "100010111011010";
when 6753 => note <= "100001101111101";
when 6754 => note <= "100101001100110";
when 6755 => note <= "101100101011111";
when 6756 => note <= "110110100110001";
when 6757 => note <= "000000101111001";
when 6758 => note <= "001000111010011";
when 6759 => note <= "001101011111110";
when 6760 => note <= "001101110110110";
when 6761 => note <= "001010100000010";
when 6762 => note <= "000100111100011";
when 6763 => note <= "111111010000111";
when 6764 => note <= "111011100011001";
when 6765 => note <= "111011010100001";
when 6766 => note <= "111111000101101";
when 6767 => note <= "000110010000011";
when 6768 => note <= "001111001101111";
when 6769 => note <= "010111110011011";
when 6770 => note <= "011101110110110";
when 6771 => note <= "011111110011011";
when 6772 => note <= "011101000100110";
when 6773 => note <= "010110010000011";
when 6774 => note <= "001100111100011";
when 6775 => note <= "000011010100001";
when 6776 => note <= "111011100011001";
when 6777 => note <= "110111010000111";
when 6778 => note <= "110111000101101";
when 6779 => note <= "111010100000010";
when 6780 => note <= "000000000000000";
when 6781 => note <= "000101011111110";
when 6782 => note <= "001000111010011";
when 6783 => note <= "001000101111001";
when 6784 => note <= "000100011100111";
when 6785 => note <= "111100101011111";
when 6786 => note <= "110011000011101";
when 6787 => note <= "101001101111101";
when 6788 => note <= "100010111011010";
when 6789 => note <= "100000001100101";
when 6790 => note <= "100010001001010";
when 6791 => note <= "101000001100101";
when 6792 => note <= "110000110010001";
when 6793 => note <= "111001101111101";
when 6794 => note <= "000000111010011";
when 6795 => note <= "000100101011111";
when 6796 => note <= "000100011100111";
when 6797 => note <= "000000101111001";
when 6798 => note <= "111011000011101";
when 6799 => note <= "110101011111110";
when 6800 => note <= "110010001001010";
when 6801 => note <= "110010100000010";
when 6802 => note <= "110111000101101";
when 6803 => note <= "111111010000111";
when 6804 => note <= "001001011001111";
when 6805 => note <= "010011010100001";
when 6806 => note <= "011010110011010";
when 6807 => note <= "011110010000011";
when 6808 => note <= "011101000100110";
when 6809 => note <= "010111110011011";
when 6810 => note <= "010000000000000";
when 6811 => note <= "000111110011011";
when 6812 => note <= "000001010111001";
when 6813 => note <= "111110010000011";
when 6814 => note <= "111111000101101";
when 6815 => note <= "000011010100001";
when 6816 => note <= "001001011001111";
when 6817 => note <= "001111010000111";
when 6818 => note <= "010010110011010";
when 6819 => note <= "010010100000010";
when 6820 => note <= "001101110110110";
when 6821 => note <= "000101011111110";
when 6822 => note <= "111011000011101";
when 6823 => note <= "110000101111001";
when 6824 => note <= "101000101111010";
when 6825 => note <= "100100101011111";
when 6826 => note <= "100101001100110";
when 6827 => note <= "101001101111101";
when 6828 => note <= "110000110010001";
when 6829 => note <= "111000001100101";
when 6830 => note <= "111101110110110";
when 6831 => note <= "000000001100101";
when 6832 => note <= "111110101000111";
when 6833 => note <= "111001101111101";
when 6834 => note <= "110011000011101";
when 6835 => note <= "101100101011111";
when 6836 => note <= "101000101111010";
when 6837 => note <= "101000101111001";
when 6838 => note <= "101101001100110";
when 6839 => note <= "110101011111110";
when 6840 => note <= "000000000000000";
when 6841 => note <= "001010100000010";
when 6842 => note <= "010010110011010";
when 6843 => note <= "010111010000111";
when 6844 => note <= "010111010000110";
when 6845 => note <= "010011010100001";
when 6846 => note <= "001100111100011";
when 6847 => note <= "000110010000011";
when 6848 => note <= "000001010111001";
when 6849 => note <= "111111110011011";
when 6850 => note <= "000010001001010";
when 6851 => note <= "000111110011011";
when 6852 => note <= "001111001101111";
when 6853 => note <= "010110010000011";
when 6854 => note <= "011010110011010";
when 6855 => note <= "011011010100001";
when 6856 => note <= "010111010000110";
when 6857 => note <= "001111010000111";
when 6858 => note <= "000100111100011";
when 6859 => note <= "111010100000010";
when 6860 => note <= "110010001001010";
when 6861 => note <= "101101011111110";
when 6862 => note <= "101101001100110";
when 6863 => note <= "110000101111001";
when 6864 => note <= "110110100110001";
when 6865 => note <= "111100101011111";
when 6866 => note <= "000000111010011";
when 6867 => note <= "000001101111101";
when 6868 => note <= "111110101000111";
when 6869 => note <= "111000001100101";
when 6870 => note <= "110000000000000";
when 6871 => note <= "101000001100101";
when 6872 => note <= "100010111011010";
when 6873 => note <= "100001101111101";
when 6874 => note <= "100101001100110";
when 6875 => note <= "101100101011111";
when 6876 => note <= "110110100110001";
when 6877 => note <= "000000101111001";
when 6878 => note <= "001000111010011";
when 6879 => note <= "001101011111110";
when 6880 => note <= "001101110110110";
when 6881 => note <= "001010100000010";
when 6882 => note <= "000100111100011";
when 6883 => note <= "111111010000111";
when 6884 => note <= "111011100011001";
when 6885 => note <= "111011010100001";
when 6886 => note <= "111111000101101";
when 6887 => note <= "000110010000011";
when 6888 => note <= "001111001101111";
when 6889 => note <= "010111110011011";
when 6890 => note <= "011101110110110";
when 6891 => note <= "011111110011011";
when 6892 => note <= "011101000100110";
when 6893 => note <= "010110010000011";
when 6894 => note <= "001100111100011";
when 6895 => note <= "000011010100001";
when 6896 => note <= "111011100011001";
when 6897 => note <= "110111010000111";
when 6898 => note <= "110111000101101";
when 6899 => note <= "111010100000010";
when 6900 => note <= "000000000000000";
when 6901 => note <= "000101011111110";
when 6902 => note <= "001000111010011";
when 6903 => note <= "001000101111001";
when 6904 => note <= "000100011100111";
when 6905 => note <= "111100101011111";
when 6906 => note <= "110011000011101";
when 6907 => note <= "101001101111101";
when 6908 => note <= "100010111011010";
when 6909 => note <= "100000001100101";
when 6910 => note <= "100010001001010";
when 6911 => note <= "101000001100101";
when 6912 => note <= "110000110010001";
when 6913 => note <= "111001101111101";
when 6914 => note <= "000000111010011";
when 6915 => note <= "000100101011111";
when 6916 => note <= "000100011100111";
when 6917 => note <= "000000101111001";
when 6918 => note <= "111011000011101";
when 6919 => note <= "110101011111110";
when 6920 => note <= "110010001001010";
when 6921 => note <= "110010100000010";
when 6922 => note <= "110111000101101";
when 6923 => note <= "111111010000111";
when 6924 => note <= "001001011001111";
when 6925 => note <= "010011010100001";
when 6926 => note <= "011010110011010";
when 6927 => note <= "011110010000011";
when 6928 => note <= "011101000100110";
when 6929 => note <= "010111110011011";
when 6930 => note <= "010000000000000";
when 6931 => note <= "000111110011011";
when 6932 => note <= "000001010111001";
when 6933 => note <= "111110010000011";
when 6934 => note <= "111111000101101";
when 6935 => note <= "000011010100001";
when 6936 => note <= "001001011001111";
when 6937 => note <= "001111010000111";
when 6938 => note <= "010010110011010";
when 6939 => note <= "010010100000010";
when 6940 => note <= "001101110110110";
when 6941 => note <= "000101011111110";
when 6942 => note <= "111011000011101";
when 6943 => note <= "110000101111001";
when 6944 => note <= "101000101111010";
when 6945 => note <= "100100101011111";
when 6946 => note <= "100101001100110";
when 6947 => note <= "101001101111101";
when 6948 => note <= "110000110010001";
when 6949 => note <= "111000001100101";
when 6950 => note <= "111101110110110";
when 6951 => note <= "000000001100101";
when 6952 => note <= "111110101000111";
when 6953 => note <= "111001101111101";
when 6954 => note <= "110011000011101";
when 6955 => note <= "101100101011111";
when 6956 => note <= "101000101111010";
when 6957 => note <= "101000101111001";
when 6958 => note <= "101101001100110";
when 6959 => note <= "110101011111110";
when 6960 => note <= "000000000000000";
when 6961 => note <= "001010100000010";
when 6962 => note <= "010010110011010";
when 6963 => note <= "010111010000111";
when 6964 => note <= "010111010000110";
when 6965 => note <= "010011010100001";
when 6966 => note <= "001100111100011";
when 6967 => note <= "000110010000011";
when 6968 => note <= "000001010111001";
when 6969 => note <= "111111110011011";
when 6970 => note <= "000010001001010";
when 6971 => note <= "000111110011011";
when 6972 => note <= "001111001101111";
when 6973 => note <= "010110010000011";
when 6974 => note <= "011010110011010";
when 6975 => note <= "011011010100001";
when 6976 => note <= "010111010000110";
when 6977 => note <= "001111010000111";
when 6978 => note <= "000100111100011";
when 6979 => note <= "111010100000010";
when 6980 => note <= "110010001001010";
when 6981 => note <= "101101011111110";
when 6982 => note <= "101101001100110";
when 6983 => note <= "110000101111001";
when 6984 => note <= "110110100110001";
when 6985 => note <= "111100101011111";
when 6986 => note <= "000000111010011";
when 6987 => note <= "000001101111101";
when 6988 => note <= "111110101000111";
when 6989 => note <= "111000001100101";
when 6990 => note <= "110000000000000";
when 6991 => note <= "101000001100101";
when 6992 => note <= "100010111011010";
when 6993 => note <= "100001101111101";
when 6994 => note <= "100101001100110";
when 6995 => note <= "101100101011111";
when 6996 => note <= "110110100110001";
when 6997 => note <= "000000101111001";
when 6998 => note <= "001000111010011";
when 6999 => note <= "001101011111110";
when 7000 => note <= "001101110110110";
when 7001 => note <= "001010100000010";
when 7002 => note <= "000100111100011";
when 7003 => note <= "111111010000111";
when 7004 => note <= "111011100011001";
when 7005 => note <= "111011010100001";
when 7006 => note <= "111111000101101";
when 7007 => note <= "000110010000011";
when 7008 => note <= "001111001101111";
when 7009 => note <= "010111110011011";
when 7010 => note <= "011101110110110";
when 7011 => note <= "011111110011011";
when 7012 => note <= "011101000100110";
when 7013 => note <= "010110010000011";
when 7014 => note <= "001100111100011";
when 7015 => note <= "000011010100001";
when 7016 => note <= "111011100011001";
when 7017 => note <= "110111010000111";
when 7018 => note <= "110111000101101";
when 7019 => note <= "111010100000010";
when 7020 => note <= "000000000000000";
when 7021 => note <= "000101011111110";
when 7022 => note <= "001000111010011";
when 7023 => note <= "001000101111001";
when 7024 => note <= "000100011100111";
when 7025 => note <= "111100101011111";
when 7026 => note <= "110011000011101";
when 7027 => note <= "101001101111101";
when 7028 => note <= "100010111011010";
when 7029 => note <= "100000001100101";
when 7030 => note <= "100010001001010";
when 7031 => note <= "101000001100101";
when 7032 => note <= "110000110010001";
when 7033 => note <= "111001101111101";
when 7034 => note <= "000000111010011";
when 7035 => note <= "000100101011111";
when 7036 => note <= "000100011100111";
when 7037 => note <= "000000101111001";
when 7038 => note <= "111011000011101";
when 7039 => note <= "110101011111110";
when 7040 => note <= "110010001001010";
when 7041 => note <= "110010100000010";
when 7042 => note <= "110111000101101";
when 7043 => note <= "111111010000111";
when 7044 => note <= "001001011001111";
when 7045 => note <= "010011010100001";
when 7046 => note <= "011010110011010";
when 7047 => note <= "011110010000011";
when 7048 => note <= "011101000100110";
when 7049 => note <= "010111110011011";
when 7050 => note <= "010000000000000";
when 7051 => note <= "000111110011011";
when 7052 => note <= "000001010111001";
when 7053 => note <= "111110010000011";
when 7054 => note <= "111111000101101";
when 7055 => note <= "000011010100001";
when 7056 => note <= "001001011001111";
when 7057 => note <= "001111010000111";
when 7058 => note <= "010010110011010";
when 7059 => note <= "010010100000010";
when 7060 => note <= "001101110110110";
when 7061 => note <= "000101011111110";
when 7062 => note <= "111011000011101";
when 7063 => note <= "110000101111001";
when 7064 => note <= "101000101111010";
when 7065 => note <= "100100101011111";
when 7066 => note <= "100101001100110";
when 7067 => note <= "101001101111101";
when 7068 => note <= "110000110010001";
when 7069 => note <= "111000001100101";
when 7070 => note <= "111101110110110";
when 7071 => note <= "000000001100101";
when 7072 => note <= "111110101000111";
when 7073 => note <= "111001101111101";
when 7074 => note <= "110011000011101";
when 7075 => note <= "101100101011111";
when 7076 => note <= "101000101111010";
when 7077 => note <= "101000101111001";
when 7078 => note <= "101101001100110";
when 7079 => note <= "110101011111110";
when 7080 => note <= "000000000000000";
when 7081 => note <= "001010100000010";
when 7082 => note <= "010010110011010";
when 7083 => note <= "010111010000111";
when 7084 => note <= "010111010000110";
when 7085 => note <= "010011010100001";
when 7086 => note <= "001100111100011";
when 7087 => note <= "000110010000011";
when 7088 => note <= "000001010111001";
when 7089 => note <= "111111110011011";
when 7090 => note <= "000010001001010";
when 7091 => note <= "000111110011011";
when 7092 => note <= "001111001101111";
when 7093 => note <= "010110010000011";
when 7094 => note <= "011010110011010";
when 7095 => note <= "011011010100001";
when 7096 => note <= "010111010000110";
when 7097 => note <= "001111010000111";
when 7098 => note <= "000100111100011";
when 7099 => note <= "111010100000010";
when 7100 => note <= "110010001001010";
when 7101 => note <= "101101011111110";
when 7102 => note <= "101101001100110";
when 7103 => note <= "110000101111001";
when 7104 => note <= "110110100110001";
when 7105 => note <= "111100101011111";
when 7106 => note <= "000000111010011";
when 7107 => note <= "000001101111101";
when 7108 => note <= "111110101000111";
when 7109 => note <= "111000001100101";
when 7110 => note <= "110000000000000";
when 7111 => note <= "101000001100101";
when 7112 => note <= "100010111011010";
when 7113 => note <= "100001101111101";
when 7114 => note <= "100101001100110";
when 7115 => note <= "101100101011111";
when 7116 => note <= "110110100110001";
when 7117 => note <= "000000101111001";
when 7118 => note <= "001000111010011";
when 7119 => note <= "001101011111110";
when 7120 => note <= "001101110110110";
when 7121 => note <= "001010100000010";
when 7122 => note <= "000100111100011";
when 7123 => note <= "111111010000111";
when 7124 => note <= "111011100011001";
when 7125 => note <= "111011010100001";
when 7126 => note <= "111111000101101";
when 7127 => note <= "000110010000011";
when 7128 => note <= "001111001101111";
when 7129 => note <= "010111110011011";
when 7130 => note <= "011101110110110";
when 7131 => note <= "011111110011011";
when 7132 => note <= "011101000100110";
when 7133 => note <= "010110010000011";
when 7134 => note <= "001100111100011";
when 7135 => note <= "000011010100001";
when 7136 => note <= "111011100011001";
when 7137 => note <= "110111010000111";
when 7138 => note <= "110111000101101";
when 7139 => note <= "111010100000010";
when 7140 => note <= "000000000000000";
when 7141 => note <= "000101011111110";
when 7142 => note <= "001000111010011";
when 7143 => note <= "001000101111001";
when 7144 => note <= "000100011100111";
when 7145 => note <= "111100101011111";
when 7146 => note <= "110011000011101";
when 7147 => note <= "101001101111101";
when 7148 => note <= "100010111011010";
when 7149 => note <= "100000001100101";
when 7150 => note <= "100010001001010";
when 7151 => note <= "101000001100101";
when 7152 => note <= "110000110010001";
when 7153 => note <= "111001101111101";
when 7154 => note <= "000000111010011";
when 7155 => note <= "000100101011111";
when 7156 => note <= "000100011100111";
when 7157 => note <= "000000101111001";
when 7158 => note <= "111011000011101";
when 7159 => note <= "110101011111110";
when 7160 => note <= "110010001001010";
when 7161 => note <= "110010100000010";
when 7162 => note <= "110111000101101";
when 7163 => note <= "111111010000111";
when 7164 => note <= "001001011001111";
when 7165 => note <= "010011010100001";
when 7166 => note <= "011010110011010";
when 7167 => note <= "011110010000011";
when 7168 => note <= "011101000100110";
when 7169 => note <= "010111110011011";
when 7170 => note <= "010000000000000";
when 7171 => note <= "000111110011011";
when 7172 => note <= "000001010111001";
when 7173 => note <= "111110010000011";
when 7174 => note <= "111111000101101";
when 7175 => note <= "000011010100001";
when 7176 => note <= "001001011001111";
when 7177 => note <= "001111010000111";
when 7178 => note <= "010010110011010";
when 7179 => note <= "010010100000010";
when 7180 => note <= "001101110110110";
when 7181 => note <= "000101011111110";
when 7182 => note <= "111011000011101";
when 7183 => note <= "110000101111001";
when 7184 => note <= "101000101111010";
when 7185 => note <= "100100101011111";
when 7186 => note <= "100101001100110";
when 7187 => note <= "101001101111101";
when 7188 => note <= "110000110010001";
when 7189 => note <= "111000001100101";
when 7190 => note <= "111101110110110";
when 7191 => note <= "000000001100101";
when 7192 => note <= "111110101000111";
when 7193 => note <= "111001101111101";
when 7194 => note <= "110011000011101";
when 7195 => note <= "101100101011111";
when 7196 => note <= "101000101111010";
when 7197 => note <= "101000101111001";
when 7198 => note <= "101101001100110";
when 7199 => note <= "110101011111110";
when 7200 => note <= "000000000000000";
when 7201 => note <= "001010100000010";
when 7202 => note <= "010010110011010";
when 7203 => note <= "010111010000111";
when 7204 => note <= "010111010000110";
when 7205 => note <= "010011010100001";
when 7206 => note <= "001100111100011";
when 7207 => note <= "000110010000011";
when 7208 => note <= "000001010111001";
when 7209 => note <= "111111110011011";
when 7210 => note <= "000010001001010";
when 7211 => note <= "000111110011011";
when 7212 => note <= "001111001101111";
when 7213 => note <= "010110010000011";
when 7214 => note <= "011010110011010";
when 7215 => note <= "011011010100001";
when 7216 => note <= "010111010000110";
when 7217 => note <= "001111010000111";
when 7218 => note <= "000100111100011";
when 7219 => note <= "111010100000010";
when 7220 => note <= "110010001001010";
when 7221 => note <= "101101011111110";
when 7222 => note <= "101101001100110";
when 7223 => note <= "110000101111001";
when 7224 => note <= "110110100110001";
when 7225 => note <= "111100101011111";
when 7226 => note <= "000000111010011";
when 7227 => note <= "000001101111101";
when 7228 => note <= "111110101000111";
when 7229 => note <= "111000001100101";
when 7230 => note <= "110000000000000";
when 7231 => note <= "101000001100101";
when 7232 => note <= "100010111011010";
when 7233 => note <= "100001101111101";
when 7234 => note <= "100101001100110";
when 7235 => note <= "101100101011111";
when 7236 => note <= "110110100110001";
when 7237 => note <= "000000101111001";
when 7238 => note <= "001000111010011";
when 7239 => note <= "001101011111110";
when 7240 => note <= "001101110110110";
when 7241 => note <= "001010100000010";
when 7242 => note <= "000100111100011";
when 7243 => note <= "111111010000111";
when 7244 => note <= "111011100011001";
when 7245 => note <= "111011010100001";
when 7246 => note <= "111111000101101";
when 7247 => note <= "000110010000011";
when 7248 => note <= "001111001101111";
when 7249 => note <= "010111110011011";
when 7250 => note <= "011101110110110";
when 7251 => note <= "011111110011011";
when 7252 => note <= "011101000100110";
when 7253 => note <= "010110010000011";
when 7254 => note <= "001100111100011";
when 7255 => note <= "000011010100001";
when 7256 => note <= "111011100011001";
when 7257 => note <= "110111010000111";
when 7258 => note <= "110111000101101";
when 7259 => note <= "111010100000010";
when 7260 => note <= "000000000000000";
when 7261 => note <= "000101011111110";
when 7262 => note <= "001000111010011";
when 7263 => note <= "001000101111001";
when 7264 => note <= "000100011100111";
when 7265 => note <= "111100101011111";
when 7266 => note <= "110011000011101";
when 7267 => note <= "101001101111101";
when 7268 => note <= "100010111011010";
when 7269 => note <= "100000001100101";
when 7270 => note <= "100010001001010";
when 7271 => note <= "101000001100101";
when 7272 => note <= "110000110010001";
when 7273 => note <= "111001101111101";
when 7274 => note <= "000000111010011";
when 7275 => note <= "000100101011111";
when 7276 => note <= "000100011100111";
when 7277 => note <= "000000101111001";
when 7278 => note <= "111011000011101";
when 7279 => note <= "110101011111110";
when 7280 => note <= "110010001001010";
when 7281 => note <= "110010100000010";
when 7282 => note <= "110111000101101";
when 7283 => note <= "111111010000111";
when 7284 => note <= "001001011001111";
when 7285 => note <= "010011010100001";
when 7286 => note <= "011010110011010";
when 7287 => note <= "011110010000011";
when 7288 => note <= "011101000100110";
when 7289 => note <= "010111110011011";
when 7290 => note <= "010000000000000";
when 7291 => note <= "000111110011011";
when 7292 => note <= "000001010111001";
when 7293 => note <= "111110010000011";
when 7294 => note <= "111111000101101";
when 7295 => note <= "000011010100001";
when 7296 => note <= "001001011001111";
when 7297 => note <= "001111010000111";
when 7298 => note <= "010010110011010";
when 7299 => note <= "010010100000010";
when 7300 => note <= "001101110110110";
when 7301 => note <= "000101011111110";
when 7302 => note <= "111011000011101";
when 7303 => note <= "110000101111001";
when 7304 => note <= "101000101111010";
when 7305 => note <= "100100101011111";
when 7306 => note <= "100101001100110";
when 7307 => note <= "101001101111101";
when 7308 => note <= "110000110010001";
when 7309 => note <= "111000001100101";
when 7310 => note <= "111101110110110";
when 7311 => note <= "000000001100101";
when 7312 => note <= "111110101000111";
when 7313 => note <= "111001101111101";
when 7314 => note <= "110011000011101";
when 7315 => note <= "101100101011111";
when 7316 => note <= "101000101111010";
when 7317 => note <= "101000101111001";
when 7318 => note <= "101101001100110";
when 7319 => note <= "110101011111110";
when 7320 => note <= "000000000000000";
when 7321 => note <= "001010100000010";
when 7322 => note <= "010010110011010";
when 7323 => note <= "010111010000111";
when 7324 => note <= "010111010000110";
when 7325 => note <= "010011010100001";
when 7326 => note <= "001100111100011";
when 7327 => note <= "000110010000011";
when 7328 => note <= "000001010111001";
when 7329 => note <= "111111110011011";
when 7330 => note <= "000010001001010";
when 7331 => note <= "000111110011011";
when 7332 => note <= "001111001101111";
when 7333 => note <= "010110010000011";
when 7334 => note <= "011010110011010";
when 7335 => note <= "011011010100001";
when 7336 => note <= "010111010000110";
when 7337 => note <= "001111010000111";
when 7338 => note <= "000100111100011";
when 7339 => note <= "111010100000010";
when 7340 => note <= "110010001001010";
when 7341 => note <= "101101011111110";
when 7342 => note <= "101101001100110";
when 7343 => note <= "110000101111001";
when 7344 => note <= "110110100110001";
when 7345 => note <= "111100101011111";
when 7346 => note <= "000000111010011";
when 7347 => note <= "000001101111101";
when 7348 => note <= "111110101000111";
when 7349 => note <= "111000001100101";
when 7350 => note <= "110000000000000";
when 7351 => note <= "101000001100101";
when 7352 => note <= "100010111011010";
when 7353 => note <= "100001101111101";
when 7354 => note <= "100101001100110";
when 7355 => note <= "101100101011111";
when 7356 => note <= "110110100110001";
when 7357 => note <= "000000101111001";
when 7358 => note <= "001000111010011";
when 7359 => note <= "001101011111110";
when 7360 => note <= "001101110110110";
when 7361 => note <= "001010100000010";
when 7362 => note <= "000100111100011";
when 7363 => note <= "111111010000111";
when 7364 => note <= "111011100011001";
when 7365 => note <= "111011010100001";
when 7366 => note <= "111111000101101";
when 7367 => note <= "000110010000011";
when 7368 => note <= "001111001101111";
when 7369 => note <= "010111110011011";
when 7370 => note <= "011101110110110";
when 7371 => note <= "011111110011011";
when 7372 => note <= "011101000100110";
when 7373 => note <= "010110010000011";
when 7374 => note <= "001100111100011";
when 7375 => note <= "000011010100001";
when 7376 => note <= "111011100011001";
when 7377 => note <= "110111010000111";
when 7378 => note <= "110111000101101";
when 7379 => note <= "111010100000010";
when 7380 => note <= "000000000000000";
when 7381 => note <= "000101011111110";
when 7382 => note <= "001000111010011";
when 7383 => note <= "001000101111001";
when 7384 => note <= "000100011100111";
when 7385 => note <= "111100101011111";
when 7386 => note <= "110011000011101";
when 7387 => note <= "101001101111101";
when 7388 => note <= "100010111011010";
when 7389 => note <= "100000001100101";
when 7390 => note <= "100010001001010";
when 7391 => note <= "101000001100101";
when 7392 => note <= "110000110010001";
when 7393 => note <= "111001101111101";
when 7394 => note <= "000000111010011";
when 7395 => note <= "000100101011111";
when 7396 => note <= "000100011100111";
when 7397 => note <= "000000101111001";
when 7398 => note <= "111011000011101";
when 7399 => note <= "110101011111110";
when 7400 => note <= "110010001001010";
when 7401 => note <= "110010100000010";
when 7402 => note <= "110111000101101";
when 7403 => note <= "111111010000111";
when 7404 => note <= "001001011001111";
when 7405 => note <= "010011010100001";
when 7406 => note <= "011010110011010";
when 7407 => note <= "011110010000011";
when 7408 => note <= "011101000100110";
when 7409 => note <= "010111110011011";
when 7410 => note <= "010000000000000";
when 7411 => note <= "000111110011011";
when 7412 => note <= "000001010111001";
when 7413 => note <= "111110010000011";
when 7414 => note <= "111111000101101";
when 7415 => note <= "000011010100001";
when 7416 => note <= "001001011001111";
when 7417 => note <= "001111010000111";
when 7418 => note <= "010010110011010";
when 7419 => note <= "010010100000010";
when 7420 => note <= "001101110110110";
when 7421 => note <= "000101011111110";
when 7422 => note <= "111011000011101";
when 7423 => note <= "110000101111001";
when 7424 => note <= "101000101111010";
when 7425 => note <= "100100101011111";
when 7426 => note <= "100101001100110";
when 7427 => note <= "101001101111101";
when 7428 => note <= "110000110010001";
when 7429 => note <= "111000001100101";
when 7430 => note <= "111101110110110";
when 7431 => note <= "000000001100101";
when 7432 => note <= "111110101000111";
when 7433 => note <= "111001101111101";
when 7434 => note <= "110011000011101";
when 7435 => note <= "101100101011111";
when 7436 => note <= "101000101111010";
when 7437 => note <= "101000101111001";
when 7438 => note <= "101101001100110";
when 7439 => note <= "110101011111110";
when 7440 => note <= "000000000000000";
when 7441 => note <= "001010100000010";
when 7442 => note <= "010010110011010";
when 7443 => note <= "010111010000111";
when 7444 => note <= "010111010000110";
when 7445 => note <= "010011010100001";
when 7446 => note <= "001100111100011";
when 7447 => note <= "000110010000011";
when 7448 => note <= "000001010111001";
when 7449 => note <= "111111110011011";
when 7450 => note <= "000010001001010";
when 7451 => note <= "000111110011011";
when 7452 => note <= "001111001101111";
when 7453 => note <= "010110010000011";
when 7454 => note <= "011010110011010";
when 7455 => note <= "011011010100001";
when 7456 => note <= "010111010000110";
when 7457 => note <= "001111010000111";
when 7458 => note <= "000100111100011";
when 7459 => note <= "111010100000010";
when 7460 => note <= "110010001001010";
when 7461 => note <= "101101011111110";
when 7462 => note <= "101101001100110";
when 7463 => note <= "110000101111001";
when 7464 => note <= "110110100110001";
when 7465 => note <= "111100101011111";
when 7466 => note <= "000000111010011";
when 7467 => note <= "000001101111101";
when 7468 => note <= "111110101000111";
when 7469 => note <= "111000001100101";
when 7470 => note <= "110000000000000";
when 7471 => note <= "101000001100101";
when 7472 => note <= "100010111011010";
when 7473 => note <= "100001101111101";
when 7474 => note <= "100101001100110";
when 7475 => note <= "101100101011111";
when 7476 => note <= "110110100110001";
when 7477 => note <= "000000101111001";
when 7478 => note <= "001000111010011";
when 7479 => note <= "001101011111110";
when 7480 => note <= "001101110110110";
when 7481 => note <= "001010100000010";
when 7482 => note <= "000100111100011";
when 7483 => note <= "111111010000111";
when 7484 => note <= "111011100011001";
when 7485 => note <= "111011010100001";
when 7486 => note <= "111111000101101";
when 7487 => note <= "000110010000011";
when 7488 => note <= "001111001101111";
when 7489 => note <= "010111110011011";
when 7490 => note <= "011101110110110";
when 7491 => note <= "011111110011011";
when 7492 => note <= "011101000100110";
when 7493 => note <= "010110010000011";
when 7494 => note <= "001100111100011";
when 7495 => note <= "000011010100001";
when 7496 => note <= "111011100011001";
when 7497 => note <= "110111010000111";
when 7498 => note <= "110111000101101";
when 7499 => note <= "111010100000010";
when 7500 => note <= "000000000000000";
when 7501 => note <= "000101011111110";
when 7502 => note <= "001000111010011";
when 7503 => note <= "001000101111001";
when 7504 => note <= "000100011100111";
when 7505 => note <= "111100101011111";
when 7506 => note <= "110011000011101";
when 7507 => note <= "101001101111101";
when 7508 => note <= "100010111011010";
when 7509 => note <= "100000001100101";
when 7510 => note <= "100010001001010";
when 7511 => note <= "101000001100101";
when 7512 => note <= "110000110010001";
when 7513 => note <= "111001101111101";
when 7514 => note <= "000000111010011";
when 7515 => note <= "000100101011111";
when 7516 => note <= "000100011100111";
when 7517 => note <= "000000101111001";
when 7518 => note <= "111011000011101";
when 7519 => note <= "110101011111110";
when 7520 => note <= "110010001001010";
when 7521 => note <= "110010100000010";
when 7522 => note <= "110111000101101";
when 7523 => note <= "111111010000111";
when 7524 => note <= "001001011001111";
when 7525 => note <= "010011010100001";
when 7526 => note <= "011010110011010";
when 7527 => note <= "011110010000011";
when 7528 => note <= "011101000100110";
when 7529 => note <= "010111110011011";
when 7530 => note <= "010000000000000";
when 7531 => note <= "000111110011011";
when 7532 => note <= "000001010111001";
when 7533 => note <= "111110010000011";
when 7534 => note <= "111111000101101";
when 7535 => note <= "000011010100001";
when 7536 => note <= "001001011001111";
when 7537 => note <= "001111010000111";
when 7538 => note <= "010010110011010";
when 7539 => note <= "010010100000010";
when 7540 => note <= "001101110110110";
when 7541 => note <= "000101011111110";
when 7542 => note <= "111011000011101";
when 7543 => note <= "110000101111001";
when 7544 => note <= "101000101111010";
when 7545 => note <= "100100101011111";
when 7546 => note <= "100101001100110";
when 7547 => note <= "101001101111101";
when 7548 => note <= "110000110010001";
when 7549 => note <= "111000001100101";
when 7550 => note <= "111101110110110";
when 7551 => note <= "000000001100101";
when 7552 => note <= "111110101000111";
when 7553 => note <= "111001101111101";
when 7554 => note <= "110011000011101";
when 7555 => note <= "101100101011111";
when 7556 => note <= "101000101111010";
when 7557 => note <= "101000101111001";
when 7558 => note <= "101101001100110";
when 7559 => note <= "110101011111110";
when 7560 => note <= "000000000000000";
when 7561 => note <= "001010100000010";
when 7562 => note <= "010010110011010";
when 7563 => note <= "010111010000111";
when 7564 => note <= "010111010000110";
when 7565 => note <= "010011010100001";
when 7566 => note <= "001100111100011";
when 7567 => note <= "000110010000011";
when 7568 => note <= "000001010111001";
when 7569 => note <= "111111110011011";
when 7570 => note <= "000010001001010";
when 7571 => note <= "000111110011011";
when 7572 => note <= "001111001101111";
when 7573 => note <= "010110010000011";
when 7574 => note <= "011010110011010";
when 7575 => note <= "011011010100001";
when 7576 => note <= "010111010000110";
when 7577 => note <= "001111010000111";
when 7578 => note <= "000100111100011";
when 7579 => note <= "111010100000010";
when 7580 => note <= "110010001001010";
when 7581 => note <= "101101011111110";
when 7582 => note <= "101101001100110";
when 7583 => note <= "110000101111001";
when 7584 => note <= "110110100110001";
when 7585 => note <= "111100101011111";
when 7586 => note <= "000000111010011";
when 7587 => note <= "000001101111101";
when 7588 => note <= "111110101000111";
when 7589 => note <= "111000001100101";
when 7590 => note <= "110000000000000";
when 7591 => note <= "101000001100101";
when 7592 => note <= "100010111011010";
when 7593 => note <= "100001101111101";
when 7594 => note <= "100101001100110";
when 7595 => note <= "101100101011111";
when 7596 => note <= "110110100110001";
when 7597 => note <= "000000101111001";
when 7598 => note <= "001000111010011";
when 7599 => note <= "001101011111110";
when 7600 => note <= "001101110110110";
when 7601 => note <= "001010100000010";
when 7602 => note <= "000100111100011";
when 7603 => note <= "111111010000111";
when 7604 => note <= "111011100011001";
when 7605 => note <= "111011010100001";
when 7606 => note <= "111111000101101";
when 7607 => note <= "000110010000011";
when 7608 => note <= "001111001101111";
when 7609 => note <= "010111110011011";
when 7610 => note <= "011101110110110";
when 7611 => note <= "011111110011011";
when 7612 => note <= "011101000100110";
when 7613 => note <= "010110010000011";
when 7614 => note <= "001100111100011";
when 7615 => note <= "000011010100001";
when 7616 => note <= "111011100011001";
when 7617 => note <= "110111010000111";
when 7618 => note <= "110111000101101";
when 7619 => note <= "111010100000010";
when 7620 => note <= "000000000000000";
when 7621 => note <= "000101011111110";
when 7622 => note <= "001000111010011";
when 7623 => note <= "001000101111001";
when 7624 => note <= "000100011100111";
when 7625 => note <= "111100101011111";
when 7626 => note <= "110011000011101";
when 7627 => note <= "101001101111101";
when 7628 => note <= "100010111011010";
when 7629 => note <= "100000001100101";
when 7630 => note <= "100010001001010";
when 7631 => note <= "101000001100101";
when 7632 => note <= "110000110010001";
when 7633 => note <= "111001101111101";
when 7634 => note <= "000000111010011";
when 7635 => note <= "000100101011111";
when 7636 => note <= "000100011100111";
when 7637 => note <= "000000101111001";
when 7638 => note <= "111011000011101";
when 7639 => note <= "110101011111110";
when 7640 => note <= "110010001001010";
when 7641 => note <= "110010100000010";
when 7642 => note <= "110111000101101";
when 7643 => note <= "111111010000111";
when 7644 => note <= "001001011001111";
when 7645 => note <= "010011010100001";
when 7646 => note <= "011010110011010";
when 7647 => note <= "011110010000011";
when 7648 => note <= "011101000100110";
when 7649 => note <= "010111110011011";
when 7650 => note <= "010000000000000";
when 7651 => note <= "000111110011011";
when 7652 => note <= "000001010111001";
when 7653 => note <= "111110010000011";
when 7654 => note <= "111111000101101";
when 7655 => note <= "000011010100001";
when 7656 => note <= "001001011001111";
when 7657 => note <= "001111010000111";
when 7658 => note <= "010010110011010";
when 7659 => note <= "010010100000010";
when 7660 => note <= "001101110110110";
when 7661 => note <= "000101011111110";
when 7662 => note <= "111011000011101";
when 7663 => note <= "110000101111001";
when 7664 => note <= "101000101111010";
when 7665 => note <= "100100101011111";
when 7666 => note <= "100101001100110";
when 7667 => note <= "101001101111101";
when 7668 => note <= "110000110010001";
when 7669 => note <= "111000001100101";
when 7670 => note <= "111101110110110";
when 7671 => note <= "000000001100101";
when 7672 => note <= "111110101000111";
when 7673 => note <= "111001101111101";
when 7674 => note <= "110011000011101";
when 7675 => note <= "101100101011111";
when 7676 => note <= "101000101111010";
when 7677 => note <= "101000101111001";
when 7678 => note <= "101101001100110";
when 7679 => note <= "110101011111110";
when 7680 => note <= "000000000000000";
when 7681 => note <= "001010100000010";
when 7682 => note <= "010010110011010";
when 7683 => note <= "010111010000111";
when 7684 => note <= "010111010000110";
when 7685 => note <= "010011010100001";
when 7686 => note <= "001100111100011";
when 7687 => note <= "000110010000011";
when 7688 => note <= "000001010111001";
when 7689 => note <= "111111110011011";
when 7690 => note <= "000010001001010";
when 7691 => note <= "000111110011011";
when 7692 => note <= "001111001101111";
when 7693 => note <= "010110010000011";
when 7694 => note <= "011010110011010";
when 7695 => note <= "011011010100001";
when 7696 => note <= "010111010000110";
when 7697 => note <= "001111010000111";
when 7698 => note <= "000100111100011";
when 7699 => note <= "111010100000010";
when 7700 => note <= "110010001001010";
when 7701 => note <= "101101011111110";
when 7702 => note <= "101101001100110";
when 7703 => note <= "110000101111001";
when 7704 => note <= "110110100110001";
when 7705 => note <= "111100101011111";
when 7706 => note <= "000000111010011";
when 7707 => note <= "000001101111101";
when 7708 => note <= "111110101000111";
when 7709 => note <= "111000001100101";
when 7710 => note <= "110000000000000";
when 7711 => note <= "101000001100101";
when 7712 => note <= "100010111011010";
when 7713 => note <= "100001101111101";
when 7714 => note <= "100101001100110";
when 7715 => note <= "101100101011111";
when 7716 => note <= "110110100110001";
when 7717 => note <= "000000101111001";
when 7718 => note <= "001000111010011";
when 7719 => note <= "001101011111110";
when 7720 => note <= "001101110110110";
when 7721 => note <= "001010100000010";
when 7722 => note <= "000100111100011";
when 7723 => note <= "111111010000111";
when 7724 => note <= "111011100011001";
when 7725 => note <= "111011010100001";
when 7726 => note <= "111111000101101";
when 7727 => note <= "000110010000011";
when 7728 => note <= "001111001101111";
when 7729 => note <= "010111110011011";
when 7730 => note <= "011101110110110";
when 7731 => note <= "011111110011011";
when 7732 => note <= "011101000100110";
when 7733 => note <= "010110010000011";
when 7734 => note <= "001100111100011";
when 7735 => note <= "000011010100001";
when 7736 => note <= "111011100011001";
when 7737 => note <= "110111010000111";
when 7738 => note <= "110111000101101";
when 7739 => note <= "111010100000010";
when 7740 => note <= "000000000000000";
when 7741 => note <= "000101011111110";
when 7742 => note <= "001000111010011";
when 7743 => note <= "001000101111001";
when 7744 => note <= "000100011100111";
when 7745 => note <= "111100101011111";
when 7746 => note <= "110011000011101";
when 7747 => note <= "101001101111101";
when 7748 => note <= "100010111011010";
when 7749 => note <= "100000001100101";
when 7750 => note <= "100010001001010";
when 7751 => note <= "101000001100101";
when 7752 => note <= "110000110010001";
when 7753 => note <= "111001101111101";
when 7754 => note <= "000000111010011";
when 7755 => note <= "000100101011111";
when 7756 => note <= "000100011100111";
when 7757 => note <= "000000101111001";
when 7758 => note <= "111011000011101";
when 7759 => note <= "110101011111110";
when 7760 => note <= "110010001001010";
when 7761 => note <= "110010100000010";
when 7762 => note <= "110111000101101";
when 7763 => note <= "111111010000111";
when 7764 => note <= "001001011001111";
when 7765 => note <= "010011010100001";
when 7766 => note <= "011010110011010";
when 7767 => note <= "011110010000011";
when 7768 => note <= "011101000100110";
when 7769 => note <= "010111110011011";
when 7770 => note <= "010000000000000";
when 7771 => note <= "000111110011011";
when 7772 => note <= "000001010111001";
when 7773 => note <= "111110010000011";
when 7774 => note <= "111111000101101";
when 7775 => note <= "000011010100001";
when 7776 => note <= "001001011001111";
when 7777 => note <= "001111010000111";
when 7778 => note <= "010010110011010";
when 7779 => note <= "010010100000010";
when 7780 => note <= "001101110110110";
when 7781 => note <= "000101011111110";
when 7782 => note <= "111011000011101";
when 7783 => note <= "110000101111001";
when 7784 => note <= "101000101111010";
when 7785 => note <= "100100101011111";
when 7786 => note <= "100101001100110";
when 7787 => note <= "101001101111101";
when 7788 => note <= "110000110010001";
when 7789 => note <= "111000001100101";
when 7790 => note <= "111101110110110";
when 7791 => note <= "000000001100101";
when 7792 => note <= "111110101000111";
when 7793 => note <= "111001101111101";
when 7794 => note <= "110011000011101";
when 7795 => note <= "101100101011111";
when 7796 => note <= "101000101111010";
when 7797 => note <= "101000101111001";
when 7798 => note <= "101101001100110";
when 7799 => note <= "110101011111110";
when 7800 => note <= "000000000000000";
when 7801 => note <= "001010100000010";
when 7802 => note <= "010010110011010";
when 7803 => note <= "010111010000111";
when 7804 => note <= "010111010000110";
when 7805 => note <= "010011010100001";
when 7806 => note <= "001100111100011";
when 7807 => note <= "000110010000011";
when 7808 => note <= "000001010111001";
when 7809 => note <= "111111110011011";
when 7810 => note <= "000010001001010";
when 7811 => note <= "000111110011011";
when 7812 => note <= "001111001101111";
when 7813 => note <= "010110010000011";
when 7814 => note <= "011010110011010";
when 7815 => note <= "011011010100001";
when 7816 => note <= "010111010000110";
when 7817 => note <= "001111010000111";
when 7818 => note <= "000100111100011";
when 7819 => note <= "111010100000010";
when 7820 => note <= "110010001001010";
when 7821 => note <= "101101011111110";
when 7822 => note <= "101101001100110";
when 7823 => note <= "110000101111001";
when 7824 => note <= "110110100110001";
when 7825 => note <= "111100101011111";
when 7826 => note <= "000000111010011";
when 7827 => note <= "000001101111101";
when 7828 => note <= "111110101000111";
when 7829 => note <= "111000001100101";
when 7830 => note <= "110000000000000";
when 7831 => note <= "101000001100101";
when 7832 => note <= "100010111011010";
when 7833 => note <= "100001101111101";
when 7834 => note <= "100101001100110";
when 7835 => note <= "101100101011111";
when 7836 => note <= "110110100110001";
when 7837 => note <= "000000101111001";
when 7838 => note <= "001000111010011";
when 7839 => note <= "001101011111110";
when 7840 => note <= "001101110110110";
when 7841 => note <= "001010100000010";
when 7842 => note <= "000100111100011";
when 7843 => note <= "111111010000111";
when 7844 => note <= "111011100011001";
when 7845 => note <= "111011010100001";
when 7846 => note <= "111111000101101";
when 7847 => note <= "000110010000011";
when 7848 => note <= "001111001101111";
when 7849 => note <= "010111110011011";
when 7850 => note <= "011101110110110";
when 7851 => note <= "011111110011011";
when 7852 => note <= "011101000100110";
when 7853 => note <= "010110010000011";
when 7854 => note <= "001100111100011";
when 7855 => note <= "000011010100001";
when 7856 => note <= "111011100011001";
when 7857 => note <= "110111010000111";
when 7858 => note <= "110111000101101";
when 7859 => note <= "111010100000010";
when 7860 => note <= "000000000000000";
when 7861 => note <= "000101011111110";
when 7862 => note <= "001000111010011";
when 7863 => note <= "001000101111001";
when 7864 => note <= "000100011100111";
when 7865 => note <= "111100101011111";
when 7866 => note <= "110011000011101";
when 7867 => note <= "101001101111101";
when 7868 => note <= "100010111011010";
when 7869 => note <= "100000001100101";
when 7870 => note <= "100010001001010";
when 7871 => note <= "101000001100101";
when 7872 => note <= "110000110010001";
when 7873 => note <= "111001101111101";
when 7874 => note <= "000000111010011";
when 7875 => note <= "000100101011111";
when 7876 => note <= "000100011100111";
when 7877 => note <= "000000101111001";
when 7878 => note <= "111011000011101";
when 7879 => note <= "110101011111110";
when 7880 => note <= "110010001001010";
when 7881 => note <= "110010100000010";
when 7882 => note <= "110111000101101";
when 7883 => note <= "111111010000111";
when 7884 => note <= "001001011001111";
when 7885 => note <= "010011010100001";
when 7886 => note <= "011010110011010";
when 7887 => note <= "011110010000011";
when 7888 => note <= "011101000100110";
when 7889 => note <= "010111110011011";
when 7890 => note <= "010000000000000";
when 7891 => note <= "000111110011011";
when 7892 => note <= "000001010111001";
when 7893 => note <= "111110010000011";
when 7894 => note <= "111111000101101";
when 7895 => note <= "000011010100001";
when 7896 => note <= "001001011001111";
when 7897 => note <= "001111010000111";
when 7898 => note <= "010010110011010";
when 7899 => note <= "010010100000010";
when 7900 => note <= "001101110110110";
when 7901 => note <= "000101011111110";
when 7902 => note <= "111011000011101";
when 7903 => note <= "110000101111001";
when 7904 => note <= "101000101111010";
when 7905 => note <= "100100101011111";
when 7906 => note <= "100101001100110";
when 7907 => note <= "101001101111101";
when 7908 => note <= "110000110010001";
when 7909 => note <= "111000001100101";
when 7910 => note <= "111101110110110";
when 7911 => note <= "000000001100101";
when 7912 => note <= "111110101000111";
when 7913 => note <= "111001101111101";
when 7914 => note <= "110011000011101";
when 7915 => note <= "101100101011111";
when 7916 => note <= "101000101111010";
when 7917 => note <= "101000101111001";
when 7918 => note <= "101101001100110";
when 7919 => note <= "110101011111110";
when 7920 => note <= "000000000000000";
when 7921 => note <= "001010100000010";
when 7922 => note <= "010010110011010";
when 7923 => note <= "010111010000111";
when 7924 => note <= "010111010000110";
when 7925 => note <= "010011010100001";
when 7926 => note <= "001100111100011";
when 7927 => note <= "000110010000011";
when 7928 => note <= "000001010111001";
when 7929 => note <= "111111110011011";
when 7930 => note <= "000010001001010";
when 7931 => note <= "000111110011011";
when 7932 => note <= "001111001101111";
when 7933 => note <= "010110010000011";
when 7934 => note <= "011010110011010";
when 7935 => note <= "011011010100001";
when 7936 => note <= "010111010000110";
when 7937 => note <= "001111010000111";
when 7938 => note <= "000100111100011";
when 7939 => note <= "111010100000010";
when 7940 => note <= "110010001001010";
when 7941 => note <= "101101011111110";
when 7942 => note <= "101101001100110";
when 7943 => note <= "110000101111001";
when 7944 => note <= "110110100110001";
when 7945 => note <= "111100101011111";
when 7946 => note <= "000000111010011";
when 7947 => note <= "000001101111101";
when 7948 => note <= "111110101000111";
when 7949 => note <= "111000001100101";
when 7950 => note <= "110000000000000";
when 7951 => note <= "101000001100101";
when 7952 => note <= "100010111011010";
when 7953 => note <= "100001101111101";
when 7954 => note <= "100101001100110";
when 7955 => note <= "101100101011111";
when 7956 => note <= "110110100110001";
when 7957 => note <= "000000101111001";
when 7958 => note <= "001000111010011";
when 7959 => note <= "001101011111110";
when 7960 => note <= "001101110110110";
when 7961 => note <= "001010100000010";
when 7962 => note <= "000100111100011";
when 7963 => note <= "111111010000111";
when 7964 => note <= "111011100011001";
when 7965 => note <= "111011010100001";
when 7966 => note <= "111111000101101";
when 7967 => note <= "000110010000011";
when 7968 => note <= "001111001101111";
when 7969 => note <= "010111110011011";
when 7970 => note <= "011101110110110";
when 7971 => note <= "011111110011011";
when 7972 => note <= "011101000100110";
when 7973 => note <= "010110010000011";
when 7974 => note <= "001100111100011";
when 7975 => note <= "000011010100001";
when 7976 => note <= "111011100011001";
when 7977 => note <= "110111010000111";
when 7978 => note <= "110111000101101";
when 7979 => note <= "111010100000010";
when 7980 => note <= "000000000000000";
when 7981 => note <= "000101011111110";
when 7982 => note <= "001000111010011";
when 7983 => note <= "001000101111001";
when 7984 => note <= "000100011100111";
when 7985 => note <= "111100101011111";
when 7986 => note <= "110011000011101";
when 7987 => note <= "101001101111101";
when 7988 => note <= "100010111011010";
when 7989 => note <= "100000001100101";
when 7990 => note <= "100010001001010";
when 7991 => note <= "101000001100101";
when 7992 => note <= "110000110010001";
when 7993 => note <= "111001101111101";
when 7994 => note <= "000000111010011";
when 7995 => note <= "000100101011111";
when 7996 => note <= "000100011100111";
when 7997 => note <= "000000101111001";
when 7998 => note <= "111011000011101";
when 7999 => note <= "110101011111110";
when 8000 => note <= "110010001001010";
when 8001 => note <= "110010100000010";
when 8002 => note <= "110111000101101";
when 8003 => note <= "111111010000111";
when 8004 => note <= "001001011001111";
when 8005 => note <= "010011010100001";
when 8006 => note <= "011010110011010";
when 8007 => note <= "011110010000011";
when 8008 => note <= "011101000100110";
when 8009 => note <= "010111110011011";
when 8010 => note <= "010000000000000";
when 8011 => note <= "000111110011011";
when 8012 => note <= "000001010111001";
when 8013 => note <= "111110010000011";
when 8014 => note <= "111111000101101";
when 8015 => note <= "000011010100001";
when 8016 => note <= "001001011001111";
when 8017 => note <= "001111010000111";
when 8018 => note <= "010010110011010";
when 8019 => note <= "010010100000010";
when 8020 => note <= "001101110110110";
when 8021 => note <= "000101011111110";
when 8022 => note <= "111011000011101";
when 8023 => note <= "110000101111001";
when 8024 => note <= "101000101111010";
when 8025 => note <= "100100101011111";
when 8026 => note <= "100101001100110";
when 8027 => note <= "101001101111101";
when 8028 => note <= "110000110010001";
when 8029 => note <= "111000001100101";
when 8030 => note <= "111101110110110";
when 8031 => note <= "000000001100101";
when 8032 => note <= "111110101000111";
when 8033 => note <= "111001101111101";
when 8034 => note <= "110011000011101";
when 8035 => note <= "101100101011111";
when 8036 => note <= "101000101111010";
when 8037 => note <= "101000101111001";
when 8038 => note <= "101101001100110";
when 8039 => note <= "110101011111110";
when 8040 => note <= "000000000000000";
when 8041 => note <= "001010100000010";
when 8042 => note <= "010010110011010";
when 8043 => note <= "010111010000111";
when 8044 => note <= "010111010000110";
when 8045 => note <= "010011010100001";
when 8046 => note <= "001100111100011";
when 8047 => note <= "000110010000011";
when 8048 => note <= "000001010111001";
when 8049 => note <= "111111110011011";
when 8050 => note <= "000010001001010";
when 8051 => note <= "000111110011011";
when 8052 => note <= "001111001101111";
when 8053 => note <= "010110010000011";
when 8054 => note <= "011010110011010";
when 8055 => note <= "011011010100001";
when 8056 => note <= "010111010000110";
when 8057 => note <= "001111010000111";
when 8058 => note <= "000100111100011";
when 8059 => note <= "111010100000010";
when 8060 => note <= "110010001001010";
when 8061 => note <= "101101011111110";
when 8062 => note <= "101101001100110";
when 8063 => note <= "110000101111001";
when 8064 => note <= "110110100110001";
when 8065 => note <= "111100101011111";
when 8066 => note <= "000000111010011";
when 8067 => note <= "000001101111101";
when 8068 => note <= "111110101000111";
when 8069 => note <= "111000001100101";
when 8070 => note <= "110000000000000";
when 8071 => note <= "101000001100101";
when 8072 => note <= "100010111011010";
when 8073 => note <= "100001101111101";
when 8074 => note <= "100101001100110";
when 8075 => note <= "101100101011111";
when 8076 => note <= "110110100110001";
when 8077 => note <= "000000101111001";
when 8078 => note <= "001000111010011";
when 8079 => note <= "001101011111110";
when 8080 => note <= "001101110110110";
when 8081 => note <= "001010100000010";
when 8082 => note <= "000100111100011";
when 8083 => note <= "111111010000111";
when 8084 => note <= "111011100011001";
when 8085 => note <= "111011010100001";
when 8086 => note <= "111111000101101";
when 8087 => note <= "000110010000011";
when 8088 => note <= "001111001101111";
when 8089 => note <= "010111110011011";
when 8090 => note <= "011101110110110";
when 8091 => note <= "011111110011011";
when 8092 => note <= "011101000100110";
when 8093 => note <= "010110010000011";
when 8094 => note <= "001100111100011";
when 8095 => note <= "000011010100001";
when 8096 => note <= "111011100011001";
when 8097 => note <= "110111010000111";
when 8098 => note <= "110111000101101";
when 8099 => note <= "111010100000010";
when 8100 => note <= "000000000000000";
when 8101 => note <= "000101011111110";
when 8102 => note <= "001000111010011";
when 8103 => note <= "001000101111001";
when 8104 => note <= "000100011100111";
when 8105 => note <= "111100101011111";
when 8106 => note <= "110011000011101";
when 8107 => note <= "101001101111101";
when 8108 => note <= "100010111011010";
when 8109 => note <= "100000001100101";
when 8110 => note <= "100010001001010";
when 8111 => note <= "101000001100101";
when 8112 => note <= "110000110010001";
when 8113 => note <= "111001101111101";
when 8114 => note <= "000000111010011";
when 8115 => note <= "000100101011111";
when 8116 => note <= "000100011100111";
when 8117 => note <= "000000101111001";
when 8118 => note <= "111011000011101";
when 8119 => note <= "110101011111110";
when 8120 => note <= "110010001001010";
when 8121 => note <= "110010100000010";
when 8122 => note <= "110111000101101";
when 8123 => note <= "111111010000111";
when 8124 => note <= "001001011001111";
when 8125 => note <= "010011010100001";
when 8126 => note <= "011010110011010";
when 8127 => note <= "011110010000011";
when 8128 => note <= "011101000100110";
when 8129 => note <= "010111110011011";
when 8130 => note <= "010000000000000";
when 8131 => note <= "000111110011011";
when 8132 => note <= "000001010111001";
when 8133 => note <= "111110010000011";
when 8134 => note <= "111111000101101";
when 8135 => note <= "000011010100001";
when 8136 => note <= "001001011001111";
when 8137 => note <= "001111010000111";
when 8138 => note <= "010010110011010";
when 8139 => note <= "010010100000010";
when 8140 => note <= "001101110110110";
when 8141 => note <= "000101011111110";
when 8142 => note <= "111011000011101";
when 8143 => note <= "110000101111001";
when 8144 => note <= "101000101111010";
when 8145 => note <= "100100101011111";
when 8146 => note <= "100101001100110";
when 8147 => note <= "101001101111101";
when 8148 => note <= "110000110010001";
when 8149 => note <= "111000001100101";
when 8150 => note <= "111101110110110";
when 8151 => note <= "000000001100101";
when 8152 => note <= "111110101000111";
when 8153 => note <= "111001101111101";
when 8154 => note <= "110011000011101";
when 8155 => note <= "101100101011111";
when 8156 => note <= "101000101111010";
when 8157 => note <= "101000101111001";
when 8158 => note <= "101101001100110";
when 8159 => note <= "110101011111110";
when 8160 => note <= "000000000000000";
when 8161 => note <= "001010100000010";
when 8162 => note <= "010010110011010";
when 8163 => note <= "010111010000111";
when 8164 => note <= "010111010000110";
when 8165 => note <= "010011010100001";
when 8166 => note <= "001100111100011";
when 8167 => note <= "000110010000011";
when 8168 => note <= "000001010111001";
when 8169 => note <= "111111110011011";
when 8170 => note <= "000010001001010";
when 8171 => note <= "000111110011011";
when 8172 => note <= "001111001101111";
when 8173 => note <= "010110010000011";
when 8174 => note <= "011010110011010";
when 8175 => note <= "011011010100001";
when 8176 => note <= "010111010000110";
when 8177 => note <= "001111010000111";
when 8178 => note <= "000100111100011";
when 8179 => note <= "111010100000010";
when 8180 => note <= "110010001001010";
when 8181 => note <= "101101011111110";
when 8182 => note <= "101101001100110";
when 8183 => note <= "110000101111001";
when 8184 => note <= "110110100110001";
when 8185 => note <= "111100101011111";
when 8186 => note <= "000000111010011";
when 8187 => note <= "000001101111101";
when 8188 => note <= "111110101000111";
when 8189 => note <= "111000001100101";
when 8190 => note <= "110000000000000";
when 8191 => note <= "101000001100101";
when 8192 => note <= "100010111011010";
when 8193 => note <= "100001101111101";
when 8194 => note <= "100101001100110";
when 8195 => note <= "101100101011111";
when 8196 => note <= "110110100110001";
when 8197 => note <= "000000101111001";
when 8198 => note <= "001000111010011";
when 8199 => note <= "001101011111110";
when 8200 => note <= "001101110110110";
when 8201 => note <= "001010100000010";
when 8202 => note <= "000100111100011";
when 8203 => note <= "111111010000111";
when 8204 => note <= "111011100011001";
when 8205 => note <= "111011010100001";
when 8206 => note <= "111111000101101";
when 8207 => note <= "000110010000011";
when 8208 => note <= "001111001101111";
when 8209 => note <= "010111110011011";
when 8210 => note <= "011101110110110";
when 8211 => note <= "011111110011011";
when 8212 => note <= "011101000100110";
when 8213 => note <= "010110010000011";
when 8214 => note <= "001100111100011";
when 8215 => note <= "000011010100001";
when 8216 => note <= "111011100011001";
when 8217 => note <= "110111010000111";
when 8218 => note <= "110111000101101";
when 8219 => note <= "111010100000010";
when 8220 => note <= "000000000000000";
when 8221 => note <= "000101011111110";
when 8222 => note <= "001000111010011";
when 8223 => note <= "001000101111001";
when 8224 => note <= "000100011100111";
when 8225 => note <= "111100101011111";
when 8226 => note <= "110011000011101";
when 8227 => note <= "101001101111101";
when 8228 => note <= "100010111011010";
when 8229 => note <= "100000001100101";
when 8230 => note <= "100010001001010";
when 8231 => note <= "101000001100101";
when 8232 => note <= "110000110010001";
when 8233 => note <= "111001101111101";
when 8234 => note <= "000000111010011";
when 8235 => note <= "000100101011111";
when 8236 => note <= "000100011100111";
when 8237 => note <= "000000101111001";
when 8238 => note <= "111011000011101";
when 8239 => note <= "110101011111110";
when 8240 => note <= "110010001001010";
when 8241 => note <= "110010100000010";
when 8242 => note <= "110111000101101";
when 8243 => note <= "111111010000111";
when 8244 => note <= "001001011001111";
when 8245 => note <= "010011010100001";
when 8246 => note <= "011010110011010";
when 8247 => note <= "011110010000011";
when 8248 => note <= "011101000100110";
when 8249 => note <= "010111110011011";
when 8250 => note <= "010000000000000";
when 8251 => note <= "000111110011011";
when 8252 => note <= "000001010111001";
when 8253 => note <= "111110010000011";
when 8254 => note <= "111111000101101";
when 8255 => note <= "000011010100001";
when 8256 => note <= "001001011001111";
when 8257 => note <= "001111010000111";
when 8258 => note <= "010010110011010";
when 8259 => note <= "010010100000010";
when 8260 => note <= "001101110110110";
when 8261 => note <= "000101011111110";
when 8262 => note <= "111011000011101";
when 8263 => note <= "110000101111001";
when 8264 => note <= "101000101111010";
when 8265 => note <= "100100101011111";
when 8266 => note <= "100101001100110";
when 8267 => note <= "101001101111101";
when 8268 => note <= "110000110010001";
when 8269 => note <= "111000001100101";
when 8270 => note <= "111101110110110";
when 8271 => note <= "000000001100101";
when 8272 => note <= "111110101000111";
when 8273 => note <= "111001101111101";
when 8274 => note <= "110011000011101";
when 8275 => note <= "101100101011111";
when 8276 => note <= "101000101111010";
when 8277 => note <= "101000101111001";
when 8278 => note <= "101101001100110";
when 8279 => note <= "110101011111110";
when 8280 => note <= "000000000000000";
when 8281 => note <= "001010100000010";
when 8282 => note <= "010010110011010";
when 8283 => note <= "010111010000111";
when 8284 => note <= "010111010000110";
when 8285 => note <= "010011010100001";
when 8286 => note <= "001100111100011";
when 8287 => note <= "000110010000011";
when 8288 => note <= "000001010111001";
when 8289 => note <= "111111110011011";
when 8290 => note <= "000010001001010";
when 8291 => note <= "000111110011011";
when 8292 => note <= "001111001101111";
when 8293 => note <= "010110010000011";
when 8294 => note <= "011010110011010";
when 8295 => note <= "011011010100001";
when 8296 => note <= "010111010000110";
when 8297 => note <= "001111010000111";
when 8298 => note <= "000100111100011";
when 8299 => note <= "111010100000010";
when 8300 => note <= "110010001001010";
when 8301 => note <= "101101011111110";
when 8302 => note <= "101101001100110";
when 8303 => note <= "110000101111001";
when 8304 => note <= "110110100110001";
when 8305 => note <= "111100101011111";
when 8306 => note <= "000000111010011";
when 8307 => note <= "000001101111101";
when 8308 => note <= "111110101000111";
when 8309 => note <= "111000001100101";
when 8310 => note <= "110000000000000";
when 8311 => note <= "101000001100101";
when 8312 => note <= "100010111011010";
when 8313 => note <= "100001101111101";
when 8314 => note <= "100101001100110";
when 8315 => note <= "101100101011111";
when 8316 => note <= "110110100110001";
when 8317 => note <= "000000101111001";
when 8318 => note <= "001000111010011";
when 8319 => note <= "001101011111110";
when 8320 => note <= "001101110110110";
when 8321 => note <= "001010100000010";
when 8322 => note <= "000100111100011";
when 8323 => note <= "111111010000111";
when 8324 => note <= "111011100011001";
when 8325 => note <= "111011010100001";
when 8326 => note <= "111111000101101";
when 8327 => note <= "000110010000011";
when 8328 => note <= "001111001101111";
when 8329 => note <= "010111110011011";
when 8330 => note <= "011101110110110";
when 8331 => note <= "011111110011011";
when 8332 => note <= "011101000100110";
when 8333 => note <= "010110010000011";
when 8334 => note <= "001100111100011";
when 8335 => note <= "000011010100001";
when 8336 => note <= "111011100011001";
when 8337 => note <= "110111010000111";
when 8338 => note <= "110111000101101";
when 8339 => note <= "111010100000010";
when 8340 => note <= "000000000000000";
when 8341 => note <= "000101011111110";
when 8342 => note <= "001000111010011";
when 8343 => note <= "001000101111001";
when 8344 => note <= "000100011100111";
when 8345 => note <= "111100101011111";
when 8346 => note <= "110011000011101";
when 8347 => note <= "101001101111101";
when 8348 => note <= "100010111011010";
when 8349 => note <= "100000001100101";
when 8350 => note <= "100010001001010";
when 8351 => note <= "101000001100101";
when 8352 => note <= "110000110010001";
when 8353 => note <= "111001101111101";
when 8354 => note <= "000000111010011";
when 8355 => note <= "000100101011111";
when 8356 => note <= "000100011100111";
when 8357 => note <= "000000101111001";
when 8358 => note <= "111011000011101";
when 8359 => note <= "110101011111110";
when 8360 => note <= "110010001001010";
when 8361 => note <= "110010100000010";
when 8362 => note <= "110111000101101";
when 8363 => note <= "111111010000111";
when 8364 => note <= "001001011001111";
when 8365 => note <= "010011010100001";
when 8366 => note <= "011010110011010";
when 8367 => note <= "011110010000011";
when 8368 => note <= "011101000100110";
when 8369 => note <= "010111110011011";
when 8370 => note <= "010000000000000";
when 8371 => note <= "000111110011011";
when 8372 => note <= "000001010111001";
when 8373 => note <= "111110010000011";
when 8374 => note <= "111111000101101";
when 8375 => note <= "000011010100001";
when 8376 => note <= "001001011001111";
when 8377 => note <= "001111010000111";
when 8378 => note <= "010010110011010";
when 8379 => note <= "010010100000010";
when 8380 => note <= "001101110110110";
when 8381 => note <= "000101011111110";
when 8382 => note <= "111011000011101";
when 8383 => note <= "110000101111001";
when 8384 => note <= "101000101111010";
when 8385 => note <= "100100101011111";
when 8386 => note <= "100101001100110";
when 8387 => note <= "101001101111101";
when 8388 => note <= "110000110010001";
when 8389 => note <= "111000001100101";
when 8390 => note <= "111101110110110";
when 8391 => note <= "000000001100101";
when 8392 => note <= "111110101000111";
when 8393 => note <= "111001101111101";
when 8394 => note <= "110011000011101";
when 8395 => note <= "101100101011111";
when 8396 => note <= "101000101111010";
when 8397 => note <= "101000101111001";
when 8398 => note <= "101101001100110";
when 8399 => note <= "110101011111110";
when 8400 => note <= "000000000000000";
when 8401 => note <= "001010100000010";
when 8402 => note <= "010010110011010";
when 8403 => note <= "010111010000111";
when 8404 => note <= "010111010000110";
when 8405 => note <= "010011010100001";
when 8406 => note <= "001100111100011";
when 8407 => note <= "000110010000011";
when 8408 => note <= "000001010111001";
when 8409 => note <= "111111110011011";
when 8410 => note <= "000010001001010";
when 8411 => note <= "000111110011011";
when 8412 => note <= "001111001101111";
when 8413 => note <= "010110010000011";
when 8414 => note <= "011010110011010";
when 8415 => note <= "011011010100001";
when 8416 => note <= "010111010000110";
when 8417 => note <= "001111010000111";
when 8418 => note <= "000100111100011";
when 8419 => note <= "111010100000010";
when 8420 => note <= "110010001001010";
when 8421 => note <= "101101011111110";
when 8422 => note <= "101101001100110";
when 8423 => note <= "110000101111001";
when 8424 => note <= "110110100110001";
when 8425 => note <= "111100101011111";
when 8426 => note <= "000000111010011";
when 8427 => note <= "000001101111101";
when 8428 => note <= "111110101000111";
when 8429 => note <= "111000001100101";
when 8430 => note <= "110000000000000";
when 8431 => note <= "101000001100101";
when 8432 => note <= "100010111011010";
when 8433 => note <= "100001101111101";
when 8434 => note <= "100101001100110";
when 8435 => note <= "101100101011111";
when 8436 => note <= "110110100110001";
when 8437 => note <= "000000101111001";
when 8438 => note <= "001000111010011";
when 8439 => note <= "001101011111110";
when 8440 => note <= "001101110110110";
when 8441 => note <= "001010100000010";
when 8442 => note <= "000100111100011";
when 8443 => note <= "111111010000111";
when 8444 => note <= "111011100011001";
when 8445 => note <= "111011010100001";
when 8446 => note <= "111111000101101";
when 8447 => note <= "000110010000011";
when 8448 => note <= "001111001101111";
when 8449 => note <= "010111110011011";
when 8450 => note <= "011101110110110";
when 8451 => note <= "011111110011011";
when 8452 => note <= "011101000100110";
when 8453 => note <= "010110010000011";
when 8454 => note <= "001100111100011";
when 8455 => note <= "000011010100001";
when 8456 => note <= "111011100011001";
when 8457 => note <= "110111010000111";
when 8458 => note <= "110111000101101";
when 8459 => note <= "111010100000010";
when 8460 => note <= "000000000000000";
when 8461 => note <= "000101011111110";
when 8462 => note <= "001000111010011";
when 8463 => note <= "001000101111001";
when 8464 => note <= "000100011100111";
when 8465 => note <= "111100101011111";
when 8466 => note <= "110011000011101";
when 8467 => note <= "101001101111101";
when 8468 => note <= "100010111011010";
when 8469 => note <= "100000001100101";
when 8470 => note <= "100010001001010";
when 8471 => note <= "101000001100101";
when 8472 => note <= "110000110010001";
when 8473 => note <= "111001101111101";
when 8474 => note <= "000000111010011";
when 8475 => note <= "000100101011111";
when 8476 => note <= "000100011100111";
when 8477 => note <= "000000101111001";
when 8478 => note <= "111011000011101";
when 8479 => note <= "110101011111110";
when 8480 => note <= "110010001001010";
when 8481 => note <= "110010100000010";
when 8482 => note <= "110111000101101";
when 8483 => note <= "111111010000111";
when 8484 => note <= "001001011001111";
when 8485 => note <= "010011010100001";
when 8486 => note <= "011010110011010";
when 8487 => note <= "011110010000011";
when 8488 => note <= "011101000100110";
when 8489 => note <= "010111110011011";
when 8490 => note <= "010000000000000";
when 8491 => note <= "000111110011011";
when 8492 => note <= "000001010111001";
when 8493 => note <= "111110010000011";
when 8494 => note <= "111111000101101";
when 8495 => note <= "000011010100001";
when 8496 => note <= "001001011001111";
when 8497 => note <= "001111010000111";
when 8498 => note <= "010010110011010";
when 8499 => note <= "010010100000010";
when 8500 => note <= "001101110110110";
when 8501 => note <= "000101011111110";
when 8502 => note <= "111011000011101";
when 8503 => note <= "110000101111001";
when 8504 => note <= "101000101111010";
when 8505 => note <= "100100101011111";
when 8506 => note <= "100101001100110";
when 8507 => note <= "101001101111101";
when 8508 => note <= "110000110010001";
when 8509 => note <= "111000001100101";
when 8510 => note <= "111101110110110";
when 8511 => note <= "000000001100101";
when 8512 => note <= "111110101000111";
when 8513 => note <= "111001101111101";
when 8514 => note <= "110011000011101";
when 8515 => note <= "101100101011111";
when 8516 => note <= "101000101111010";
when 8517 => note <= "101000101111001";
when 8518 => note <= "101101001100110";
when 8519 => note <= "110101011111110";
when 8520 => note <= "000000000000000";
when 8521 => note <= "001010100000010";
when 8522 => note <= "010010110011010";
when 8523 => note <= "010111010000111";
when 8524 => note <= "010111010000110";
when 8525 => note <= "010011010100001";
when 8526 => note <= "001100111100011";
when 8527 => note <= "000110010000011";
when 8528 => note <= "000001010111001";
when 8529 => note <= "111111110011011";
when 8530 => note <= "000010001001010";
when 8531 => note <= "000111110011011";
when 8532 => note <= "001111001101111";
when 8533 => note <= "010110010000011";
when 8534 => note <= "011010110011010";
when 8535 => note <= "011011010100001";
when 8536 => note <= "010111010000110";
when 8537 => note <= "001111010000111";
when 8538 => note <= "000100111100011";
when 8539 => note <= "111010100000010";
when 8540 => note <= "110010001001010";
when 8541 => note <= "101101011111110";
when 8542 => note <= "101101001100110";
when 8543 => note <= "110000101111001";
when 8544 => note <= "110110100110001";
when 8545 => note <= "111100101011111";
when 8546 => note <= "000000111010011";
when 8547 => note <= "000001101111101";
when 8548 => note <= "111110101000111";
when 8549 => note <= "111000001100101";
when 8550 => note <= "110000000000000";
when 8551 => note <= "101000001100101";
when 8552 => note <= "100010111011010";
when 8553 => note <= "100001101111101";
when 8554 => note <= "100101001100110";
when 8555 => note <= "101100101011111";
when 8556 => note <= "110110100110001";
when 8557 => note <= "000000101111001";
when 8558 => note <= "001000111010011";
when 8559 => note <= "001101011111110";
when 8560 => note <= "001101110110110";
when 8561 => note <= "001010100000010";
when 8562 => note <= "000100111100011";
when 8563 => note <= "111111010000111";
when 8564 => note <= "111011100011001";
when 8565 => note <= "111011010100001";
when 8566 => note <= "111111000101101";
when 8567 => note <= "000110010000011";
when 8568 => note <= "001111001101111";
when 8569 => note <= "010111110011011";
when 8570 => note <= "011101110110110";
when 8571 => note <= "011111110011011";
when 8572 => note <= "011101000100110";
when 8573 => note <= "010110010000011";
when 8574 => note <= "001100111100011";
when 8575 => note <= "000011010100001";
when 8576 => note <= "111011100011001";
when 8577 => note <= "110111010000111";
when 8578 => note <= "110111000101101";
when 8579 => note <= "111010100000010";
when 8580 => note <= "000000000000000";
when 8581 => note <= "000101011111110";
when 8582 => note <= "001000111010011";
when 8583 => note <= "001000101111001";
when 8584 => note <= "000100011100111";
when 8585 => note <= "111100101011111";
when 8586 => note <= "110011000011101";
when 8587 => note <= "101001101111101";
when 8588 => note <= "100010111011010";
when 8589 => note <= "100000001100101";
when 8590 => note <= "100010001001010";
when 8591 => note <= "101000001100101";
when 8592 => note <= "110000110010001";
when 8593 => note <= "111001101111101";
when 8594 => note <= "000000111010011";
when 8595 => note <= "000100101011111";
when 8596 => note <= "000100011100111";
when 8597 => note <= "000000101111001";
when 8598 => note <= "111011000011101";
when 8599 => note <= "110101011111110";
when 8600 => note <= "110010001001010";
when 8601 => note <= "110010100000010";
when 8602 => note <= "110111000101101";
when 8603 => note <= "111111010000111";
when 8604 => note <= "001001011001111";
when 8605 => note <= "010011010100001";
when 8606 => note <= "011010110011010";
when 8607 => note <= "011110010000011";
when 8608 => note <= "011101000100110";
when 8609 => note <= "010111110011011";
when 8610 => note <= "010000000000000";
when 8611 => note <= "000111110011011";
when 8612 => note <= "000001010111001";
when 8613 => note <= "111110010000011";
when 8614 => note <= "111111000101101";
when 8615 => note <= "000011010100001";
when 8616 => note <= "001001011001111";
when 8617 => note <= "001111010000111";
when 8618 => note <= "010010110011010";
when 8619 => note <= "010010100000010";
when 8620 => note <= "001101110110110";
when 8621 => note <= "000101011111110";
when 8622 => note <= "111011000011101";
when 8623 => note <= "110000101111001";
when 8624 => note <= "101000101111010";
when 8625 => note <= "100100101011111";
when 8626 => note <= "100101001100110";
when 8627 => note <= "101001101111101";
when 8628 => note <= "110000110010001";
when 8629 => note <= "111000001100101";
when 8630 => note <= "111101110110110";
when 8631 => note <= "000000001100101";
when 8632 => note <= "111110101000111";
when 8633 => note <= "111001101111101";
when 8634 => note <= "110011000011101";
when 8635 => note <= "101100101011111";
when 8636 => note <= "101000101111010";
when 8637 => note <= "101000101111001";
when 8638 => note <= "101101001100110";
when 8639 => note <= "110101011111110";
when 8640 => note <= "000000000000000";
when 8641 => note <= "001010100000010";
when 8642 => note <= "010010110011010";
when 8643 => note <= "010111010000111";
when 8644 => note <= "010111010000110";
when 8645 => note <= "010011010100001";
when 8646 => note <= "001100111100011";
when 8647 => note <= "000110010000011";
when 8648 => note <= "000001010111001";
when 8649 => note <= "111111110011011";
when 8650 => note <= "000010001001010";
when 8651 => note <= "000111110011011";
when 8652 => note <= "001111001101111";
when 8653 => note <= "010110010000011";
when 8654 => note <= "011010110011010";
when 8655 => note <= "011011010100001";
when 8656 => note <= "010111010000110";
when 8657 => note <= "001111010000111";
when 8658 => note <= "000100111100011";
when 8659 => note <= "111010100000010";
when 8660 => note <= "110010001001010";
when 8661 => note <= "101101011111110";
when 8662 => note <= "101101001100110";
when 8663 => note <= "110000101111001";
when 8664 => note <= "110110100110001";
when 8665 => note <= "111100101011111";
when 8666 => note <= "000000111010011";
when 8667 => note <= "000001101111101";
when 8668 => note <= "111110101000111";
when 8669 => note <= "111000001100101";
when 8670 => note <= "110000000000000";
when 8671 => note <= "101000001100101";
when 8672 => note <= "100010111011010";
when 8673 => note <= "100001101111101";
when 8674 => note <= "100101001100110";
when 8675 => note <= "101100101011111";
when 8676 => note <= "110110100110001";
when 8677 => note <= "000000101111001";
when 8678 => note <= "001000111010011";
when 8679 => note <= "001101011111110";
when 8680 => note <= "001101110110110";
when 8681 => note <= "001010100000010";
when 8682 => note <= "000100111100011";
when 8683 => note <= "111111010000111";
when 8684 => note <= "111011100011001";
when 8685 => note <= "111011010100001";
when 8686 => note <= "111111000101101";
when 8687 => note <= "000110010000011";
when 8688 => note <= "001111001101111";
when 8689 => note <= "010111110011011";
when 8690 => note <= "011101110110110";
when 8691 => note <= "011111110011011";
when 8692 => note <= "011101000100110";
when 8693 => note <= "010110010000011";
when 8694 => note <= "001100111100011";
when 8695 => note <= "000011010100001";
when 8696 => note <= "111011100011001";
when 8697 => note <= "110111010000111";
when 8698 => note <= "110111000101101";
when 8699 => note <= "111010100000010";
when 8700 => note <= "000000000000000";
when 8701 => note <= "000101011111110";
when 8702 => note <= "001000111010011";
when 8703 => note <= "001000101111001";
when 8704 => note <= "000100011100111";
when 8705 => note <= "111100101011111";
when 8706 => note <= "110011000011101";
when 8707 => note <= "101001101111101";
when 8708 => note <= "100010111011010";
when 8709 => note <= "100000001100101";
when 8710 => note <= "100010001001010";
when 8711 => note <= "101000001100101";
when 8712 => note <= "110000110010001";
when 8713 => note <= "111001101111101";
when 8714 => note <= "000000111010011";
when 8715 => note <= "000100101011111";
when 8716 => note <= "000100011100111";
when 8717 => note <= "000000101111001";
when 8718 => note <= "111011000011101";
when 8719 => note <= "110101011111110";
when 8720 => note <= "110010001001010";
when 8721 => note <= "110010100000010";
when 8722 => note <= "110111000101101";
when 8723 => note <= "111111010000111";
when 8724 => note <= "001001011001111";
when 8725 => note <= "010011010100001";
when 8726 => note <= "011010110011010";
when 8727 => note <= "011110010000011";
when 8728 => note <= "011101000100110";
when 8729 => note <= "010111110011011";
when 8730 => note <= "010000000000000";
when 8731 => note <= "000111110011011";
when 8732 => note <= "000001010111001";
when 8733 => note <= "111110010000011";
when 8734 => note <= "111111000101101";
when 8735 => note <= "000011010100001";
when 8736 => note <= "001001011001111";
when 8737 => note <= "001111010000111";
when 8738 => note <= "010010110011010";
when 8739 => note <= "010010100000010";
when 8740 => note <= "001101110110110";
when 8741 => note <= "000101011111110";
when 8742 => note <= "111011000011101";
when 8743 => note <= "110000101111001";
when 8744 => note <= "101000101111010";
when 8745 => note <= "100100101011111";
when 8746 => note <= "100101001100110";
when 8747 => note <= "101001101111101";
when 8748 => note <= "110000110010001";
when 8749 => note <= "111000001100101";
when 8750 => note <= "111101110110110";
when 8751 => note <= "000000001100101";
when 8752 => note <= "111110101000111";
when 8753 => note <= "111001101111101";
when 8754 => note <= "110011000011101";
when 8755 => note <= "101100101011111";
when 8756 => note <= "101000101111010";
when 8757 => note <= "101000101111001";
when 8758 => note <= "101101001100110";
when 8759 => note <= "110101011111110";
when 8760 => note <= "000000000000000";
when 8761 => note <= "001010100000010";
when 8762 => note <= "010010110011010";
when 8763 => note <= "010111010000111";
when 8764 => note <= "010111010000110";
when 8765 => note <= "010011010100001";
when 8766 => note <= "001100111100011";
when 8767 => note <= "000110010000011";
when 8768 => note <= "000001010111001";
when 8769 => note <= "111111110011011";
when 8770 => note <= "000010001001010";
when 8771 => note <= "000111110011011";
when 8772 => note <= "001111001101111";
when 8773 => note <= "010110010000011";
when 8774 => note <= "011010110011010";
when 8775 => note <= "011011010100001";
when 8776 => note <= "010111010000110";
when 8777 => note <= "001111010000111";
when 8778 => note <= "000100111100011";
when 8779 => note <= "111010100000010";
when 8780 => note <= "110010001001010";
when 8781 => note <= "101101011111110";
when 8782 => note <= "101101001100110";
when 8783 => note <= "110000101111001";
when 8784 => note <= "110110100110001";
when 8785 => note <= "111100101011111";
when 8786 => note <= "000000111010011";
when 8787 => note <= "000001101111101";
when 8788 => note <= "111110101000111";
when 8789 => note <= "111000001100101";
when 8790 => note <= "110000000000000";
when 8791 => note <= "101000001100101";
when 8792 => note <= "100010111011010";
when 8793 => note <= "100001101111101";
when 8794 => note <= "100101001100110";
when 8795 => note <= "101100101011111";
when 8796 => note <= "110110100110001";
when 8797 => note <= "000000101111001";
when 8798 => note <= "001000111010011";
when 8799 => note <= "001101011111110";
when 8800 => note <= "001101110110110";
when 8801 => note <= "001010100000010";
when 8802 => note <= "000100111100011";
when 8803 => note <= "111111010000111";
when 8804 => note <= "111011100011001";
when 8805 => note <= "111011010100001";
when 8806 => note <= "111111000101101";
when 8807 => note <= "000110010000011";
when 8808 => note <= "001111001101111";
when 8809 => note <= "010111110011011";
when 8810 => note <= "011101110110110";
when 8811 => note <= "011111110011011";
when 8812 => note <= "011101000100110";
when 8813 => note <= "010110010000011";
when 8814 => note <= "001100111100011";
when 8815 => note <= "000011010100001";
when 8816 => note <= "111011100011001";
when 8817 => note <= "110111010000111";
when 8818 => note <= "110111000101101";
when 8819 => note <= "111010100000010";
when 8820 => note <= "000000000000000";
when 8821 => note <= "000101011111110";
when 8822 => note <= "001000111010011";
when 8823 => note <= "001000101111001";
when 8824 => note <= "000100011100111";
when 8825 => note <= "111100101011111";
when 8826 => note <= "110011000011101";
when 8827 => note <= "101001101111101";
when 8828 => note <= "100010111011010";
when 8829 => note <= "100000001100101";
when 8830 => note <= "100010001001010";
when 8831 => note <= "101000001100101";
when 8832 => note <= "110000110010001";
when 8833 => note <= "111001101111101";
when 8834 => note <= "000000111010011";
when 8835 => note <= "000100101011111";
when 8836 => note <= "000100011100111";
when 8837 => note <= "000000101111001";
when 8838 => note <= "111011000011101";
when 8839 => note <= "110101011111110";
when 8840 => note <= "110010001001010";
when 8841 => note <= "110010100000010";
when 8842 => note <= "110111000101101";
when 8843 => note <= "111111010000111";
when 8844 => note <= "001001011001111";
when 8845 => note <= "010011010100001";
when 8846 => note <= "011010110011010";
when 8847 => note <= "011110010000011";
when 8848 => note <= "011101000100110";
when 8849 => note <= "010111110011011";
when 8850 => note <= "010000000000000";
when 8851 => note <= "000111110011011";
when 8852 => note <= "000001010111001";
when 8853 => note <= "111110010000011";
when 8854 => note <= "111111000101101";
when 8855 => note <= "000011010100001";
when 8856 => note <= "001001011001111";
when 8857 => note <= "001111010000111";
when 8858 => note <= "010010110011010";
when 8859 => note <= "010010100000010";
when 8860 => note <= "001101110110110";
when 8861 => note <= "000101011111110";
when 8862 => note <= "111011000011101";
when 8863 => note <= "110000101111001";
when 8864 => note <= "101000101111010";
when 8865 => note <= "100100101011111";
when 8866 => note <= "100101001100110";
when 8867 => note <= "101001101111101";
when 8868 => note <= "110000110010001";
when 8869 => note <= "111000001100101";
when 8870 => note <= "111101110110110";
when 8871 => note <= "000000001100101";
when 8872 => note <= "111110101000111";
when 8873 => note <= "111001101111101";
when 8874 => note <= "110011000011101";
when 8875 => note <= "101100101011111";
when 8876 => note <= "101000101111010";
when 8877 => note <= "101000101111001";
when 8878 => note <= "101101001100110";
when 8879 => note <= "110101011111110";
when 8880 => note <= "000000000000000";
when 8881 => note <= "001010100000010";
when 8882 => note <= "010010110011010";
when 8883 => note <= "010111010000111";
when 8884 => note <= "010111010000110";
when 8885 => note <= "010011010100001";
when 8886 => note <= "001100111100011";
when 8887 => note <= "000110010000011";
when 8888 => note <= "000001010111001";
when 8889 => note <= "111111110011011";
when 8890 => note <= "000010001001010";
when 8891 => note <= "000111110011011";
when 8892 => note <= "001111001101111";
when 8893 => note <= "010110010000011";
when 8894 => note <= "011010110011010";
when 8895 => note <= "011011010100001";
when 8896 => note <= "010111010000110";
when 8897 => note <= "001111010000111";
when 8898 => note <= "000100111100011";
when 8899 => note <= "111010100000010";
when 8900 => note <= "110010001001010";
when 8901 => note <= "101101011111110";
when 8902 => note <= "101101001100110";
when 8903 => note <= "110000101111001";
when 8904 => note <= "110110100110001";
when 8905 => note <= "111100101011111";
when 8906 => note <= "000000111010011";
when 8907 => note <= "000001101111101";
when 8908 => note <= "111110101000111";
when 8909 => note <= "111000001100101";
when 8910 => note <= "110000000000000";
when 8911 => note <= "101000001100101";
when 8912 => note <= "100010111011010";
when 8913 => note <= "100001101111101";
when 8914 => note <= "100101001100110";
when 8915 => note <= "101100101011111";
when 8916 => note <= "110110100110001";
when 8917 => note <= "000000101111001";
when 8918 => note <= "001000111010011";
when 8919 => note <= "001101011111110";
when 8920 => note <= "001101110110110";
when 8921 => note <= "001010100000010";
when 8922 => note <= "000100111100011";
when 8923 => note <= "111111010000111";
when 8924 => note <= "111011100011001";
when 8925 => note <= "111011010100001";
when 8926 => note <= "111111000101101";
when 8927 => note <= "000110010000011";
when 8928 => note <= "001111001101111";
when 8929 => note <= "010111110011011";
when 8930 => note <= "011101110110110";
when 8931 => note <= "011111110011011";
when 8932 => note <= "011101000100110";
when 8933 => note <= "010110010000011";
when 8934 => note <= "001100111100011";
when 8935 => note <= "000011010100001";
when 8936 => note <= "111011100011001";
when 8937 => note <= "110111010000111";
when 8938 => note <= "110111000101101";
when 8939 => note <= "111010100000010";
when 8940 => note <= "000000000000000";
when 8941 => note <= "000101011111110";
when 8942 => note <= "001000111010011";
when 8943 => note <= "001000101111001";
when 8944 => note <= "000100011100111";
when 8945 => note <= "111100101011111";
when 8946 => note <= "110011000011101";
when 8947 => note <= "101001101111101";
when 8948 => note <= "100010111011010";
when 8949 => note <= "100000001100101";
when 8950 => note <= "100010001001010";
when 8951 => note <= "101000001100101";
when 8952 => note <= "110000110010001";
when 8953 => note <= "111001101111101";
when 8954 => note <= "000000111010011";
when 8955 => note <= "000100101011111";
when 8956 => note <= "000100011100111";
when 8957 => note <= "000000101111001";
when 8958 => note <= "111011000011101";
when 8959 => note <= "110101011111110";
when 8960 => note <= "110010001001010";
when 8961 => note <= "110010100000010";
when 8962 => note <= "110111000101101";
when 8963 => note <= "111111010000111";
when 8964 => note <= "001001011001111";
when 8965 => note <= "010011010100001";
when 8966 => note <= "011010110011010";
when 8967 => note <= "011110010000011";
when 8968 => note <= "011101000100110";
when 8969 => note <= "010111110011011";
when 8970 => note <= "010000000000000";
when 8971 => note <= "000111110011011";
when 8972 => note <= "000001010111001";
when 8973 => note <= "111110010000011";
when 8974 => note <= "111111000101101";
when 8975 => note <= "000011010100001";
when 8976 => note <= "001001011001111";
when 8977 => note <= "001111010000111";
when 8978 => note <= "010010110011010";
when 8979 => note <= "010010100000010";
when 8980 => note <= "001101110110110";
when 8981 => note <= "000101011111110";
when 8982 => note <= "111011000011101";
when 8983 => note <= "110000101111001";
when 8984 => note <= "101000101111010";
when 8985 => note <= "100100101011111";
when 8986 => note <= "100101001100110";
when 8987 => note <= "101001101111101";
when 8988 => note <= "110000110010001";
when 8989 => note <= "111000001100101";
when 8990 => note <= "111101110110110";
when 8991 => note <= "000000001100101";
when 8992 => note <= "111110101000111";
when 8993 => note <= "111001101111101";
when 8994 => note <= "110011000011101";
when 8995 => note <= "101100101011111";
when 8996 => note <= "101000101111010";
when 8997 => note <= "101000101111001";
when 8998 => note <= "101101001100110";
when 8999 => note <= "110101011111110";
when 9000 => note <= "000000000000000";
when 9001 => note <= "001010100000010";
when 9002 => note <= "010010110011010";
when 9003 => note <= "010111010000111";
when 9004 => note <= "010111010000110";
when 9005 => note <= "010011010100001";
when 9006 => note <= "001100111100011";
when 9007 => note <= "000110010000011";
when 9008 => note <= "000001010111001";
when 9009 => note <= "111111110011011";
when 9010 => note <= "000010001001010";
when 9011 => note <= "000111110011011";
when 9012 => note <= "001111001101111";
when 9013 => note <= "010110010000011";
when 9014 => note <= "011010110011010";
when 9015 => note <= "011011010100001";
when 9016 => note <= "010111010000110";
when 9017 => note <= "001111010000111";
when 9018 => note <= "000100111100011";
when 9019 => note <= "111010100000010";
when 9020 => note <= "110010001001010";
when 9021 => note <= "101101011111110";
when 9022 => note <= "101101001100110";
when 9023 => note <= "110000101111001";
when 9024 => note <= "110110100110001";
when 9025 => note <= "111100101011111";
when 9026 => note <= "000000111010011";
when 9027 => note <= "000001101111101";
when 9028 => note <= "111110101000111";
when 9029 => note <= "111000001100101";
when 9030 => note <= "110000000000000";
when 9031 => note <= "101000001100101";
when 9032 => note <= "100010111011010";
when 9033 => note <= "100001101111101";
when 9034 => note <= "100101001100110";
when 9035 => note <= "101100101011111";
when 9036 => note <= "110110100110001";
when 9037 => note <= "000000101111001";
when 9038 => note <= "001000111010011";
when 9039 => note <= "001101011111110";
when 9040 => note <= "001101110110110";
when 9041 => note <= "001010100000010";
when 9042 => note <= "000100111100011";
when 9043 => note <= "111111010000111";
when 9044 => note <= "111011100011001";
when 9045 => note <= "111011010100001";
when 9046 => note <= "111111000101101";
when 9047 => note <= "000110010000011";
when 9048 => note <= "001111001101111";
when 9049 => note <= "010111110011011";
when 9050 => note <= "011101110110110";
when 9051 => note <= "011111110011011";
when 9052 => note <= "011101000100110";
when 9053 => note <= "010110010000011";
when 9054 => note <= "001100111100011";
when 9055 => note <= "000011010100001";
when 9056 => note <= "111011100011001";
when 9057 => note <= "110111010000111";
when 9058 => note <= "110111000101101";
when 9059 => note <= "111010100000010";
when 9060 => note <= "000000000000000";
when 9061 => note <= "000101011111110";
when 9062 => note <= "001000111010011";
when 9063 => note <= "001000101111001";
when 9064 => note <= "000100011100111";
when 9065 => note <= "111100101011111";
when 9066 => note <= "110011000011101";
when 9067 => note <= "101001101111101";
when 9068 => note <= "100010111011010";
when 9069 => note <= "100000001100101";
when 9070 => note <= "100010001001010";
when 9071 => note <= "101000001100101";
when 9072 => note <= "110000110010001";
when 9073 => note <= "111001101111101";
when 9074 => note <= "000000111010011";
when 9075 => note <= "000100101011111";
when 9076 => note <= "000100011100111";
when 9077 => note <= "000000101111001";
when 9078 => note <= "111011000011101";
when 9079 => note <= "110101011111110";
when 9080 => note <= "110010001001010";
when 9081 => note <= "110010100000010";
when 9082 => note <= "110111000101101";
when 9083 => note <= "111111010000111";
when 9084 => note <= "001001011001111";
when 9085 => note <= "010011010100001";
when 9086 => note <= "011010110011010";
when 9087 => note <= "011110010000011";
when 9088 => note <= "011101000100110";
when 9089 => note <= "010111110011011";
when 9090 => note <= "010000000000000";
when 9091 => note <= "000111110011011";
when 9092 => note <= "000001010111001";
when 9093 => note <= "111110010000011";
when 9094 => note <= "111111000101101";
when 9095 => note <= "000011010100001";
when 9096 => note <= "001001011001111";
when 9097 => note <= "001111010000111";
when 9098 => note <= "010010110011010";
when 9099 => note <= "010010100000010";
when 9100 => note <= "001101110110110";
when 9101 => note <= "000101011111110";
when 9102 => note <= "111011000011101";
when 9103 => note <= "110000101111001";
when 9104 => note <= "101000101111010";
when 9105 => note <= "100100101011111";
when 9106 => note <= "100101001100110";
when 9107 => note <= "101001101111101";
when 9108 => note <= "110000110010001";
when 9109 => note <= "111000001100101";
when 9110 => note <= "111101110110110";
when 9111 => note <= "000000001100101";
when 9112 => note <= "111110101000111";
when 9113 => note <= "111001101111101";
when 9114 => note <= "110011000011101";
when 9115 => note <= "101100101011111";
when 9116 => note <= "101000101111010";
when 9117 => note <= "101000101111001";
when 9118 => note <= "101101001100110";
when 9119 => note <= "110101011111110";
when 9120 => note <= "000000000000000";
when 9121 => note <= "001010100000010";
when 9122 => note <= "010010110011010";
when 9123 => note <= "010111010000111";
when 9124 => note <= "010111010000110";
when 9125 => note <= "010011010100001";
when 9126 => note <= "001100111100011";
when 9127 => note <= "000110010000011";
when 9128 => note <= "000001010111001";
when 9129 => note <= "111111110011011";
when 9130 => note <= "000010001001010";
when 9131 => note <= "000111110011011";
when 9132 => note <= "001111001101111";
when 9133 => note <= "010110010000011";
when 9134 => note <= "011010110011010";
when 9135 => note <= "011011010100001";
when 9136 => note <= "010111010000110";
when 9137 => note <= "001111010000111";
when 9138 => note <= "000100111100011";
when 9139 => note <= "111010100000010";
when 9140 => note <= "110010001001010";
when 9141 => note <= "101101011111110";
when 9142 => note <= "101101001100110";
when 9143 => note <= "110000101111001";
when 9144 => note <= "110110100110001";
when 9145 => note <= "111100101011111";
when 9146 => note <= "000000111010011";
when 9147 => note <= "000001101111101";
when 9148 => note <= "111110101000111";
when 9149 => note <= "111000001100101";
when 9150 => note <= "110000000000000";
when 9151 => note <= "101000001100101";
when 9152 => note <= "100010111011010";
when 9153 => note <= "100001101111101";
when 9154 => note <= "100101001100110";
when 9155 => note <= "101100101011111";
when 9156 => note <= "110110100110001";
when 9157 => note <= "000000101111001";
when 9158 => note <= "001000111010011";
when 9159 => note <= "001101011111110";
when 9160 => note <= "001101110110110";
when 9161 => note <= "001010100000010";
when 9162 => note <= "000100111100011";
when 9163 => note <= "111111010000111";
when 9164 => note <= "111011100011001";
when 9165 => note <= "111011010100001";
when 9166 => note <= "111111000101101";
when 9167 => note <= "000110010000011";
when 9168 => note <= "001111001101111";
when 9169 => note <= "010111110011011";
when 9170 => note <= "011101110110110";
when 9171 => note <= "011111110011011";
when 9172 => note <= "011101000100110";
when 9173 => note <= "010110010000011";
when 9174 => note <= "001100111100011";
when 9175 => note <= "000011010100001";
when 9176 => note <= "111011100011001";
when 9177 => note <= "110111010000111";
when 9178 => note <= "110111000101101";
when 9179 => note <= "111010100000010";
when 9180 => note <= "000000000000000";
when 9181 => note <= "000101011111110";
when 9182 => note <= "001000111010011";
when 9183 => note <= "001000101111001";
when 9184 => note <= "000100011100111";
when 9185 => note <= "111100101011111";
when 9186 => note <= "110011000011101";
when 9187 => note <= "101001101111101";
when 9188 => note <= "100010111011010";
when 9189 => note <= "100000001100101";
when 9190 => note <= "100010001001010";
when 9191 => note <= "101000001100101";
when 9192 => note <= "110000110010001";
when 9193 => note <= "111001101111101";
when 9194 => note <= "000000111010011";
when 9195 => note <= "000100101011111";
when 9196 => note <= "000100011100111";
when 9197 => note <= "000000101111001";
when 9198 => note <= "111011000011101";
when 9199 => note <= "110101011111110";
when 9200 => note <= "110010001001010";
when 9201 => note <= "110010100000010";
when 9202 => note <= "110111000101101";
when 9203 => note <= "111111010000111";
when 9204 => note <= "001001011001111";
when 9205 => note <= "010011010100001";
when 9206 => note <= "011010110011010";
when 9207 => note <= "011110010000011";
when 9208 => note <= "011101000100110";
when 9209 => note <= "010111110011011";
when 9210 => note <= "010000000000000";
when 9211 => note <= "000111110011011";
when 9212 => note <= "000001010111001";
when 9213 => note <= "111110010000011";
when 9214 => note <= "111111000101101";
when 9215 => note <= "000011010100001";
when 9216 => note <= "001001011001111";
when 9217 => note <= "001111010000111";
when 9218 => note <= "010010110011010";
when 9219 => note <= "010010100000010";
when 9220 => note <= "001101110110110";
when 9221 => note <= "000101011111110";
when 9222 => note <= "111011000011101";
when 9223 => note <= "110000101111001";
when 9224 => note <= "101000101111010";
when 9225 => note <= "100100101011111";
when 9226 => note <= "100101001100110";
when 9227 => note <= "101001101111101";
when 9228 => note <= "110000110010001";
when 9229 => note <= "111000001100101";
when 9230 => note <= "111101110110110";
when 9231 => note <= "000000001100101";
when 9232 => note <= "111110101000111";
when 9233 => note <= "111001101111101";
when 9234 => note <= "110011000011101";
when 9235 => note <= "101100101011111";
when 9236 => note <= "101000101111010";
when 9237 => note <= "101000101111001";
when 9238 => note <= "101101001100110";
when 9239 => note <= "110101011111110";
when 9240 => note <= "000000000000000";
when 9241 => note <= "001010100000010";
when 9242 => note <= "010010110011010";
when 9243 => note <= "010111010000111";
when 9244 => note <= "010111010000110";
when 9245 => note <= "010011010100001";
when 9246 => note <= "001100111100011";
when 9247 => note <= "000110010000011";
when 9248 => note <= "000001010111001";
when 9249 => note <= "111111110011011";
when 9250 => note <= "000010001001010";
when 9251 => note <= "000111110011011";
when 9252 => note <= "001111001101111";
when 9253 => note <= "010110010000011";
when 9254 => note <= "011010110011010";
when 9255 => note <= "011011010100001";
when 9256 => note <= "010111010000110";
when 9257 => note <= "001111010000111";
when 9258 => note <= "000100111100011";
when 9259 => note <= "111010100000010";
when 9260 => note <= "110010001001010";
when 9261 => note <= "101101011111110";
when 9262 => note <= "101101001100110";
when 9263 => note <= "110000101111001";
when 9264 => note <= "110110100110001";
when 9265 => note <= "111100101011111";
when 9266 => note <= "000000111010011";
when 9267 => note <= "000001101111101";
when 9268 => note <= "111110101000111";
when 9269 => note <= "111000001100101";
when 9270 => note <= "110000000000000";
when 9271 => note <= "101000001100101";
when 9272 => note <= "100010111011010";
when 9273 => note <= "100001101111101";
when 9274 => note <= "100101001100110";
when 9275 => note <= "101100101011111";
when 9276 => note <= "110110100110001";
when 9277 => note <= "000000101111001";
when 9278 => note <= "001000111010011";
when 9279 => note <= "001101011111110";
when 9280 => note <= "001101110110110";
when 9281 => note <= "001010100000010";
when 9282 => note <= "000100111100011";
when 9283 => note <= "111111010000111";
when 9284 => note <= "111011100011001";
when 9285 => note <= "111011010100001";
when 9286 => note <= "111111000101101";
when 9287 => note <= "000110010000011";
when 9288 => note <= "001111001101111";
when 9289 => note <= "010111110011011";
when 9290 => note <= "011101110110110";
when 9291 => note <= "011111110011011";
when 9292 => note <= "011101000100110";
when 9293 => note <= "010110010000011";
when 9294 => note <= "001100111100011";
when 9295 => note <= "000011010100001";
when 9296 => note <= "111011100011001";
when 9297 => note <= "110111010000111";
when 9298 => note <= "110111000101101";
when 9299 => note <= "111010100000010";
when 9300 => note <= "000000000000000";
when 9301 => note <= "000101011111110";
when 9302 => note <= "001000111010011";
when 9303 => note <= "001000101111001";
when 9304 => note <= "000100011100111";
when 9305 => note <= "111100101011111";
when 9306 => note <= "110011000011101";
when 9307 => note <= "101001101111101";
when 9308 => note <= "100010111011010";
when 9309 => note <= "100000001100101";
when 9310 => note <= "100010001001010";
when 9311 => note <= "101000001100101";
when 9312 => note <= "110000110010001";
when 9313 => note <= "111001101111101";
when 9314 => note <= "000000111010011";
when 9315 => note <= "000100101011111";
when 9316 => note <= "000100011100111";
when 9317 => note <= "000000101111001";
when 9318 => note <= "111011000011101";
when 9319 => note <= "110101011111110";
when 9320 => note <= "110010001001010";
when 9321 => note <= "110010100000010";
when 9322 => note <= "110111000101101";
when 9323 => note <= "111111010000111";
when 9324 => note <= "001001011001111";
when 9325 => note <= "010011010100001";
when 9326 => note <= "011010110011010";
when 9327 => note <= "011110010000011";
when 9328 => note <= "011101000100110";
when 9329 => note <= "010111110011011";
when 9330 => note <= "010000000000000";
when 9331 => note <= "000111110011011";
when 9332 => note <= "000001010111001";
when 9333 => note <= "111110010000011";
when 9334 => note <= "111111000101101";
when 9335 => note <= "000011010100001";
when 9336 => note <= "001001011001111";
when 9337 => note <= "001111010000111";
when 9338 => note <= "010010110011010";
when 9339 => note <= "010010100000010";
when 9340 => note <= "001101110110110";
when 9341 => note <= "000101011111110";
when 9342 => note <= "111011000011101";
when 9343 => note <= "110000101111001";
when 9344 => note <= "101000101111010";
when 9345 => note <= "100100101011111";
when 9346 => note <= "100101001100110";
when 9347 => note <= "101001101111101";
when 9348 => note <= "110000110010001";
when 9349 => note <= "111000001100101";
when 9350 => note <= "111101110110110";
when 9351 => note <= "000000001100101";
when 9352 => note <= "111110101000111";
when 9353 => note <= "111001101111101";
when 9354 => note <= "110011000011101";
when 9355 => note <= "101100101011111";
when 9356 => note <= "101000101111010";
when 9357 => note <= "101000101111001";
when 9358 => note <= "101101001100110";
when 9359 => note <= "110101011111110";
when 9360 => note <= "000000000000000";
when 9361 => note <= "001010100000010";
when 9362 => note <= "010010110011010";
when 9363 => note <= "010111010000111";
when 9364 => note <= "010111010000110";
when 9365 => note <= "010011010100001";
when 9366 => note <= "001100111100011";
when 9367 => note <= "000110010000011";
when 9368 => note <= "000001010111001";
when 9369 => note <= "111111110011011";
when 9370 => note <= "000010001001010";
when 9371 => note <= "000111110011011";
when 9372 => note <= "001111001101111";
when 9373 => note <= "010110010000011";
when 9374 => note <= "011010110011010";
when 9375 => note <= "011011010100001";
when 9376 => note <= "010111010000110";
when 9377 => note <= "001111010000111";
when 9378 => note <= "000100111100011";
when 9379 => note <= "111010100000010";
when 9380 => note <= "110010001001010";
when 9381 => note <= "101101011111110";
when 9382 => note <= "101101001100110";
when 9383 => note <= "110000101111001";
when 9384 => note <= "110110100110001";
when 9385 => note <= "111100101011111";
when 9386 => note <= "000000111010011";
when 9387 => note <= "000001101111101";
when 9388 => note <= "111110101000111";
when 9389 => note <= "111000001100101";
when 9390 => note <= "110000000000000";
when 9391 => note <= "101000001100101";
when 9392 => note <= "100010111011010";
when 9393 => note <= "100001101111101";
when 9394 => note <= "100101001100110";
when 9395 => note <= "101100101011111";
when 9396 => note <= "110110100110001";
when 9397 => note <= "000000101111001";
when 9398 => note <= "001000111010011";
when 9399 => note <= "001101011111110";
when 9400 => note <= "001101110110110";
when 9401 => note <= "001010100000010";
when 9402 => note <= "000100111100011";
when 9403 => note <= "111111010000111";
when 9404 => note <= "111011100011001";
when 9405 => note <= "111011010100001";
when 9406 => note <= "111111000101101";
when 9407 => note <= "000110010000011";
when 9408 => note <= "001111001101111";
when 9409 => note <= "010111110011011";
when 9410 => note <= "011101110110110";
when 9411 => note <= "011111110011011";
when 9412 => note <= "011101000100110";
when 9413 => note <= "010110010000011";
when 9414 => note <= "001100111100011";
when 9415 => note <= "000011010100001";
when 9416 => note <= "111011100011001";
when 9417 => note <= "110111010000111";
when 9418 => note <= "110111000101101";
when 9419 => note <= "111010100000010";
when 9420 => note <= "000000000000000";
when 9421 => note <= "000101011111110";
when 9422 => note <= "001000111010011";
when 9423 => note <= "001000101111001";
when 9424 => note <= "000100011100111";
when 9425 => note <= "111100101011111";
when 9426 => note <= "110011000011101";
when 9427 => note <= "101001101111101";
when 9428 => note <= "100010111011010";
when 9429 => note <= "100000001100101";
when 9430 => note <= "100010001001010";
when 9431 => note <= "101000001100101";
when 9432 => note <= "110000110010001";
when 9433 => note <= "111001101111101";
when 9434 => note <= "000000111010011";
when 9435 => note <= "000100101011111";
when 9436 => note <= "000100011100111";
when 9437 => note <= "000000101111001";
when 9438 => note <= "111011000011101";
when 9439 => note <= "110101011111110";
when 9440 => note <= "110010001001010";
when 9441 => note <= "110010100000010";
when 9442 => note <= "110111000101101";
when 9443 => note <= "111111010000111";
when 9444 => note <= "001001011001111";
when 9445 => note <= "010011010100001";
when 9446 => note <= "011010110011010";
when 9447 => note <= "011110010000011";
when 9448 => note <= "011101000100110";
when 9449 => note <= "010111110011011";
when 9450 => note <= "010000000000000";
when 9451 => note <= "000111110011011";
when 9452 => note <= "000001010111001";
when 9453 => note <= "111110010000011";
when 9454 => note <= "111111000101101";
when 9455 => note <= "000011010100001";
when 9456 => note <= "001001011001111";
when 9457 => note <= "001111010000111";
when 9458 => note <= "010010110011010";
when 9459 => note <= "010010100000010";
when 9460 => note <= "001101110110110";
when 9461 => note <= "000101011111110";
when 9462 => note <= "111011000011101";
when 9463 => note <= "110000101111001";
when 9464 => note <= "101000101111010";
when 9465 => note <= "100100101011111";
when 9466 => note <= "100101001100110";
when 9467 => note <= "101001101111101";
when 9468 => note <= "110000110010001";
when 9469 => note <= "111000001100101";
when 9470 => note <= "111101110110110";
when 9471 => note <= "000000001100101";
when 9472 => note <= "111110101000111";
when 9473 => note <= "111001101111101";
when 9474 => note <= "110011000011101";
when 9475 => note <= "101100101011111";
when 9476 => note <= "101000101111010";
when 9477 => note <= "101000101111001";
when 9478 => note <= "101101001100110";
when 9479 => note <= "110101011111110";
when 9480 => note <= "000000000000000";
when 9481 => note <= "001010100000010";
when 9482 => note <= "010010110011010";
when 9483 => note <= "010111010000111";
when 9484 => note <= "010111010000110";
when 9485 => note <= "010011010100001";
when 9486 => note <= "001100111100011";
when 9487 => note <= "000110010000011";
when 9488 => note <= "000001010111001";
when 9489 => note <= "111111110011011";
when 9490 => note <= "000010001001010";
when 9491 => note <= "000111110011011";
when 9492 => note <= "001111001101111";
when 9493 => note <= "010110010000011";
when 9494 => note <= "011010110011010";
when 9495 => note <= "011011010100001";
when 9496 => note <= "010111010000110";
when 9497 => note <= "001111010000111";
when 9498 => note <= "000100111100011";
when 9499 => note <= "111010100000010";
when 9500 => note <= "110010001001010";
when 9501 => note <= "101101011111110";
when 9502 => note <= "101101001100110";
when 9503 => note <= "110000101111001";
when 9504 => note <= "110110100110001";
when 9505 => note <= "111100101011111";
when 9506 => note <= "000000111010011";
when 9507 => note <= "000001101111101";
when 9508 => note <= "111110101000111";
when 9509 => note <= "111000001100101";
when 9510 => note <= "110000000000000";
when 9511 => note <= "101000001100101";
when 9512 => note <= "100010111011010";
when 9513 => note <= "100001101111101";
when 9514 => note <= "100101001100110";
when 9515 => note <= "101100101011111";
when 9516 => note <= "110110100110001";
when 9517 => note <= "000000101111001";
when 9518 => note <= "001000111010011";
when 9519 => note <= "001101011111110";
when 9520 => note <= "001101110110110";
when 9521 => note <= "001010100000010";
when 9522 => note <= "000100111100011";
when 9523 => note <= "111111010000111";
when 9524 => note <= "111011100011001";
when 9525 => note <= "111011010100001";
when 9526 => note <= "111111000101101";
when 9527 => note <= "000110010000011";
when 9528 => note <= "001111001101111";
when 9529 => note <= "010111110011011";
when 9530 => note <= "011101110110110";
when 9531 => note <= "011111110011011";
when 9532 => note <= "011101000100110";
when 9533 => note <= "010110010000011";
when 9534 => note <= "001100111100011";
when 9535 => note <= "000011010100001";
when 9536 => note <= "111011100011001";
when 9537 => note <= "110111010000111";
when 9538 => note <= "110111000101101";
when 9539 => note <= "111010100000010";
when 9540 => note <= "000000000000000";
when 9541 => note <= "000101011111110";
when 9542 => note <= "001000111010011";
when 9543 => note <= "001000101111001";
when 9544 => note <= "000100011100111";
when 9545 => note <= "111100101011111";
when 9546 => note <= "110011000011101";
when 9547 => note <= "101001101111101";
when 9548 => note <= "100010111011010";
when 9549 => note <= "100000001100101";
when 9550 => note <= "100010001001010";
when 9551 => note <= "101000001100101";
when 9552 => note <= "110000110010001";
when 9553 => note <= "111001101111101";
when 9554 => note <= "000000111010011";
when 9555 => note <= "000100101011111";
when 9556 => note <= "000100011100111";
when 9557 => note <= "000000101111001";
when 9558 => note <= "111011000011101";
when 9559 => note <= "110101011111110";
when 9560 => note <= "110010001001010";
when 9561 => note <= "110010100000010";
when 9562 => note <= "110111000101101";
when 9563 => note <= "111111010000111";
when 9564 => note <= "001001011001111";
when 9565 => note <= "010011010100001";
when 9566 => note <= "011010110011010";
when 9567 => note <= "011110010000011";
when 9568 => note <= "011101000100110";
when 9569 => note <= "010111110011011";
when 9570 => note <= "010000000000000";
when 9571 => note <= "000111110011011";
when 9572 => note <= "000001010111001";
when 9573 => note <= "111110010000011";
when 9574 => note <= "111111000101101";
when 9575 => note <= "000011010100001";
when 9576 => note <= "001001011001111";
when 9577 => note <= "001111010000111";
when 9578 => note <= "010010110011010";
when 9579 => note <= "010010100000010";
when 9580 => note <= "001101110110110";
when 9581 => note <= "000101011111110";
when 9582 => note <= "111011000011101";
when 9583 => note <= "110000101111001";
when 9584 => note <= "101000101111010";
when 9585 => note <= "100100101011111";
when 9586 => note <= "100101001100110";
when 9587 => note <= "101001101111101";
when 9588 => note <= "110000110010001";
when 9589 => note <= "111000001100101";
when 9590 => note <= "111101110110110";
when 9591 => note <= "000000001100101";
when 9592 => note <= "111110101000111";
when 9593 => note <= "111001101111101";
when 9594 => note <= "110011000011101";
when 9595 => note <= "101100101011111";
when 9596 => note <= "101000101111010";
when 9597 => note <= "101000101111001";
when 9598 => note <= "101101001100110";
when 9599 => note <= "110101011111110";
when 9600 => note <= "000000000000000";
when 9601 => note <= "001010100000010";
when 9602 => note <= "010010110011010";
when 9603 => note <= "010111010000111";
when 9604 => note <= "010111010000110";
when 9605 => note <= "010011010100001";
when 9606 => note <= "001100111100011";
when 9607 => note <= "000110010000011";
when 9608 => note <= "000001010111001";
when 9609 => note <= "111111110011011";
when 9610 => note <= "000010001001010";
when 9611 => note <= "000111110011011";
when 9612 => note <= "001111001101111";
when 9613 => note <= "010110010000011";
when 9614 => note <= "011010110011010";
when 9615 => note <= "011011010100001";
when 9616 => note <= "010111010000110";
when 9617 => note <= "001111010000111";
when 9618 => note <= "000100111100011";
when 9619 => note <= "111010100000010";
when 9620 => note <= "110010001001010";
when 9621 => note <= "101101011111110";
when 9622 => note <= "101101001100110";
when 9623 => note <= "110000101111001";
when 9624 => note <= "110110100110001";
when 9625 => note <= "111100101011111";
when 9626 => note <= "000000111010011";
when 9627 => note <= "000001101111101";
when 9628 => note <= "111110101000111";
when 9629 => note <= "111000001100101";
when 9630 => note <= "110000000000000";
when 9631 => note <= "101000001100101";
when 9632 => note <= "100010111011010";
when 9633 => note <= "100001101111101";
when 9634 => note <= "100101001100110";
when 9635 => note <= "101100101011111";
when 9636 => note <= "110110100110001";
when 9637 => note <= "000000101111001";
when 9638 => note <= "001000111010011";
when 9639 => note <= "001101011111110";
when 9640 => note <= "001101110110110";
when 9641 => note <= "001010100000010";
when 9642 => note <= "000100111100011";
when 9643 => note <= "111111010000111";
when 9644 => note <= "111011100011001";
when 9645 => note <= "111011010100001";
when 9646 => note <= "111111000101101";
when 9647 => note <= "000110010000011";
when 9648 => note <= "001111001101111";
when 9649 => note <= "010111110011011";
when 9650 => note <= "011101110110110";
when 9651 => note <= "011111110011011";
when 9652 => note <= "011101000100110";
when 9653 => note <= "010110010000011";
when 9654 => note <= "001100111100011";
when 9655 => note <= "000011010100001";
when 9656 => note <= "111011100011001";
when 9657 => note <= "110111010000111";
when 9658 => note <= "110111000101101";
when 9659 => note <= "111010100000010";
when 9660 => note <= "000000000000000";
when 9661 => note <= "000101011111110";
when 9662 => note <= "001000111010011";
when 9663 => note <= "001000101111001";
when 9664 => note <= "000100011100111";
when 9665 => note <= "111100101011111";
when 9666 => note <= "110011000011101";
when 9667 => note <= "101001101111101";
when 9668 => note <= "100010111011010";
when 9669 => note <= "100000001100101";
when 9670 => note <= "100010001001010";
when 9671 => note <= "101000001100101";
when 9672 => note <= "110000110010001";
when 9673 => note <= "111001101111101";
when 9674 => note <= "000000111010011";
when 9675 => note <= "000100101011111";
when 9676 => note <= "000100011100111";
when 9677 => note <= "000000101111001";
when 9678 => note <= "111011000011101";
when 9679 => note <= "110101011111110";
when 9680 => note <= "110010001001010";
when 9681 => note <= "110010100000010";
when 9682 => note <= "110111000101101";
when 9683 => note <= "111111010000111";
when 9684 => note <= "001001011001111";
when 9685 => note <= "010011010100001";
when 9686 => note <= "011010110011010";
when 9687 => note <= "011110010000011";
when 9688 => note <= "011101000100110";
when 9689 => note <= "010111110011011";
when 9690 => note <= "010000000000000";
when 9691 => note <= "000111110011011";
when 9692 => note <= "000001010111001";
when 9693 => note <= "111110010000011";
when 9694 => note <= "111111000101101";
when 9695 => note <= "000011010100001";
when 9696 => note <= "001001011001111";
when 9697 => note <= "001111010000111";
when 9698 => note <= "010010110011010";
when 9699 => note <= "010010100000010";
when 9700 => note <= "001101110110110";
when 9701 => note <= "000101011111110";
when 9702 => note <= "111011000011101";
when 9703 => note <= "110000101111001";
when 9704 => note <= "101000101111010";
when 9705 => note <= "100100101011111";
when 9706 => note <= "100101001100110";
when 9707 => note <= "101001101111101";
when 9708 => note <= "110000110010001";
when 9709 => note <= "111000001100101";
when 9710 => note <= "111101110110110";
when 9711 => note <= "000000001100101";
when 9712 => note <= "111110101000111";
when 9713 => note <= "111001101111101";
when 9714 => note <= "110011000011101";
when 9715 => note <= "101100101011111";
when 9716 => note <= "101000101111010";
when 9717 => note <= "101000101111001";
when 9718 => note <= "101101001100110";
when 9719 => note <= "110101011111110";
when 9720 => note <= "000000000000000";
when 9721 => note <= "001010100000010";
when 9722 => note <= "010010110011010";
when 9723 => note <= "010111010000111";
when 9724 => note <= "010111010000110";
when 9725 => note <= "010011010100001";
when 9726 => note <= "001100111100011";
when 9727 => note <= "000110010000011";
when 9728 => note <= "000001010111001";
when 9729 => note <= "111111110011011";
when 9730 => note <= "000010001001010";
when 9731 => note <= "000111110011011";
when 9732 => note <= "001111001101111";
when 9733 => note <= "010110010000011";
when 9734 => note <= "011010110011010";
when 9735 => note <= "011011010100001";
when 9736 => note <= "010111010000110";
when 9737 => note <= "001111010000111";
when 9738 => note <= "000100111100011";
when 9739 => note <= "111010100000010";
when 9740 => note <= "110010001001010";
when 9741 => note <= "101101011111110";
when 9742 => note <= "101101001100110";
when 9743 => note <= "110000101111001";
when 9744 => note <= "110110100110001";
when 9745 => note <= "111100101011111";
when 9746 => note <= "000000111010011";
when 9747 => note <= "000001101111101";
when 9748 => note <= "111110101000111";
when 9749 => note <= "111000001100101";
when 9750 => note <= "110000000000000";
when 9751 => note <= "101000001100101";
when 9752 => note <= "100010111011010";
when 9753 => note <= "100001101111101";
when 9754 => note <= "100101001100110";
when 9755 => note <= "101100101011111";
when 9756 => note <= "110110100110001";
when 9757 => note <= "000000101111001";
when 9758 => note <= "001000111010011";
when 9759 => note <= "001101011111110";
when 9760 => note <= "001101110110110";
when 9761 => note <= "001010100000010";
when 9762 => note <= "000100111100011";
when 9763 => note <= "111111010000111";
when 9764 => note <= "111011100011001";
when 9765 => note <= "111011010100001";
when 9766 => note <= "111111000101101";
when 9767 => note <= "000110010000011";
when 9768 => note <= "001111001101111";
when 9769 => note <= "010111110011011";
when 9770 => note <= "011101110110110";
when 9771 => note <= "011111110011011";
when 9772 => note <= "011101000100110";
when 9773 => note <= "010110010000011";
when 9774 => note <= "001100111100011";
when 9775 => note <= "000011010100001";
when 9776 => note <= "111011100011001";
when 9777 => note <= "110111010000111";
when 9778 => note <= "110111000101101";
when 9779 => note <= "111010100000010";
when 9780 => note <= "000000000000000";
when 9781 => note <= "000101011111110";
when 9782 => note <= "001000111010011";
when 9783 => note <= "001000101111001";
when 9784 => note <= "000100011100111";
when 9785 => note <= "111100101011111";
when 9786 => note <= "110011000011101";
when 9787 => note <= "101001101111101";
when 9788 => note <= "100010111011010";
when 9789 => note <= "100000001100101";
when 9790 => note <= "100010001001010";
when 9791 => note <= "101000001100101";
when 9792 => note <= "110000110010001";
when 9793 => note <= "111001101111101";
when 9794 => note <= "000000111010011";
when 9795 => note <= "000100101011111";
when 9796 => note <= "000100011100111";
when 9797 => note <= "000000101111001";
when 9798 => note <= "111011000011101";
when 9799 => note <= "110101011111110";
when 9800 => note <= "110010001001010";
when 9801 => note <= "110010100000010";
when 9802 => note <= "110111000101101";
when 9803 => note <= "111111010000111";
when 9804 => note <= "001001011001111";
when 9805 => note <= "010011010100001";
when 9806 => note <= "011010110011010";
when 9807 => note <= "011110010000011";
when 9808 => note <= "011101000100110";
when 9809 => note <= "010111110011011";
when 9810 => note <= "010000000000000";
when 9811 => note <= "000111110011011";
when 9812 => note <= "000001010111001";
when 9813 => note <= "111110010000011";
when 9814 => note <= "111111000101101";
when 9815 => note <= "000011010100001";
when 9816 => note <= "001001011001111";
when 9817 => note <= "001111010000111";
when 9818 => note <= "010010110011010";
when 9819 => note <= "010010100000010";
when 9820 => note <= "001101110110110";
when 9821 => note <= "000101011111110";
when 9822 => note <= "111011000011101";
when 9823 => note <= "110000101111001";
when 9824 => note <= "101000101111010";
when 9825 => note <= "100100101011111";
when 9826 => note <= "100101001100110";
when 9827 => note <= "101001101111101";
when 9828 => note <= "110000110010001";
when 9829 => note <= "111000001100101";
when 9830 => note <= "111101110110110";
when 9831 => note <= "000000001100101";
when 9832 => note <= "111110101000111";
when 9833 => note <= "111001101111101";
when 9834 => note <= "110011000011101";
when 9835 => note <= "101100101011111";
when 9836 => note <= "101000101111010";
when 9837 => note <= "101000101111001";
when 9838 => note <= "101101001100110";
when 9839 => note <= "110101011111110";
when 9840 => note <= "000000000000000";
when 9841 => note <= "001010100000010";
when 9842 => note <= "010010110011010";
when 9843 => note <= "010111010000111";
when 9844 => note <= "010111010000110";
when 9845 => note <= "010011010100001";
when 9846 => note <= "001100111100011";
when 9847 => note <= "000110010000011";
when 9848 => note <= "000001010111001";
when 9849 => note <= "111111110011011";
when 9850 => note <= "000010001001010";
when 9851 => note <= "000111110011011";
when 9852 => note <= "001111001101111";
when 9853 => note <= "010110010000011";
when 9854 => note <= "011010110011010";
when 9855 => note <= "011011010100001";
when 9856 => note <= "010111010000110";
when 9857 => note <= "001111010000111";
when 9858 => note <= "000100111100011";
when 9859 => note <= "111010100000010";
when 9860 => note <= "110010001001010";
when 9861 => note <= "101101011111110";
when 9862 => note <= "101101001100110";
when 9863 => note <= "110000101111001";
when 9864 => note <= "110110100110001";
when 9865 => note <= "111100101011111";
when 9866 => note <= "000000111010011";
when 9867 => note <= "000001101111101";
when 9868 => note <= "111110101000111";
when 9869 => note <= "111000001100101";
when 9870 => note <= "110000000000000";
when 9871 => note <= "101000001100101";
when 9872 => note <= "100010111011010";
when 9873 => note <= "100001101111101";
when 9874 => note <= "100101001100110";
when 9875 => note <= "101100101011111";
when 9876 => note <= "110110100110001";
when 9877 => note <= "000000101111001";
when 9878 => note <= "001000111010011";
when 9879 => note <= "001101011111110";
when 9880 => note <= "001101110110110";
when 9881 => note <= "001010100000010";
when 9882 => note <= "000100111100011";
when 9883 => note <= "111111010000111";
when 9884 => note <= "111011100011001";
when 9885 => note <= "111011010100001";
when 9886 => note <= "111111000101101";
when 9887 => note <= "000110010000011";
when 9888 => note <= "001111001101111";
when 9889 => note <= "010111110011011";
when 9890 => note <= "011101110110110";
when 9891 => note <= "011111110011011";
when 9892 => note <= "011101000100110";
when 9893 => note <= "010110010000011";
when 9894 => note <= "001100111100011";
when 9895 => note <= "000011010100001";
when 9896 => note <= "111011100011001";
when 9897 => note <= "110111010000111";
when 9898 => note <= "110111000101101";
when 9899 => note <= "111010100000010";
when 9900 => note <= "000000000000000";
when 9901 => note <= "000101011111110";
when 9902 => note <= "001000111010011";
when 9903 => note <= "001000101111001";
when 9904 => note <= "000100011100111";
when 9905 => note <= "111100101011111";
when 9906 => note <= "110011000011101";
when 9907 => note <= "101001101111101";
when 9908 => note <= "100010111011010";
when 9909 => note <= "100000001100101";
when 9910 => note <= "100010001001010";
when 9911 => note <= "101000001100101";
when 9912 => note <= "110000110010001";
when 9913 => note <= "111001101111101";
when 9914 => note <= "000000111010011";
when 9915 => note <= "000100101011111";
when 9916 => note <= "000100011100111";
when 9917 => note <= "000000101111001";
when 9918 => note <= "111011000011101";
when 9919 => note <= "110101011111110";
when 9920 => note <= "110010001001010";
when 9921 => note <= "110010100000010";
when 9922 => note <= "110111000101101";
when 9923 => note <= "111111010000111";
when 9924 => note <= "001001011001111";
when 9925 => note <= "010011010100001";
when 9926 => note <= "011010110011010";
when 9927 => note <= "011110010000011";
when 9928 => note <= "011101000100110";
when 9929 => note <= "010111110011011";
when 9930 => note <= "010000000000000";
when 9931 => note <= "000111110011011";
when 9932 => note <= "000001010111001";
when 9933 => note <= "111110010000011";
when 9934 => note <= "111111000101101";
when 9935 => note <= "000011010100001";
when 9936 => note <= "001001011001111";
when 9937 => note <= "001111010000111";
when 9938 => note <= "010010110011010";
when 9939 => note <= "010010100000010";
when 9940 => note <= "001101110110110";
when 9941 => note <= "000101011111110";
when 9942 => note <= "111011000011101";
when 9943 => note <= "110000101111001";
when 9944 => note <= "101000101111010";
when 9945 => note <= "100100101011111";
when 9946 => note <= "100101001100110";
when 9947 => note <= "101001101111101";
when 9948 => note <= "110000110010001";
when 9949 => note <= "111000001100101";
when 9950 => note <= "111101110110110";
when 9951 => note <= "000000001100101";
when 9952 => note <= "111110101000111";
when 9953 => note <= "111001101111101";
when 9954 => note <= "110011000011101";
when 9955 => note <= "101100101011111";
when 9956 => note <= "101000101111010";
when 9957 => note <= "101000101111001";
when 9958 => note <= "101101001100110";
when 9959 => note <= "110101011111110";
when 9960 => note <= "000000000000000";
when 9961 => note <= "001010100000010";
when 9962 => note <= "010010110011010";
when 9963 => note <= "010111010000111";
when 9964 => note <= "010111010000110";
when 9965 => note <= "010011010100001";
when 9966 => note <= "001100111100011";
when 9967 => note <= "000110010000011";
when 9968 => note <= "000001010111001";
when 9969 => note <= "111111110011011";
when 9970 => note <= "000010001001010";
when 9971 => note <= "000111110011011";
when 9972 => note <= "001111001101111";
when 9973 => note <= "010110010000011";
when 9974 => note <= "011010110011010";
when 9975 => note <= "011011010100001";
when 9976 => note <= "010111010000110";
when 9977 => note <= "001111010000111";
when 9978 => note <= "000100111100011";
when 9979 => note <= "111010100000010";
when 9980 => note <= "110010001001010";
when 9981 => note <= "101101011111110";
when 9982 => note <= "101101001100110";
when 9983 => note <= "110000101111001";
when 9984 => note <= "110110100110001";
when 9985 => note <= "111100101011111";
when 9986 => note <= "000000111010011";
when 9987 => note <= "000001101111101";
when 9988 => note <= "111110101000111";
when 9989 => note <= "111000001100101";
when 9990 => note <= "110000000000000";
when 9991 => note <= "101000001100101";
when 9992 => note <= "100010111011010";
when 9993 => note <= "100001101111101";
when 9994 => note <= "100101001100110";
when 9995 => note <= "101100101011111";
when 9996 => note <= "110110100110001";
when 9997 => note <= "000000101111001";
when 9998 => note <= "001000111010011";
when 9999 => note <= "001101011111110";
when 10000 => note <= "001101110110110";
when 10001 => note <= "001010100000010";
when 10002 => note <= "000100111100011";
when 10003 => note <= "111111010000111";
when 10004 => note <= "111011100011001";
when 10005 => note <= "111011010100001";
when 10006 => note <= "111111000101101";
when 10007 => note <= "000110010000011";
when 10008 => note <= "001111001101111";
when 10009 => note <= "010111110011011";
when 10010 => note <= "011101110110110";
when 10011 => note <= "011111110011011";
when 10012 => note <= "011101000100110";
when 10013 => note <= "010110010000011";
when 10014 => note <= "001100111100011";
when 10015 => note <= "000011010100001";
when 10016 => note <= "111011100011001";
when 10017 => note <= "110111010000111";
when 10018 => note <= "110111000101101";
when 10019 => note <= "111010100000010";
when 10020 => note <= "000000000000000";
when 10021 => note <= "000101011111110";
when 10022 => note <= "001000111010011";
when 10023 => note <= "001000101111001";
when 10024 => note <= "000100011100111";
when 10025 => note <= "111100101011111";
when 10026 => note <= "110011000011101";
when 10027 => note <= "101001101111101";
when 10028 => note <= "100010111011010";
when 10029 => note <= "100000001100101";
when 10030 => note <= "100010001001010";
when 10031 => note <= "101000001100101";
when 10032 => note <= "110000110010001";
when 10033 => note <= "111001101111101";
when 10034 => note <= "000000111010011";
when 10035 => note <= "000100101011111";
when 10036 => note <= "000100011100111";
when 10037 => note <= "000000101111001";
when 10038 => note <= "111011000011101";
when 10039 => note <= "110101011111110";
when 10040 => note <= "110010001001010";
when 10041 => note <= "110010100000010";
when 10042 => note <= "110111000101101";
when 10043 => note <= "111111010000111";
when 10044 => note <= "001001011001111";
when 10045 => note <= "010011010100001";
when 10046 => note <= "011010110011010";
when 10047 => note <= "011110010000011";
when 10048 => note <= "011101000100110";
when 10049 => note <= "010111110011011";
when 10050 => note <= "010000000000000";
when 10051 => note <= "000111110011011";
when 10052 => note <= "000001010111001";
when 10053 => note <= "111110010000011";
when 10054 => note <= "111111000101101";
when 10055 => note <= "000011010100001";
when 10056 => note <= "001001011001111";
when 10057 => note <= "001111010000111";
when 10058 => note <= "010010110011010";
when 10059 => note <= "010010100000010";
when 10060 => note <= "001101110110110";
when 10061 => note <= "000101011111110";
when 10062 => note <= "111011000011101";
when 10063 => note <= "110000101111001";
when 10064 => note <= "101000101111010";
when 10065 => note <= "100100101011111";
when 10066 => note <= "100101001100110";
when 10067 => note <= "101001101111101";
when 10068 => note <= "110000110010001";
when 10069 => note <= "111000001100101";
when 10070 => note <= "111101110110110";
when 10071 => note <= "000000001100101";
when 10072 => note <= "111110101000111";
when 10073 => note <= "111001101111101";
when 10074 => note <= "110011000011101";
when 10075 => note <= "101100101011111";
when 10076 => note <= "101000101111010";
when 10077 => note <= "101000101111001";
when 10078 => note <= "101101001100110";
when 10079 => note <= "110101011111110";
when 10080 => note <= "000000000000000";
when 10081 => note <= "001010100000010";
when 10082 => note <= "010010110011010";
when 10083 => note <= "010111010000111";
when 10084 => note <= "010111010000110";
when 10085 => note <= "010011010100001";
when 10086 => note <= "001100111100011";
when 10087 => note <= "000110010000011";
when 10088 => note <= "000001010111001";
when 10089 => note <= "111111110011011";
when 10090 => note <= "000010001001010";
when 10091 => note <= "000111110011011";
when 10092 => note <= "001111001101111";
when 10093 => note <= "010110010000011";
when 10094 => note <= "011010110011010";
when 10095 => note <= "011011010100001";
when 10096 => note <= "010111010000110";
when 10097 => note <= "001111010000111";
when 10098 => note <= "000100111100011";
when 10099 => note <= "111010100000010";
when 10100 => note <= "110010001001010";
when 10101 => note <= "101101011111110";
when 10102 => note <= "101101001100110";
when 10103 => note <= "110000101111001";
when 10104 => note <= "110110100110001";
when 10105 => note <= "111100101011111";
when 10106 => note <= "000000111010011";
when 10107 => note <= "000001101111101";
when 10108 => note <= "111110101000111";
when 10109 => note <= "111000001100101";
when 10110 => note <= "110000000000000";
when 10111 => note <= "101000001100101";
when 10112 => note <= "100010111011010";
when 10113 => note <= "100001101111101";
when 10114 => note <= "100101001100110";
when 10115 => note <= "101100101011111";
when 10116 => note <= "110110100110001";
when 10117 => note <= "000000101111001";
when 10118 => note <= "001000111010011";
when 10119 => note <= "001101011111110";
when 10120 => note <= "001101110110110";
when 10121 => note <= "001010100000010";
when 10122 => note <= "000100111100011";
when 10123 => note <= "111111010000111";
when 10124 => note <= "111011100011001";
when 10125 => note <= "111011010100001";
when 10126 => note <= "111111000101101";
when 10127 => note <= "000110010000011";
when 10128 => note <= "001111001101111";
when 10129 => note <= "010111110011011";
when 10130 => note <= "011101110110110";
when 10131 => note <= "011111110011011";
when 10132 => note <= "011101000100110";
when 10133 => note <= "010110010000011";
when 10134 => note <= "001100111100011";
when 10135 => note <= "000011010100001";
when 10136 => note <= "111011100011001";
when 10137 => note <= "110111010000111";
when 10138 => note <= "110111000101101";
when 10139 => note <= "111010100000010";
when 10140 => note <= "000000000000000";
when 10141 => note <= "000101011111110";
when 10142 => note <= "001000111010011";
when 10143 => note <= "001000101111001";
when 10144 => note <= "000100011100111";
when 10145 => note <= "111100101011111";
when 10146 => note <= "110011000011101";
when 10147 => note <= "101001101111101";
when 10148 => note <= "100010111011010";
when 10149 => note <= "100000001100101";
when 10150 => note <= "100010001001010";
when 10151 => note <= "101000001100101";
when 10152 => note <= "110000110010001";
when 10153 => note <= "111001101111101";
when 10154 => note <= "000000111010011";
when 10155 => note <= "000100101011111";
when 10156 => note <= "000100011100111";
when 10157 => note <= "000000101111001";
when 10158 => note <= "111011000011101";
when 10159 => note <= "110101011111110";
when 10160 => note <= "110010001001010";
when 10161 => note <= "110010100000010";
when 10162 => note <= "110111000101101";
when 10163 => note <= "111111010000111";
when 10164 => note <= "001001011001111";
when 10165 => note <= "010011010100001";
when 10166 => note <= "011010110011010";
when 10167 => note <= "011110010000011";
when 10168 => note <= "011101000100110";
when 10169 => note <= "010111110011011";
when 10170 => note <= "010000000000000";
when 10171 => note <= "000111110011011";
when 10172 => note <= "000001010111001";
when 10173 => note <= "111110010000011";
when 10174 => note <= "111111000101101";
when 10175 => note <= "000011010100001";
when 10176 => note <= "001001011001111";
when 10177 => note <= "001111010000111";
when 10178 => note <= "010010110011010";
when 10179 => note <= "010010100000010";
when 10180 => note <= "001101110110110";
when 10181 => note <= "000101011111110";
when 10182 => note <= "111011000011101";
when 10183 => note <= "110000101111001";
when 10184 => note <= "101000101111010";
when 10185 => note <= "100100101011111";
when 10186 => note <= "100101001100110";
when 10187 => note <= "101001101111101";
when 10188 => note <= "110000110010001";
when 10189 => note <= "111000001100101";
when 10190 => note <= "111101110110110";
when 10191 => note <= "000000001100101";
when 10192 => note <= "111110101000111";
when 10193 => note <= "111001101111101";
when 10194 => note <= "110011000011101";
when 10195 => note <= "101100101011111";
when 10196 => note <= "101000101111010";
when 10197 => note <= "101000101111001";
when 10198 => note <= "101101001100110";
when 10199 => note <= "110101011111110";
when 10200 => note <= "000000000000000";
when 10201 => note <= "001010100000010";
when 10202 => note <= "010010110011010";
when 10203 => note <= "010111010000111";
when 10204 => note <= "010111010000110";
when 10205 => note <= "010011010100001";
when 10206 => note <= "001100111100011";
when 10207 => note <= "000110010000011";
when 10208 => note <= "000001010111001";
when 10209 => note <= "111111110011011";
when 10210 => note <= "000010001001010";
when 10211 => note <= "000111110011011";
when 10212 => note <= "001111001101111";
when 10213 => note <= "010110010000011";
when 10214 => note <= "011010110011010";
when 10215 => note <= "011011010100001";
when 10216 => note <= "010111010000110";
when 10217 => note <= "001111010000111";
when 10218 => note <= "000100111100011";
when 10219 => note <= "111010100000010";
when 10220 => note <= "110010001001010";
when 10221 => note <= "101101011111110";
when 10222 => note <= "101101001100110";
when 10223 => note <= "110000101111001";
when 10224 => note <= "110110100110001";
when 10225 => note <= "111100101011111";
when 10226 => note <= "000000111010011";
when 10227 => note <= "000001101111101";
when 10228 => note <= "111110101000111";
when 10229 => note <= "111000001100101";
when 10230 => note <= "110000000000000";
when 10231 => note <= "101000001100101";
when 10232 => note <= "100010111011010";
when 10233 => note <= "100001101111101";
when 10234 => note <= "100101001100110";
when 10235 => note <= "101100101011111";
when 10236 => note <= "110110100110001";
when 10237 => note <= "000000101111001";
when 10238 => note <= "001000111010011";
when 10239 => note <= "001101011111110";
when 10240 => note <= "001101110110110";
when 10241 => note <= "001010100000010";
when 10242 => note <= "000100111100011";
when 10243 => note <= "111111010000111";
when 10244 => note <= "111011100011001";
when 10245 => note <= "111011010100001";
when 10246 => note <= "111111000101101";
when 10247 => note <= "000110010000011";
when 10248 => note <= "001111001101111";
when 10249 => note <= "010111110011011";
when 10250 => note <= "011101110110110";
when 10251 => note <= "011111110011011";
when 10252 => note <= "011101000100110";
when 10253 => note <= "010110010000011";
when 10254 => note <= "001100111100011";
when 10255 => note <= "000011010100001";
when 10256 => note <= "111011100011001";
when 10257 => note <= "110111010000111";
when 10258 => note <= "110111000101101";
when 10259 => note <= "111010100000010";
when 10260 => note <= "000000000000000";
when 10261 => note <= "000101011111110";
when 10262 => note <= "001000111010011";
when 10263 => note <= "001000101111001";
when 10264 => note <= "000100011100111";
when 10265 => note <= "111100101011111";
when 10266 => note <= "110011000011101";
when 10267 => note <= "101001101111101";
when 10268 => note <= "100010111011010";
when 10269 => note <= "100000001100101";
when 10270 => note <= "100010001001010";
when 10271 => note <= "101000001100101";
when 10272 => note <= "110000110010001";
when 10273 => note <= "111001101111101";
when 10274 => note <= "000000111010011";
when 10275 => note <= "000100101011111";
when 10276 => note <= "000100011100111";
when 10277 => note <= "000000101111001";
when 10278 => note <= "111011000011101";
when 10279 => note <= "110101011111110";
when 10280 => note <= "110010001001010";
when 10281 => note <= "110010100000010";
when 10282 => note <= "110111000101101";
when 10283 => note <= "111111010000111";
when 10284 => note <= "001001011001111";
when 10285 => note <= "010011010100001";
when 10286 => note <= "011010110011010";
when 10287 => note <= "011110010000011";
when 10288 => note <= "011101000100110";
when 10289 => note <= "010111110011011";
when 10290 => note <= "010000000000000";
when 10291 => note <= "000111110011011";
when 10292 => note <= "000001010111001";
when 10293 => note <= "111110010000011";
when 10294 => note <= "111111000101101";
when 10295 => note <= "000011010100001";
when 10296 => note <= "001001011001111";
when 10297 => note <= "001111010000111";
when 10298 => note <= "010010110011010";
when 10299 => note <= "010010100000010";
when 10300 => note <= "001101110110110";
when 10301 => note <= "000101011111110";
when 10302 => note <= "111011000011101";
when 10303 => note <= "110000101111001";
when 10304 => note <= "101000101111010";
when 10305 => note <= "100100101011111";
when 10306 => note <= "100101001100110";
when 10307 => note <= "101001101111101";
when 10308 => note <= "110000110010001";
when 10309 => note <= "111000001100101";
when 10310 => note <= "111101110110110";
when 10311 => note <= "000000001100101";
when 10312 => note <= "111110101000111";
when 10313 => note <= "111001101111101";
when 10314 => note <= "110011000011101";
when 10315 => note <= "101100101011111";
when 10316 => note <= "101000101111010";
when 10317 => note <= "101000101111001";
when 10318 => note <= "101101001100110";
when 10319 => note <= "110101011111110";
when 10320 => note <= "000000000000000";
when 10321 => note <= "001010100000010";
when 10322 => note <= "010010110011010";
when 10323 => note <= "010111010000111";
when 10324 => note <= "010111010000110";
when 10325 => note <= "010011010100001";
when 10326 => note <= "001100111100011";
when 10327 => note <= "000110010000011";
when 10328 => note <= "000001010111001";
when 10329 => note <= "111111110011011";
when 10330 => note <= "000010001001010";
when 10331 => note <= "000111110011011";
when 10332 => note <= "001111001101111";
when 10333 => note <= "010110010000011";
when 10334 => note <= "011010110011010";
when 10335 => note <= "011011010100001";
when 10336 => note <= "010111010000110";
when 10337 => note <= "001111010000111";
when 10338 => note <= "000100111100011";
when 10339 => note <= "111010100000010";
when 10340 => note <= "110010001001010";
when 10341 => note <= "101101011111110";
when 10342 => note <= "101101001100110";
when 10343 => note <= "110000101111001";
when 10344 => note <= "110110100110001";
when 10345 => note <= "111100101011111";
when 10346 => note <= "000000111010011";
when 10347 => note <= "000001101111101";
when 10348 => note <= "111110101000111";
when 10349 => note <= "111000001100101";
when 10350 => note <= "110000000000000";
when 10351 => note <= "101000001100101";
when 10352 => note <= "100010111011010";
when 10353 => note <= "100001101111101";
when 10354 => note <= "100101001100110";
when 10355 => note <= "101100101011111";
when 10356 => note <= "110110100110001";
when 10357 => note <= "000000101111001";
when 10358 => note <= "001000111010011";
when 10359 => note <= "001101011111110";
when 10360 => note <= "001101110110110";
when 10361 => note <= "001010100000010";
when 10362 => note <= "000100111100011";
when 10363 => note <= "111111010000111";
when 10364 => note <= "111011100011001";
when 10365 => note <= "111011010100001";
when 10366 => note <= "111111000101101";
when 10367 => note <= "000110010000011";
when 10368 => note <= "001111001101111";
when 10369 => note <= "010111110011011";
when 10370 => note <= "011101110110110";
when 10371 => note <= "011111110011011";
when 10372 => note <= "011101000100110";
when 10373 => note <= "010110010000011";
when 10374 => note <= "001100111100011";
when 10375 => note <= "000011010100001";
when 10376 => note <= "111011100011001";
when 10377 => note <= "110111010000111";
when 10378 => note <= "110111000101101";
when 10379 => note <= "111010100000010";
when 10380 => note <= "000000000000000";
when 10381 => note <= "000101011111110";
when 10382 => note <= "001000111010011";
when 10383 => note <= "001000101111001";
when 10384 => note <= "000100011100111";
when 10385 => note <= "111100101011111";
when 10386 => note <= "110011000011101";
when 10387 => note <= "101001101111101";
when 10388 => note <= "100010111011010";
when 10389 => note <= "100000001100101";
when 10390 => note <= "100010001001010";
when 10391 => note <= "101000001100101";
when 10392 => note <= "110000110010001";
when 10393 => note <= "111001101111101";
when 10394 => note <= "000000111010011";
when 10395 => note <= "000100101011111";
when 10396 => note <= "000100011100111";
when 10397 => note <= "000000101111001";
when 10398 => note <= "111011000011101";
when 10399 => note <= "110101011111110";
when 10400 => note <= "110010001001010";
when 10401 => note <= "110010100000010";
when 10402 => note <= "110111000101101";
when 10403 => note <= "111111010000111";
when 10404 => note <= "001001011001111";
when 10405 => note <= "010011010100001";
when 10406 => note <= "011010110011010";
when 10407 => note <= "011110010000011";
when 10408 => note <= "011101000100110";
when 10409 => note <= "010111110011011";
when 10410 => note <= "010000000000000";
when 10411 => note <= "000111110011011";
when 10412 => note <= "000001010111001";
when 10413 => note <= "111110010000011";
when 10414 => note <= "111111000101101";
when 10415 => note <= "000011010100001";
when 10416 => note <= "001001011001111";
when 10417 => note <= "001111010000111";
when 10418 => note <= "010010110011010";
when 10419 => note <= "010010100000010";
when 10420 => note <= "001101110110110";
when 10421 => note <= "000101011111110";
when 10422 => note <= "111011000011101";
when 10423 => note <= "110000101111001";
when 10424 => note <= "101000101111010";
when 10425 => note <= "100100101011111";
when 10426 => note <= "100101001100110";
when 10427 => note <= "101001101111101";
when 10428 => note <= "110000110010001";
when 10429 => note <= "111000001100101";
when 10430 => note <= "111101110110110";
when 10431 => note <= "000000001100101";
when 10432 => note <= "111110101000111";
when 10433 => note <= "111001101111101";
when 10434 => note <= "110011000011101";
when 10435 => note <= "101100101011111";
when 10436 => note <= "101000101111010";
when 10437 => note <= "101000101111001";
when 10438 => note <= "101101001100110";
when 10439 => note <= "110101011111110";
when 10440 => note <= "000000000000000";
when 10441 => note <= "001010100000010";
when 10442 => note <= "010010110011010";
when 10443 => note <= "010111010000111";
when 10444 => note <= "010111010000110";
when 10445 => note <= "010011010100001";
when 10446 => note <= "001100111100011";
when 10447 => note <= "000110010000011";
when 10448 => note <= "000001010111001";
when 10449 => note <= "111111110011011";
when 10450 => note <= "000010001001010";
when 10451 => note <= "000111110011011";
when 10452 => note <= "001111001101111";
when 10453 => note <= "010110010000011";
when 10454 => note <= "011010110011010";
when 10455 => note <= "011011010100001";
when 10456 => note <= "010111010000110";
when 10457 => note <= "001111010000111";
when 10458 => note <= "000100111100011";
when 10459 => note <= "111010100000010";
when 10460 => note <= "110010001001010";
when 10461 => note <= "101101011111110";
when 10462 => note <= "101101001100110";
when 10463 => note <= "110000101111001";
when 10464 => note <= "110110100110001";
when 10465 => note <= "111100101011111";
when 10466 => note <= "000000111010011";
when 10467 => note <= "000001101111101";
when 10468 => note <= "111110101000111";
when 10469 => note <= "111000001100101";
when 10470 => note <= "110000000000000";
when 10471 => note <= "101000001100101";
when 10472 => note <= "100010111011010";
when 10473 => note <= "100001101111101";
when 10474 => note <= "100101001100110";
when 10475 => note <= "101100101011111";
when 10476 => note <= "110110100110001";
when 10477 => note <= "000000101111001";
when 10478 => note <= "001000111010011";
when 10479 => note <= "001101011111110";
when 10480 => note <= "001101110110110";
when 10481 => note <= "001010100000010";
when 10482 => note <= "000100111100011";
when 10483 => note <= "111111010000111";
when 10484 => note <= "111011100011001";
when 10485 => note <= "111011010100001";
when 10486 => note <= "111111000101101";
when 10487 => note <= "000110010000011";
when 10488 => note <= "001111001101111";
when 10489 => note <= "010111110011011";
when 10490 => note <= "011101110110110";
when 10491 => note <= "011111110011011";
when 10492 => note <= "011101000100110";
when 10493 => note <= "010110010000011";
when 10494 => note <= "001100111100011";
when 10495 => note <= "000011010100001";
when 10496 => note <= "111011100011001";
when 10497 => note <= "110111010000111";
when 10498 => note <= "110111000101101";
when 10499 => note <= "111010100000010";
when 10500 => note <= "000000000000000";
when 10501 => note <= "000101011111110";
when 10502 => note <= "001000111010011";
when 10503 => note <= "001000101111001";
when 10504 => note <= "000100011100111";
when 10505 => note <= "111100101011111";
when 10506 => note <= "110011000011101";
when 10507 => note <= "101001101111101";
when 10508 => note <= "100010111011010";
when 10509 => note <= "100000001100101";
when 10510 => note <= "100010001001010";
when 10511 => note <= "101000001100101";
when 10512 => note <= "110000110010001";
when 10513 => note <= "111001101111101";
when 10514 => note <= "000000111010011";
when 10515 => note <= "000100101011111";
when 10516 => note <= "000100011100111";
when 10517 => note <= "000000101111001";
when 10518 => note <= "111011000011101";
when 10519 => note <= "110101011111110";
when 10520 => note <= "110010001001010";
when 10521 => note <= "110010100000010";
when 10522 => note <= "110111000101101";
when 10523 => note <= "111111010000111";
when 10524 => note <= "001001011001111";
when 10525 => note <= "010011010100001";
when 10526 => note <= "011010110011010";
when 10527 => note <= "011110010000011";
when 10528 => note <= "011101000100110";
when 10529 => note <= "010111110011011";
when 10530 => note <= "010000000000000";
when 10531 => note <= "000111110011011";
when 10532 => note <= "000001010111001";
when 10533 => note <= "111110010000011";
when 10534 => note <= "111111000101101";
when 10535 => note <= "000011010100001";
when 10536 => note <= "001001011001111";
when 10537 => note <= "001111010000111";
when 10538 => note <= "010010110011010";
when 10539 => note <= "010010100000010";
when 10540 => note <= "001101110110110";
when 10541 => note <= "000101011111110";
when 10542 => note <= "111011000011101";
when 10543 => note <= "110000101111001";
when 10544 => note <= "101000101111010";
when 10545 => note <= "100100101011111";
when 10546 => note <= "100101001100110";
when 10547 => note <= "101001101111101";
when 10548 => note <= "110000110010001";
when 10549 => note <= "111000001100101";
when 10550 => note <= "111101110110110";
when 10551 => note <= "000000001100101";
when 10552 => note <= "111110101000111";
when 10553 => note <= "111001101111101";
when 10554 => note <= "110011000011101";
when 10555 => note <= "101100101011111";
when 10556 => note <= "101000101111010";
when 10557 => note <= "101000101111001";
when 10558 => note <= "101101001100110";
when 10559 => note <= "110101011111110";
when 10560 => note <= "000000000000000";
when 10561 => note <= "001010100000010";
when 10562 => note <= "010010110011010";
when 10563 => note <= "010111010000111";
when 10564 => note <= "010111010000110";
when 10565 => note <= "010011010100001";
when 10566 => note <= "001100111100011";
when 10567 => note <= "000110010000011";
when 10568 => note <= "000001010111001";
when 10569 => note <= "111111110011011";
when 10570 => note <= "000010001001010";
when 10571 => note <= "000111110011011";
when 10572 => note <= "001111001101111";
when 10573 => note <= "010110010000011";
when 10574 => note <= "011010110011010";
when 10575 => note <= "011011010100001";
when 10576 => note <= "010111010000110";
when 10577 => note <= "001111010000111";
when 10578 => note <= "000100111100011";
when 10579 => note <= "111010100000010";
when 10580 => note <= "110010001001010";
when 10581 => note <= "101101011111110";
when 10582 => note <= "101101001100110";
when 10583 => note <= "110000101111001";
when 10584 => note <= "110110100110001";
when 10585 => note <= "111100101011111";
when 10586 => note <= "000000111010011";
when 10587 => note <= "000001101111101";
when 10588 => note <= "111110101000111";
when 10589 => note <= "111000001100101";
when 10590 => note <= "110000000000000";
when 10591 => note <= "101000001100101";
when 10592 => note <= "100010111011010";
when 10593 => note <= "100001101111101";
when 10594 => note <= "100101001100110";
when 10595 => note <= "101100101011111";
when 10596 => note <= "110110100110001";
when 10597 => note <= "000000101111001";
when 10598 => note <= "001000111010011";
when 10599 => note <= "001101011111110";
when 10600 => note <= "001101110110110";
when 10601 => note <= "001010100000010";
when 10602 => note <= "000100111100011";
when 10603 => note <= "111111010000111";
when 10604 => note <= "111011100011001";
when 10605 => note <= "111011010100001";
when 10606 => note <= "111111000101101";
when 10607 => note <= "000110010000011";
when 10608 => note <= "001111001101111";
when 10609 => note <= "010111110011011";
when 10610 => note <= "011101110110110";
when 10611 => note <= "011111110011011";
when 10612 => note <= "011101000100110";
when 10613 => note <= "010110010000011";
when 10614 => note <= "001100111100011";
when 10615 => note <= "000011010100001";
when 10616 => note <= "111011100011001";
when 10617 => note <= "110111010000111";
when 10618 => note <= "110111000101101";
when 10619 => note <= "111010100000010";
when 10620 => note <= "000000000000000";
when 10621 => note <= "000101011111110";
when 10622 => note <= "001000111010011";
when 10623 => note <= "001000101111001";
when 10624 => note <= "000100011100111";
when 10625 => note <= "111100101011111";
when 10626 => note <= "110011000011101";
when 10627 => note <= "101001101111101";
when 10628 => note <= "100010111011010";
when 10629 => note <= "100000001100101";
when 10630 => note <= "100010001001010";
when 10631 => note <= "101000001100101";
when 10632 => note <= "110000110010001";
when 10633 => note <= "111001101111101";
when 10634 => note <= "000000111010011";
when 10635 => note <= "000100101011111";
when 10636 => note <= "000100011100111";
when 10637 => note <= "000000101111001";
when 10638 => note <= "111011000011101";
when 10639 => note <= "110101011111110";
when 10640 => note <= "110010001001010";
when 10641 => note <= "110010100000010";
when 10642 => note <= "110111000101101";
when 10643 => note <= "111111010000111";
when 10644 => note <= "001001011001111";
when 10645 => note <= "010011010100001";
when 10646 => note <= "011010110011010";
when 10647 => note <= "011110010000011";
when 10648 => note <= "011101000100110";
when 10649 => note <= "010111110011011";
when 10650 => note <= "010000000000000";
when 10651 => note <= "000111110011011";
when 10652 => note <= "000001010111001";
when 10653 => note <= "111110010000011";
when 10654 => note <= "111111000101101";
when 10655 => note <= "000011010100001";
when 10656 => note <= "001001011001111";
when 10657 => note <= "001111010000111";
when 10658 => note <= "010010110011010";
when 10659 => note <= "010010100000010";
when 10660 => note <= "001101110110110";
when 10661 => note <= "000101011111110";
when 10662 => note <= "111011000011101";
when 10663 => note <= "110000101111001";
when 10664 => note <= "101000101111010";
when 10665 => note <= "100100101011111";
when 10666 => note <= "100101001100110";
when 10667 => note <= "101001101111101";
when 10668 => note <= "110000110010001";
when 10669 => note <= "111000001100101";
when 10670 => note <= "111101110110110";
when 10671 => note <= "000000001100101";
when 10672 => note <= "111110101000111";
when 10673 => note <= "111001101111101";
when 10674 => note <= "110011000011101";
when 10675 => note <= "101100101011111";
when 10676 => note <= "101000101111010";
when 10677 => note <= "101000101111001";
when 10678 => note <= "101101001100110";
when 10679 => note <= "110101011111110";
when 10680 => note <= "000000000000000";
when 10681 => note <= "001010100000010";
when 10682 => note <= "010010110011010";
when 10683 => note <= "010111010000111";
when 10684 => note <= "010111010000110";
when 10685 => note <= "010011010100001";
when 10686 => note <= "001100111100011";
when 10687 => note <= "000110010000011";
when 10688 => note <= "000001010111001";
when 10689 => note <= "111111110011011";
when 10690 => note <= "000010001001010";
when 10691 => note <= "000111110011011";
when 10692 => note <= "001111001101111";
when 10693 => note <= "010110010000011";
when 10694 => note <= "011010110011010";
when 10695 => note <= "011011010100001";
when 10696 => note <= "010111010000110";
when 10697 => note <= "001111010000111";
when 10698 => note <= "000100111100011";
when 10699 => note <= "111010100000010";
when 10700 => note <= "110010001001010";
when 10701 => note <= "101101011111110";
when 10702 => note <= "101101001100110";
when 10703 => note <= "110000101111001";
when 10704 => note <= "110110100110001";
when 10705 => note <= "111100101011111";
when 10706 => note <= "000000111010011";
when 10707 => note <= "000001101111101";
when 10708 => note <= "111110101000111";
when 10709 => note <= "111000001100101";
when 10710 => note <= "110000000000000";
when 10711 => note <= "101000001100101";
when 10712 => note <= "100010111011010";
when 10713 => note <= "100001101111101";
when 10714 => note <= "100101001100110";
when 10715 => note <= "101100101011111";
when 10716 => note <= "110110100110001";
when 10717 => note <= "000000101111001";
when 10718 => note <= "001000111010011";
when 10719 => note <= "001101011111110";
when 10720 => note <= "001101110110110";
when 10721 => note <= "001010100000010";
when 10722 => note <= "000100111100011";
when 10723 => note <= "111111010000111";
when 10724 => note <= "111011100011001";
when 10725 => note <= "111011010100001";
when 10726 => note <= "111111000101101";
when 10727 => note <= "000110010000011";
when 10728 => note <= "001111001101111";
when 10729 => note <= "010111110011011";
when 10730 => note <= "011101110110110";
when 10731 => note <= "011111110011011";
when 10732 => note <= "011101000100110";
when 10733 => note <= "010110010000011";
when 10734 => note <= "001100111100011";
when 10735 => note <= "000011010100001";
when 10736 => note <= "111011100011001";
when 10737 => note <= "110111010000111";
when 10738 => note <= "110111000101101";
when 10739 => note <= "111010100000010";
when 10740 => note <= "000000000000000";
when 10741 => note <= "000101011111110";
when 10742 => note <= "001000111010011";
when 10743 => note <= "001000101111001";
when 10744 => note <= "000100011100111";
when 10745 => note <= "111100101011111";
when 10746 => note <= "110011000011101";
when 10747 => note <= "101001101111101";
when 10748 => note <= "100010111011010";
when 10749 => note <= "100000001100101";
when 10750 => note <= "100010001001010";
when 10751 => note <= "101000001100101";
when 10752 => note <= "110000110010001";
when 10753 => note <= "111001101111101";
when 10754 => note <= "000000111010011";
when 10755 => note <= "000100101011111";
when 10756 => note <= "000100011100111";
when 10757 => note <= "000000101111001";
when 10758 => note <= "111011000011101";
when 10759 => note <= "110101011111110";
when 10760 => note <= "110010001001010";
when 10761 => note <= "110010100000010";
when 10762 => note <= "110111000101101";
when 10763 => note <= "111111010000111";
when 10764 => note <= "001001011001111";
when 10765 => note <= "010011010100001";
when 10766 => note <= "011010110011010";
when 10767 => note <= "011110010000011";
when 10768 => note <= "011101000100110";
when 10769 => note <= "010111110011011";
when 10770 => note <= "010000000000000";
when 10771 => note <= "000111110011011";
when 10772 => note <= "000001010111001";
when 10773 => note <= "111110010000011";
when 10774 => note <= "111111000101101";
when 10775 => note <= "000011010100001";
when 10776 => note <= "001001011001111";
when 10777 => note <= "001111010000111";
when 10778 => note <= "010010110011010";
when 10779 => note <= "010010100000010";
when 10780 => note <= "001101110110110";
when 10781 => note <= "000101011111110";
when 10782 => note <= "111011000011101";
when 10783 => note <= "110000101111001";
when 10784 => note <= "101000101111010";
when 10785 => note <= "100100101011111";
when 10786 => note <= "100101001100110";
when 10787 => note <= "101001101111101";
when 10788 => note <= "110000110010001";
when 10789 => note <= "111000001100101";
when 10790 => note <= "111101110110110";
when 10791 => note <= "000000001100101";
when 10792 => note <= "111110101000111";
when 10793 => note <= "111001101111101";
when 10794 => note <= "110011000011101";
when 10795 => note <= "101100101011111";
when 10796 => note <= "101000101111010";
when 10797 => note <= "101000101111001";
when 10798 => note <= "101101001100110";
when 10799 => note <= "110101011111110";
when 10800 => note <= "000000000000000";
when 10801 => note <= "001010100000010";
when 10802 => note <= "010010110011010";
when 10803 => note <= "010111010000111";
when 10804 => note <= "010111010000110";
when 10805 => note <= "010011010100001";
when 10806 => note <= "001100111100011";
when 10807 => note <= "000110010000011";
when 10808 => note <= "000001010111001";
when 10809 => note <= "111111110011011";
when 10810 => note <= "000010001001010";
when 10811 => note <= "000111110011011";
when 10812 => note <= "001111001101111";
when 10813 => note <= "010110010000011";
when 10814 => note <= "011010110011010";
when 10815 => note <= "011011010100001";
when 10816 => note <= "010111010000110";
when 10817 => note <= "001111010000111";
when 10818 => note <= "000100111100011";
when 10819 => note <= "111010100000010";
when 10820 => note <= "110010001001010";
when 10821 => note <= "101101011111110";
when 10822 => note <= "101101001100110";
when 10823 => note <= "110000101111001";
when 10824 => note <= "110110100110001";
when 10825 => note <= "111100101011111";
when 10826 => note <= "000000111010011";
when 10827 => note <= "000001101111101";
when 10828 => note <= "111110101000111";
when 10829 => note <= "111000001100101";
when 10830 => note <= "110000000000000";
when 10831 => note <= "101000001100101";
when 10832 => note <= "100010111011010";
when 10833 => note <= "100001101111101";
when 10834 => note <= "100101001100110";
when 10835 => note <= "101100101011111";
when 10836 => note <= "110110100110001";
when 10837 => note <= "000000101111001";
when 10838 => note <= "001000111010011";
when 10839 => note <= "001101011111110";
when 10840 => note <= "001101110110110";
when 10841 => note <= "001010100000010";
when 10842 => note <= "000100111100011";
when 10843 => note <= "111111010000111";
when 10844 => note <= "111011100011001";
when 10845 => note <= "111011010100001";
when 10846 => note <= "111111000101101";
when 10847 => note <= "000110010000011";
when 10848 => note <= "001111001101111";
when 10849 => note <= "010111110011011";
when 10850 => note <= "011101110110110";
when 10851 => note <= "011111110011011";
when 10852 => note <= "011101000100110";
when 10853 => note <= "010110010000011";
when 10854 => note <= "001100111100011";
when 10855 => note <= "000011010100001";
when 10856 => note <= "111011100011001";
when 10857 => note <= "110111010000111";
when 10858 => note <= "110111000101101";
when 10859 => note <= "111010100000010";
when 10860 => note <= "000000000000000";
when 10861 => note <= "000101011111110";
when 10862 => note <= "001000111010011";
when 10863 => note <= "001000101111001";
when 10864 => note <= "000100011100111";
when 10865 => note <= "111100101011111";
when 10866 => note <= "110011000011101";
when 10867 => note <= "101001101111101";
when 10868 => note <= "100010111011010";
when 10869 => note <= "100000001100101";
when 10870 => note <= "100010001001010";
when 10871 => note <= "101000001100101";
when 10872 => note <= "110000110010001";
when 10873 => note <= "111001101111101";
when 10874 => note <= "000000111010011";
when 10875 => note <= "000100101011111";
when 10876 => note <= "000100011100111";
when 10877 => note <= "000000101111001";
when 10878 => note <= "111011000011101";
when 10879 => note <= "110101011111110";
when 10880 => note <= "110010001001010";
when 10881 => note <= "110010100000010";
when 10882 => note <= "110111000101101";
when 10883 => note <= "111111010000111";
when 10884 => note <= "001001011001111";
when 10885 => note <= "010011010100001";
when 10886 => note <= "011010110011010";
when 10887 => note <= "011110010000011";
when 10888 => note <= "011101000100110";
when 10889 => note <= "010111110011011";
when 10890 => note <= "010000000000000";
when 10891 => note <= "000111110011011";
when 10892 => note <= "000001010111001";
when 10893 => note <= "111110010000011";
when 10894 => note <= "111111000101101";
when 10895 => note <= "000011010100001";
when 10896 => note <= "001001011001111";
when 10897 => note <= "001111010000111";
when 10898 => note <= "010010110011010";
when 10899 => note <= "010010100000010";
when 10900 => note <= "001101110110110";
when 10901 => note <= "000101011111110";
when 10902 => note <= "111011000011101";
when 10903 => note <= "110000101111001";
when 10904 => note <= "101000101111010";
when 10905 => note <= "100100101011111";
when 10906 => note <= "100101001100110";
when 10907 => note <= "101001101111101";
when 10908 => note <= "110000110010001";
when 10909 => note <= "111000001100101";
when 10910 => note <= "111101110110110";
when 10911 => note <= "000000001100101";
when 10912 => note <= "111110101000111";
when 10913 => note <= "111001101111101";
when 10914 => note <= "110011000011101";
when 10915 => note <= "101100101011111";
when 10916 => note <= "101000101111010";
when 10917 => note <= "101000101111001";
when 10918 => note <= "101101001100110";
when 10919 => note <= "110101011111110";
when 10920 => note <= "000000000000000";
when 10921 => note <= "001010100000010";
when 10922 => note <= "010010110011010";
when 10923 => note <= "010111010000111";
when 10924 => note <= "010111010000110";
when 10925 => note <= "010011010100001";
when 10926 => note <= "001100111100011";
when 10927 => note <= "000110010000011";
when 10928 => note <= "000001010111001";
when 10929 => note <= "111111110011011";
when 10930 => note <= "000010001001010";
when 10931 => note <= "000111110011011";
when 10932 => note <= "001111001101111";
when 10933 => note <= "010110010000011";
when 10934 => note <= "011010110011010";
when 10935 => note <= "011011010100001";
when 10936 => note <= "010111010000110";
when 10937 => note <= "001111010000111";
when 10938 => note <= "000100111100011";
when 10939 => note <= "111010100000010";
when 10940 => note <= "110010001001010";
when 10941 => note <= "101101011111110";
when 10942 => note <= "101101001100110";
when 10943 => note <= "110000101111001";
when 10944 => note <= "110110100110001";
when 10945 => note <= "111100101011111";
when 10946 => note <= "000000111010011";
when 10947 => note <= "000001101111101";
when 10948 => note <= "111110101000111";
when 10949 => note <= "111000001100101";
when 10950 => note <= "110000000000000";
when 10951 => note <= "101000001100101";
when 10952 => note <= "100010111011010";
when 10953 => note <= "100001101111101";
when 10954 => note <= "100101001100110";
when 10955 => note <= "101100101011111";
when 10956 => note <= "110110100110001";
when 10957 => note <= "000000101111001";
when 10958 => note <= "001000111010011";
when 10959 => note <= "001101011111110";
when 10960 => note <= "001101110110110";
when 10961 => note <= "001010100000010";
when 10962 => note <= "000100111100011";
when 10963 => note <= "111111010000111";
when 10964 => note <= "111011100011001";
when 10965 => note <= "111011010100001";
when 10966 => note <= "111111000101101";
when 10967 => note <= "000110010000011";
when 10968 => note <= "001111001101111";
when 10969 => note <= "010111110011011";
when 10970 => note <= "011101110110110";
when 10971 => note <= "011111110011011";
when 10972 => note <= "011101000100110";
when 10973 => note <= "010110010000011";
when 10974 => note <= "001100111100011";
when 10975 => note <= "000011010100001";
when 10976 => note <= "111011100011001";
when 10977 => note <= "110111010000111";
when 10978 => note <= "110111000101101";
when 10979 => note <= "111010100000010";
when 10980 => note <= "000000000000000";
when 10981 => note <= "000101011111110";
when 10982 => note <= "001000111010011";
when 10983 => note <= "001000101111001";
when 10984 => note <= "000100011100111";
when 10985 => note <= "111100101011111";
when 10986 => note <= "110011000011101";
when 10987 => note <= "101001101111101";
when 10988 => note <= "100010111011010";
when 10989 => note <= "100000001100101";
when 10990 => note <= "100010001001010";
when 10991 => note <= "101000001100101";
when 10992 => note <= "110000110010001";
when 10993 => note <= "111001101111101";
when 10994 => note <= "000000111010011";
when 10995 => note <= "000100101011111";
when 10996 => note <= "000100011100111";
when 10997 => note <= "000000101111001";
when 10998 => note <= "111011000011101";
when 10999 => note <= "110101011111110";
when 11000 => note <= "110010001001010";
when 11001 => note <= "110010100000010";
when 11002 => note <= "110111000101101";
when 11003 => note <= "111111010000111";
when 11004 => note <= "001001011001111";
when 11005 => note <= "010011010100001";
when 11006 => note <= "011010110011010";
when 11007 => note <= "011110010000011";
when 11008 => note <= "011101000100110";
when 11009 => note <= "010111110011011";
when 11010 => note <= "010000000000000";
when 11011 => note <= "000111110011011";
when 11012 => note <= "000001010111001";
when 11013 => note <= "111110010000011";
when 11014 => note <= "111111000101101";
when 11015 => note <= "000011010100001";
when 11016 => note <= "001001011001111";
when 11017 => note <= "001111010000111";
when 11018 => note <= "010010110011010";
when 11019 => note <= "010010100000010";
when 11020 => note <= "001101110110110";
when 11021 => note <= "000101011111110";
when 11022 => note <= "111011000011101";
when 11023 => note <= "110000101111001";
when 11024 => note <= "101000101111010";
when 11025 => note <= "100100101011111";
when 11026 => note <= "100101001100110";
when 11027 => note <= "101001101111101";
when 11028 => note <= "110000110010001";
when 11029 => note <= "111000001100101";
when 11030 => note <= "111101110110110";
when 11031 => note <= "000000001100101";
when 11032 => note <= "111110101000111";
when 11033 => note <= "111001101111101";
when 11034 => note <= "110011000011101";
when 11035 => note <= "101100101011111";
when 11036 => note <= "101000101111010";
when 11037 => note <= "101000101111001";
when 11038 => note <= "101101001100110";
when 11039 => note <= "110101011111110";
when 11040 => note <= "000000000000000";
when 11041 => note <= "001010100000010";
when 11042 => note <= "010010110011010";
when 11043 => note <= "010111010000111";
when 11044 => note <= "010111010000110";
when 11045 => note <= "010011010100001";
when 11046 => note <= "001100111100011";
when 11047 => note <= "000110010000011";
when 11048 => note <= "000001010111001";
when 11049 => note <= "111111110011011";
when 11050 => note <= "000010001001010";
when 11051 => note <= "000111110011011";
when 11052 => note <= "001111001101111";
when 11053 => note <= "010110010000011";
when 11054 => note <= "011010110011010";
when 11055 => note <= "011011010100001";
when 11056 => note <= "010111010000110";
when 11057 => note <= "001111010000111";
when 11058 => note <= "000100111100011";
when 11059 => note <= "111010100000010";
when 11060 => note <= "110010001001010";
when 11061 => note <= "101101011111110";
when 11062 => note <= "101101001100110";
when 11063 => note <= "110000101111001";
when 11064 => note <= "110110100110001";
when 11065 => note <= "111100101011111";
when 11066 => note <= "000000111010011";
when 11067 => note <= "000001101111101";
when 11068 => note <= "111110101000111";
when 11069 => note <= "111000001100101";
when 11070 => note <= "110000000000000";
when 11071 => note <= "101000001100101";
when 11072 => note <= "100010111011010";
when 11073 => note <= "100001101111101";
when 11074 => note <= "100101001100110";
when 11075 => note <= "101100101011111";
when 11076 => note <= "110110100110001";
when 11077 => note <= "000000101111001";
when 11078 => note <= "001000111010011";
when 11079 => note <= "001101011111110";
when 11080 => note <= "001101110110110";
when 11081 => note <= "001010100000010";
when 11082 => note <= "000100111100011";
when 11083 => note <= "111111010000111";
when 11084 => note <= "111011100011001";
when 11085 => note <= "111011010100001";
when 11086 => note <= "111111000101101";
when 11087 => note <= "000110010000011";
when 11088 => note <= "001111001101111";
when 11089 => note <= "010111110011011";
when 11090 => note <= "011101110110110";
when 11091 => note <= "011111110011011";
when 11092 => note <= "011101000100110";
when 11093 => note <= "010110010000011";
when 11094 => note <= "001100111100011";
when 11095 => note <= "000011010100001";
when 11096 => note <= "111011100011001";
when 11097 => note <= "110111010000111";
when 11098 => note <= "110111000101101";
when 11099 => note <= "111010100000010";
when 11100 => note <= "000000000000000";
when 11101 => note <= "000101011111110";
when 11102 => note <= "001000111010011";
when 11103 => note <= "001000101111001";
when 11104 => note <= "000100011100111";
when 11105 => note <= "111100101011111";
when 11106 => note <= "110011000011101";
when 11107 => note <= "101001101111101";
when 11108 => note <= "100010111011010";
when 11109 => note <= "100000001100101";
when 11110 => note <= "100010001001010";
when 11111 => note <= "101000001100101";
when 11112 => note <= "110000110010001";
when 11113 => note <= "111001101111101";
when 11114 => note <= "000000111010011";
when 11115 => note <= "000100101011111";
when 11116 => note <= "000100011100111";
when 11117 => note <= "000000101111001";
when 11118 => note <= "111011000011101";
when 11119 => note <= "110101011111110";
when 11120 => note <= "110010001001010";
when 11121 => note <= "110010100000010";
when 11122 => note <= "110111000101101";
when 11123 => note <= "111111010000111";
when 11124 => note <= "001001011001111";
when 11125 => note <= "010011010100001";
when 11126 => note <= "011010110011010";
when 11127 => note <= "011110010000011";
when 11128 => note <= "011101000100110";
when 11129 => note <= "010111110011011";
when 11130 => note <= "010000000000000";
when 11131 => note <= "000111110011011";
when 11132 => note <= "000001010111001";
when 11133 => note <= "111110010000011";
when 11134 => note <= "111111000101101";
when 11135 => note <= "000011010100001";
when 11136 => note <= "001001011001111";
when 11137 => note <= "001111010000111";
when 11138 => note <= "010010110011010";
when 11139 => note <= "010010100000010";
when 11140 => note <= "001101110110110";
when 11141 => note <= "000101011111110";
when 11142 => note <= "111011000011101";
when 11143 => note <= "110000101111001";
when 11144 => note <= "101000101111010";
when 11145 => note <= "100100101011111";
when 11146 => note <= "100101001100110";
when 11147 => note <= "101001101111101";
when 11148 => note <= "110000110010001";
when 11149 => note <= "111000001100101";
when 11150 => note <= "111101110110110";
when 11151 => note <= "000000001100101";
when 11152 => note <= "111110101000111";
when 11153 => note <= "111001101111101";
when 11154 => note <= "110011000011101";
when 11155 => note <= "101100101011111";
when 11156 => note <= "101000101111010";
when 11157 => note <= "101000101111001";
when 11158 => note <= "101101001100110";
when 11159 => note <= "110101011111110";
when 11160 => note <= "000000000000000";
when 11161 => note <= "001010100000010";
when 11162 => note <= "010010110011010";
when 11163 => note <= "010111010000111";
when 11164 => note <= "010111010000110";
when 11165 => note <= "010011010100001";
when 11166 => note <= "001100111100011";
when 11167 => note <= "000110010000011";
when 11168 => note <= "000001010111001";
when 11169 => note <= "111111110011011";
when 11170 => note <= "000010001001010";
when 11171 => note <= "000111110011011";
when 11172 => note <= "001111001101111";
when 11173 => note <= "010110010000011";
when 11174 => note <= "011010110011010";
when 11175 => note <= "011011010100001";
when 11176 => note <= "010111010000110";
when 11177 => note <= "001111010000111";
when 11178 => note <= "000100111100011";
when 11179 => note <= "111010100000010";
when 11180 => note <= "110010001001010";
when 11181 => note <= "101101011111110";
when 11182 => note <= "101101001100110";
when 11183 => note <= "110000101111001";
when 11184 => note <= "110110100110001";
when 11185 => note <= "111100101011111";
when 11186 => note <= "000000111010011";
when 11187 => note <= "000001101111101";
when 11188 => note <= "111110101000111";
when 11189 => note <= "111000001100101";
when 11190 => note <= "110000000000000";
when 11191 => note <= "101000001100101";
when 11192 => note <= "100010111011010";
when 11193 => note <= "100001101111101";
when 11194 => note <= "100101001100110";
when 11195 => note <= "101100101011111";
when 11196 => note <= "110110100110001";
when 11197 => note <= "000000101111001";
when 11198 => note <= "001000111010011";
when 11199 => note <= "001101011111110";
when 11200 => note <= "001101110110110";
when 11201 => note <= "001010100000010";
when 11202 => note <= "000100111100011";
when 11203 => note <= "111111010000111";
when 11204 => note <= "111011100011001";
when 11205 => note <= "111011010100001";
when 11206 => note <= "111111000101101";
when 11207 => note <= "000110010000011";
when 11208 => note <= "001111001101111";
when 11209 => note <= "010111110011011";
when 11210 => note <= "011101110110110";
when 11211 => note <= "011111110011011";
when 11212 => note <= "011101000100110";
when 11213 => note <= "010110010000011";
when 11214 => note <= "001100111100011";
when 11215 => note <= "000011010100001";
when 11216 => note <= "111011100011001";
when 11217 => note <= "110111010000111";
when 11218 => note <= "110111000101101";
when 11219 => note <= "111010100000010";
when 11220 => note <= "000000000000000";
when 11221 => note <= "000101011111110";
when 11222 => note <= "001000111010011";
when 11223 => note <= "001000101111001";
when 11224 => note <= "000100011100111";
when 11225 => note <= "111100101011111";
when 11226 => note <= "110011000011101";
when 11227 => note <= "101001101111101";
when 11228 => note <= "100010111011010";
when 11229 => note <= "100000001100101";
when 11230 => note <= "100010001001010";
when 11231 => note <= "101000001100101";
when 11232 => note <= "110000110010001";
when 11233 => note <= "111001101111101";
when 11234 => note <= "000000111010011";
when 11235 => note <= "000100101011111";
when 11236 => note <= "000100011100111";
when 11237 => note <= "000000101111001";
when 11238 => note <= "111011000011101";
when 11239 => note <= "110101011111110";
when 11240 => note <= "110010001001010";
when 11241 => note <= "110010100000010";
when 11242 => note <= "110111000101101";
when 11243 => note <= "111111010000111";
when 11244 => note <= "001001011001111";
when 11245 => note <= "010011010100001";
when 11246 => note <= "011010110011010";
when 11247 => note <= "011110010000011";
when 11248 => note <= "011101000100110";
when 11249 => note <= "010111110011011";
when 11250 => note <= "010000000000000";
when 11251 => note <= "000111110011011";
when 11252 => note <= "000001010111001";
when 11253 => note <= "111110010000011";
when 11254 => note <= "111111000101101";
when 11255 => note <= "000011010100001";
when 11256 => note <= "001001011001111";
when 11257 => note <= "001111010000111";
when 11258 => note <= "010010110011010";
when 11259 => note <= "010010100000010";
when 11260 => note <= "001101110110110";
when 11261 => note <= "000101011111110";
when 11262 => note <= "111011000011101";
when 11263 => note <= "110000101111001";
when 11264 => note <= "101000101111010";
when 11265 => note <= "100100101011111";
when 11266 => note <= "100101001100110";
when 11267 => note <= "101001101111101";
when 11268 => note <= "110000110010001";
when 11269 => note <= "111000001100101";
when 11270 => note <= "111101110110110";
when 11271 => note <= "000000001100101";
when 11272 => note <= "111110101000111";
when 11273 => note <= "111001101111101";
when 11274 => note <= "110011000011101";
when 11275 => note <= "101100101011111";
when 11276 => note <= "101000101111010";
when 11277 => note <= "101000101111001";
when 11278 => note <= "101101001100110";
when 11279 => note <= "110101011111110";
when 11280 => note <= "000000000000000";
when 11281 => note <= "001010100000010";
when 11282 => note <= "010010110011010";
when 11283 => note <= "010111010000111";
when 11284 => note <= "010111010000110";
when 11285 => note <= "010011010100001";
when 11286 => note <= "001100111100011";
when 11287 => note <= "000110010000011";
when 11288 => note <= "000001010111001";
when 11289 => note <= "111111110011011";
when 11290 => note <= "000010001001010";
when 11291 => note <= "000111110011011";
when 11292 => note <= "001111001101111";
when 11293 => note <= "010110010000011";
when 11294 => note <= "011010110011010";
when 11295 => note <= "011011010100001";
when 11296 => note <= "010111010000110";
when 11297 => note <= "001111010000111";
when 11298 => note <= "000100111100011";
when 11299 => note <= "111010100000010";
when 11300 => note <= "110010001001010";
when 11301 => note <= "101101011111110";
when 11302 => note <= "101101001100110";
when 11303 => note <= "110000101111001";
when 11304 => note <= "110110100110001";
when 11305 => note <= "111100101011111";
when 11306 => note <= "000000111010011";
when 11307 => note <= "000001101111101";
when 11308 => note <= "111110101000111";
when 11309 => note <= "111000001100101";
when 11310 => note <= "110000000000000";
when 11311 => note <= "101000001100101";
when 11312 => note <= "100010111011010";
when 11313 => note <= "100001101111101";
when 11314 => note <= "100101001100110";
when 11315 => note <= "101100101011111";
when 11316 => note <= "110110100110001";
when 11317 => note <= "000000101111001";
when 11318 => note <= "001000111010011";
when 11319 => note <= "001101011111110";
when 11320 => note <= "001101110110110";
when 11321 => note <= "001010100000010";
when 11322 => note <= "000100111100011";
when 11323 => note <= "111111010000111";
when 11324 => note <= "111011100011001";
when 11325 => note <= "111011010100001";
when 11326 => note <= "111111000101101";
when 11327 => note <= "000110010000011";
when 11328 => note <= "001111001101111";
when 11329 => note <= "010111110011011";
when 11330 => note <= "011101110110110";
when 11331 => note <= "011111110011011";
when 11332 => note <= "011101000100110";
when 11333 => note <= "010110010000011";
when 11334 => note <= "001100111100011";
when 11335 => note <= "000011010100001";
when 11336 => note <= "111011100011001";
when 11337 => note <= "110111010000111";
when 11338 => note <= "110111000101101";
when 11339 => note <= "111010100000010";
when 11340 => note <= "000000000000000";
when 11341 => note <= "000101011111110";
when 11342 => note <= "001000111010011";
when 11343 => note <= "001000101111001";
when 11344 => note <= "000100011100111";
when 11345 => note <= "111100101011111";
when 11346 => note <= "110011000011101";
when 11347 => note <= "101001101111101";
when 11348 => note <= "100010111011010";
when 11349 => note <= "100000001100101";
when 11350 => note <= "100010001001010";
when 11351 => note <= "101000001100101";
when 11352 => note <= "110000110010001";
when 11353 => note <= "111001101111101";
when 11354 => note <= "000000111010011";
when 11355 => note <= "000100101011111";
when 11356 => note <= "000100011100111";
when 11357 => note <= "000000101111001";
when 11358 => note <= "111011000011101";
when 11359 => note <= "110101011111110";
when 11360 => note <= "110010001001010";
when 11361 => note <= "110010100000010";
when 11362 => note <= "110111000101101";
when 11363 => note <= "111111010000111";
when 11364 => note <= "001001011001111";
when 11365 => note <= "010011010100001";
when 11366 => note <= "011010110011010";
when 11367 => note <= "011110010000011";
when 11368 => note <= "011101000100110";
when 11369 => note <= "010111110011011";
when 11370 => note <= "010000000000000";
when 11371 => note <= "000111110011011";
when 11372 => note <= "000001010111001";
when 11373 => note <= "111110010000011";
when 11374 => note <= "111111000101101";
when 11375 => note <= "000011010100001";
when 11376 => note <= "001001011001111";
when 11377 => note <= "001111010000111";
when 11378 => note <= "010010110011010";
when 11379 => note <= "010010100000010";
when 11380 => note <= "001101110110110";
when 11381 => note <= "000101011111110";
when 11382 => note <= "111011000011101";
when 11383 => note <= "110000101111001";
when 11384 => note <= "101000101111010";
when 11385 => note <= "100100101011111";
when 11386 => note <= "100101001100110";
when 11387 => note <= "101001101111101";
when 11388 => note <= "110000110010001";
when 11389 => note <= "111000001100101";
when 11390 => note <= "111101110110110";
when 11391 => note <= "000000001100101";
when 11392 => note <= "111110101000111";
when 11393 => note <= "111001101111101";
when 11394 => note <= "110011000011101";
when 11395 => note <= "101100101011111";
when 11396 => note <= "101000101111010";
when 11397 => note <= "101000101111001";
when 11398 => note <= "101101001100110";
when 11399 => note <= "110101011111110";
when 11400 => note <= "000000000000000";
when 11401 => note <= "001010100000010";
when 11402 => note <= "010010110011010";
when 11403 => note <= "010111010000111";
when 11404 => note <= "010111010000110";
when 11405 => note <= "010011010100001";
when 11406 => note <= "001100111100011";
when 11407 => note <= "000110010000011";
when 11408 => note <= "000001010111001";
when 11409 => note <= "111111110011011";
when 11410 => note <= "000010001001010";
when 11411 => note <= "000111110011011";
when 11412 => note <= "001111001101111";
when 11413 => note <= "010110010000011";
when 11414 => note <= "011010110011010";
when 11415 => note <= "011011010100001";
when 11416 => note <= "010111010000110";
when 11417 => note <= "001111010000111";
when 11418 => note <= "000100111100011";
when 11419 => note <= "111010100000010";
when 11420 => note <= "110010001001010";
when 11421 => note <= "101101011111110";
when 11422 => note <= "101101001100110";
when 11423 => note <= "110000101111001";
when 11424 => note <= "110110100110001";
when 11425 => note <= "111100101011111";
when 11426 => note <= "000000111010011";
when 11427 => note <= "000001101111101";
when 11428 => note <= "111110101000111";
when 11429 => note <= "111000001100101";
when 11430 => note <= "110000000000000";
when 11431 => note <= "101000001100101";
when 11432 => note <= "100010111011010";
when 11433 => note <= "100001101111101";
when 11434 => note <= "100101001100110";
when 11435 => note <= "101100101011111";
when 11436 => note <= "110110100110001";
when 11437 => note <= "000000101111001";
when 11438 => note <= "001000111010011";
when 11439 => note <= "001101011111110";
when 11440 => note <= "001101110110110";
when 11441 => note <= "001010100000010";
when 11442 => note <= "000100111100011";
when 11443 => note <= "111111010000111";
when 11444 => note <= "111011100011001";
when 11445 => note <= "111011010100001";
when 11446 => note <= "111111000101101";
when 11447 => note <= "000110010000011";
when 11448 => note <= "001111001101111";
when 11449 => note <= "010111110011011";
when 11450 => note <= "011101110110110";
when 11451 => note <= "011111110011011";
when 11452 => note <= "011101000100110";
when 11453 => note <= "010110010000011";
when 11454 => note <= "001100111100011";
when 11455 => note <= "000011010100001";
when 11456 => note <= "111011100011001";
when 11457 => note <= "110111010000111";
when 11458 => note <= "110111000101101";
when 11459 => note <= "111010100000010";
when 11460 => note <= "000000000000000";
when 11461 => note <= "000101011111110";
when 11462 => note <= "001000111010011";
when 11463 => note <= "001000101111001";
when 11464 => note <= "000100011100111";
when 11465 => note <= "111100101011111";
when 11466 => note <= "110011000011101";
when 11467 => note <= "101001101111101";
when 11468 => note <= "100010111011010";
when 11469 => note <= "100000001100101";
when 11470 => note <= "100010001001010";
when 11471 => note <= "101000001100101";
when 11472 => note <= "110000110010001";
when 11473 => note <= "111001101111101";
when 11474 => note <= "000000111010011";
when 11475 => note <= "000100101011111";
when 11476 => note <= "000100011100111";
when 11477 => note <= "000000101111001";
when 11478 => note <= "111011000011101";
when 11479 => note <= "110101011111110";
when 11480 => note <= "110010001001010";
when 11481 => note <= "110010100000010";
when 11482 => note <= "110111000101101";
when 11483 => note <= "111111010000111";
when 11484 => note <= "001001011001111";
when 11485 => note <= "010011010100001";
when 11486 => note <= "011010110011010";
when 11487 => note <= "011110010000011";
when 11488 => note <= "011101000100110";
when 11489 => note <= "010111110011011";
when 11490 => note <= "010000000000000";
when 11491 => note <= "000111110011011";
when 11492 => note <= "000001010111001";
when 11493 => note <= "111110010000011";
when 11494 => note <= "111111000101101";
when 11495 => note <= "000011010100001";
when 11496 => note <= "001001011001111";
when 11497 => note <= "001111010000111";
when 11498 => note <= "010010110011010";
when 11499 => note <= "010010100000010";
when 11500 => note <= "001101110110110";
when 11501 => note <= "000101011111110";
when 11502 => note <= "111011000011101";
when 11503 => note <= "110000101111001";
when 11504 => note <= "101000101111010";
when 11505 => note <= "100100101011111";
when 11506 => note <= "100101001100110";
when 11507 => note <= "101001101111101";
when 11508 => note <= "110000110010001";
when 11509 => note <= "111000001100101";
when 11510 => note <= "111101110110110";
when 11511 => note <= "000000001100101";
when 11512 => note <= "111110101000111";
when 11513 => note <= "111001101111101";
when 11514 => note <= "110011000011101";
when 11515 => note <= "101100101011111";
when 11516 => note <= "101000101111010";
when 11517 => note <= "101000101111001";
when 11518 => note <= "101101001100110";
when 11519 => note <= "110101011111110";
when 11520 => note <= "000000000000000";
when 11521 => note <= "001010100000010";
when 11522 => note <= "010010110011010";
when 11523 => note <= "010111010000111";
when 11524 => note <= "010111010000110";
when 11525 => note <= "010011010100001";
when 11526 => note <= "001100111100011";
when 11527 => note <= "000110010000011";
when 11528 => note <= "000001010111001";
when 11529 => note <= "111111110011011";
when 11530 => note <= "000010001001010";
when 11531 => note <= "000111110011011";
when 11532 => note <= "001111001101111";
when 11533 => note <= "010110010000011";
when 11534 => note <= "011010110011010";
when 11535 => note <= "011011010100001";
when 11536 => note <= "010111010000110";
when 11537 => note <= "001111010000111";
when 11538 => note <= "000100111100011";
when 11539 => note <= "111010100000010";
when 11540 => note <= "110010001001010";
when 11541 => note <= "101101011111110";
when 11542 => note <= "101101001100110";
when 11543 => note <= "110000101111001";
when 11544 => note <= "110110100110001";
when 11545 => note <= "111100101011111";
when 11546 => note <= "000000111010011";
when 11547 => note <= "000001101111101";
when 11548 => note <= "111110101000111";
when 11549 => note <= "111000001100101";
when 11550 => note <= "110000000000000";
when 11551 => note <= "101000001100101";
when 11552 => note <= "100010111011010";
when 11553 => note <= "100001101111101";
when 11554 => note <= "100101001100110";
when 11555 => note <= "101100101011111";
when 11556 => note <= "110110100110001";
when 11557 => note <= "000000101111001";
when 11558 => note <= "001000111010011";
when 11559 => note <= "001101011111110";
when 11560 => note <= "001101110110110";
when 11561 => note <= "001010100000010";
when 11562 => note <= "000100111100011";
when 11563 => note <= "111111010000111";
when 11564 => note <= "111011100011001";
when 11565 => note <= "111011010100001";
when 11566 => note <= "111111000101101";
when 11567 => note <= "000110010000011";
when 11568 => note <= "001111001101111";
when 11569 => note <= "010111110011011";
when 11570 => note <= "011101110110110";
when 11571 => note <= "011111110011011";
when 11572 => note <= "011101000100110";
when 11573 => note <= "010110010000011";
when 11574 => note <= "001100111100011";
when 11575 => note <= "000011010100001";
when 11576 => note <= "111011100011001";
when 11577 => note <= "110111010000111";
when 11578 => note <= "110111000101101";
when 11579 => note <= "111010100000010";
when 11580 => note <= "000000000000000";
when 11581 => note <= "000101011111110";
when 11582 => note <= "001000111010011";
when 11583 => note <= "001000101111001";
when 11584 => note <= "000100011100111";
when 11585 => note <= "111100101011111";
when 11586 => note <= "110011000011101";
when 11587 => note <= "101001101111101";
when 11588 => note <= "100010111011010";
when 11589 => note <= "100000001100101";
when 11590 => note <= "100010001001010";
when 11591 => note <= "101000001100101";
when 11592 => note <= "110000110010001";
when 11593 => note <= "111001101111101";
when 11594 => note <= "000000111010011";
when 11595 => note <= "000100101011111";
when 11596 => note <= "000100011100111";
when 11597 => note <= "000000101111001";
when 11598 => note <= "111011000011101";
when 11599 => note <= "110101011111110";
when 11600 => note <= "110010001001010";
when 11601 => note <= "110010100000010";
when 11602 => note <= "110111000101101";
when 11603 => note <= "111111010000111";
when 11604 => note <= "001001011001111";
when 11605 => note <= "010011010100001";
when 11606 => note <= "011010110011010";
when 11607 => note <= "011110010000011";
when 11608 => note <= "011101000100110";
when 11609 => note <= "010111110011011";
when 11610 => note <= "010000000000000";
when 11611 => note <= "000111110011011";
when 11612 => note <= "000001010111001";
when 11613 => note <= "111110010000011";
when 11614 => note <= "111111000101101";
when 11615 => note <= "000011010100001";
when 11616 => note <= "001001011001111";
when 11617 => note <= "001111010000111";
when 11618 => note <= "010010110011010";
when 11619 => note <= "010010100000010";
when 11620 => note <= "001101110110110";
when 11621 => note <= "000101011111110";
when 11622 => note <= "111011000011101";
when 11623 => note <= "110000101111001";
when 11624 => note <= "101000101111010";
when 11625 => note <= "100100101011111";
when 11626 => note <= "100101001100110";
when 11627 => note <= "101001101111101";
when 11628 => note <= "110000110010001";
when 11629 => note <= "111000001100101";
when 11630 => note <= "111101110110110";
when 11631 => note <= "000000001100101";
when 11632 => note <= "111110101000111";
when 11633 => note <= "111001101111101";
when 11634 => note <= "110011000011101";
when 11635 => note <= "101100101011111";
when 11636 => note <= "101000101111010";
when 11637 => note <= "101000101111001";
when 11638 => note <= "101101001100110";
when 11639 => note <= "110101011111110";
when 11640 => note <= "000000000000000";
when 11641 => note <= "001010100000010";
when 11642 => note <= "010010110011010";
when 11643 => note <= "010111010000111";
when 11644 => note <= "010111010000110";
when 11645 => note <= "010011010100001";
when 11646 => note <= "001100111100011";
when 11647 => note <= "000110010000011";
when 11648 => note <= "000001010111001";
when 11649 => note <= "111111110011011";
when 11650 => note <= "000010001001010";
when 11651 => note <= "000111110011011";
when 11652 => note <= "001111001101111";
when 11653 => note <= "010110010000011";
when 11654 => note <= "011010110011010";
when 11655 => note <= "011011010100001";
when 11656 => note <= "010111010000110";
when 11657 => note <= "001111010000111";
when 11658 => note <= "000100111100011";
when 11659 => note <= "111010100000010";
when 11660 => note <= "110010001001010";
when 11661 => note <= "101101011111110";
when 11662 => note <= "101101001100110";
when 11663 => note <= "110000101111001";
when 11664 => note <= "110110100110001";
when 11665 => note <= "111100101011111";
when 11666 => note <= "000000111010011";
when 11667 => note <= "000001101111101";
when 11668 => note <= "111110101000111";
when 11669 => note <= "111000001100101";
when 11670 => note <= "110000000000000";
when 11671 => note <= "101000001100101";
when 11672 => note <= "100010111011010";
when 11673 => note <= "100001101111101";
when 11674 => note <= "100101001100110";
when 11675 => note <= "101100101011111";
when 11676 => note <= "110110100110001";
when 11677 => note <= "000000101111001";
when 11678 => note <= "001000111010011";
when 11679 => note <= "001101011111110";
when 11680 => note <= "001101110110110";
when 11681 => note <= "001010100000010";
when 11682 => note <= "000100111100011";
when 11683 => note <= "111111010000111";
when 11684 => note <= "111011100011001";
when 11685 => note <= "111011010100001";
when 11686 => note <= "111111000101101";
when 11687 => note <= "000110010000011";
when 11688 => note <= "001111001101111";
when 11689 => note <= "010111110011011";
when 11690 => note <= "011101110110110";
when 11691 => note <= "011111110011011";
when 11692 => note <= "011101000100110";
when 11693 => note <= "010110010000011";
when 11694 => note <= "001100111100011";
when 11695 => note <= "000011010100001";
when 11696 => note <= "111011100011001";
when 11697 => note <= "110111010000111";
when 11698 => note <= "110111000101101";
when 11699 => note <= "111010100000010";
when 11700 => note <= "000000000000000";
when 11701 => note <= "000101011111110";
when 11702 => note <= "001000111010011";
when 11703 => note <= "001000101111001";
when 11704 => note <= "000100011100111";
when 11705 => note <= "111100101011111";
when 11706 => note <= "110011000011101";
when 11707 => note <= "101001101111101";
when 11708 => note <= "100010111011010";
when 11709 => note <= "100000001100101";
when 11710 => note <= "100010001001010";
when 11711 => note <= "101000001100101";
when 11712 => note <= "110000110010001";
when 11713 => note <= "111001101111101";
when 11714 => note <= "000000111010011";
when 11715 => note <= "000100101011111";
when 11716 => note <= "000100011100111";
when 11717 => note <= "000000101111001";
when 11718 => note <= "111011000011101";
when 11719 => note <= "110101011111110";
when 11720 => note <= "110010001001010";
when 11721 => note <= "110010100000010";
when 11722 => note <= "110111000101101";
when 11723 => note <= "111111010000111";
when 11724 => note <= "001001011001111";
when 11725 => note <= "010011010100001";
when 11726 => note <= "011010110011010";
when 11727 => note <= "011110010000011";
when 11728 => note <= "011101000100110";
when 11729 => note <= "010111110011011";
when 11730 => note <= "010000000000000";
when 11731 => note <= "000111110011011";
when 11732 => note <= "000001010111001";
when 11733 => note <= "111110010000011";
when 11734 => note <= "111111000101101";
when 11735 => note <= "000011010100001";
when 11736 => note <= "001001011001111";
when 11737 => note <= "001111010000111";
when 11738 => note <= "010010110011010";
when 11739 => note <= "010010100000010";
when 11740 => note <= "001101110110110";
when 11741 => note <= "000101011111110";
when 11742 => note <= "111011000011101";
when 11743 => note <= "110000101111001";
when 11744 => note <= "101000101111010";
when 11745 => note <= "100100101011111";
when 11746 => note <= "100101001100110";
when 11747 => note <= "101001101111101";
when 11748 => note <= "110000110010001";
when 11749 => note <= "111000001100101";
when 11750 => note <= "111101110110110";
when 11751 => note <= "000000001100101";
when 11752 => note <= "111110101000111";
when 11753 => note <= "111001101111101";
when 11754 => note <= "110011000011101";
when 11755 => note <= "101100101011111";
when 11756 => note <= "101000101111010";
when 11757 => note <= "101000101111001";
when 11758 => note <= "101101001100110";
when 11759 => note <= "110101011111110";
when 11760 => note <= "000000000000000";
when 11761 => note <= "001010100000010";
when 11762 => note <= "010010110011010";
when 11763 => note <= "010111010000111";
when 11764 => note <= "010111010000110";
when 11765 => note <= "010011010100001";
when 11766 => note <= "001100111100011";
when 11767 => note <= "000110010000011";
when 11768 => note <= "000001010111001";
when 11769 => note <= "111111110011011";
when 11770 => note <= "000010001001010";
when 11771 => note <= "000111110011011";
when 11772 => note <= "001111001101111";
when 11773 => note <= "010110010000011";
when 11774 => note <= "011010110011010";
when 11775 => note <= "011011010100001";
when 11776 => note <= "010111010000110";
when 11777 => note <= "001111010000111";
when 11778 => note <= "000100111100011";
when 11779 => note <= "111010100000010";
when 11780 => note <= "110010001001010";
when 11781 => note <= "101101011111110";
when 11782 => note <= "101101001100110";
when 11783 => note <= "110000101111001";
when 11784 => note <= "110110100110001";
when 11785 => note <= "111100101011111";
when 11786 => note <= "000000111010011";
when 11787 => note <= "000001101111101";
when 11788 => note <= "111110101000111";
when 11789 => note <= "111000001100101";
when 11790 => note <= "110000000000000";
when 11791 => note <= "101000001100101";
when 11792 => note <= "100010111011010";
when 11793 => note <= "100001101111101";
when 11794 => note <= "100101001100110";
when 11795 => note <= "101100101011111";
when 11796 => note <= "110110100110001";
when 11797 => note <= "000000101111001";
when 11798 => note <= "001000111010011";
when 11799 => note <= "001101011111110";
when 11800 => note <= "001101110110110";
when 11801 => note <= "001010100000010";
when 11802 => note <= "000100111100011";
when 11803 => note <= "111111010000111";
when 11804 => note <= "111011100011001";
when 11805 => note <= "111011010100001";
when 11806 => note <= "111111000101101";
when 11807 => note <= "000110010000011";
when 11808 => note <= "001111001101111";
when 11809 => note <= "010111110011011";
when 11810 => note <= "011101110110110";
when 11811 => note <= "011111110011011";
when 11812 => note <= "011101000100110";
when 11813 => note <= "010110010000011";
when 11814 => note <= "001100111100011";
when 11815 => note <= "000011010100001";
when 11816 => note <= "111011100011001";
when 11817 => note <= "110111010000111";
when 11818 => note <= "110111000101101";
when 11819 => note <= "111010100000010";
when 11820 => note <= "000000000000000";
when 11821 => note <= "000101011111110";
when 11822 => note <= "001000111010011";
when 11823 => note <= "001000101111001";
when 11824 => note <= "000100011100111";
when 11825 => note <= "111100101011111";
when 11826 => note <= "110011000011101";
when 11827 => note <= "101001101111101";
when 11828 => note <= "100010111011010";
when 11829 => note <= "100000001100101";
when 11830 => note <= "100010001001010";
when 11831 => note <= "101000001100101";
when 11832 => note <= "110000110010001";
when 11833 => note <= "111001101111101";
when 11834 => note <= "000000111010011";
when 11835 => note <= "000100101011111";
when 11836 => note <= "000100011100111";
when 11837 => note <= "000000101111001";
when 11838 => note <= "111011000011101";
when 11839 => note <= "110101011111110";
when 11840 => note <= "110010001001010";
when 11841 => note <= "110010100000010";
when 11842 => note <= "110111000101101";
when 11843 => note <= "111111010000111";
when 11844 => note <= "001001011001111";
when 11845 => note <= "010011010100001";
when 11846 => note <= "011010110011010";
when 11847 => note <= "011110010000011";
when 11848 => note <= "011101000100110";
when 11849 => note <= "010111110011011";
when 11850 => note <= "010000000000000";
when 11851 => note <= "000111110011011";
when 11852 => note <= "000001010111001";
when 11853 => note <= "111110010000011";
when 11854 => note <= "111111000101101";
when 11855 => note <= "000011010100001";
when 11856 => note <= "001001011001111";
when 11857 => note <= "001111010000111";
when 11858 => note <= "010010110011010";
when 11859 => note <= "010010100000010";
when 11860 => note <= "001101110110110";
when 11861 => note <= "000101011111110";
when 11862 => note <= "111011000011101";
when 11863 => note <= "110000101111001";
when 11864 => note <= "101000101111010";
when 11865 => note <= "100100101011111";
when 11866 => note <= "100101001100110";
when 11867 => note <= "101001101111101";
when 11868 => note <= "110000110010001";
when 11869 => note <= "111000001100101";
when 11870 => note <= "111101110110110";
when 11871 => note <= "000000001100101";
when 11872 => note <= "111110101000111";
when 11873 => note <= "111001101111101";
when 11874 => note <= "110011000011101";
when 11875 => note <= "101100101011111";
when 11876 => note <= "101000101111010";
when 11877 => note <= "101000101111001";
when 11878 => note <= "101101001100110";
when 11879 => note <= "110101011111110";
when 11880 => note <= "000000000000000";
when 11881 => note <= "001010100000010";
when 11882 => note <= "010010110011010";
when 11883 => note <= "010111010000111";
when 11884 => note <= "010111010000110";
when 11885 => note <= "010011010100001";
when 11886 => note <= "001100111100011";
when 11887 => note <= "000110010000011";
when 11888 => note <= "000001010111001";
when 11889 => note <= "111111110011011";
when 11890 => note <= "000010001001010";
when 11891 => note <= "000111110011011";
when 11892 => note <= "001111001101111";
when 11893 => note <= "010110010000011";
when 11894 => note <= "011010110011010";
when 11895 => note <= "011011010100001";
when 11896 => note <= "010111010000110";
when 11897 => note <= "001111010000111";
when 11898 => note <= "000100111100011";
when 11899 => note <= "111010100000010";
when 11900 => note <= "110010001001010";
when 11901 => note <= "101101011111110";
when 11902 => note <= "101101001100110";
when 11903 => note <= "110000101111001";
when 11904 => note <= "110110100110001";
when 11905 => note <= "111100101011111";
when 11906 => note <= "000000111010011";
when 11907 => note <= "000001101111101";
when 11908 => note <= "111110101000111";
when 11909 => note <= "111000001100101";
when 11910 => note <= "110000000000000";
when 11911 => note <= "101000001100101";
when 11912 => note <= "100010111011010";
when 11913 => note <= "100001101111101";
when 11914 => note <= "100101001100110";
when 11915 => note <= "101100101011111";
when 11916 => note <= "110110100110001";
when 11917 => note <= "000000101111001";
when 11918 => note <= "001000111010011";
when 11919 => note <= "001101011111110";
when 11920 => note <= "001101110110110";
when 11921 => note <= "001010100000010";
when 11922 => note <= "000100111100011";
when 11923 => note <= "111111010000111";
when 11924 => note <= "111011100011001";
when 11925 => note <= "111011010100001";
when 11926 => note <= "111111000101101";
when 11927 => note <= "000110010000011";
when 11928 => note <= "001111001101111";
when 11929 => note <= "010111110011011";
when 11930 => note <= "011101110110110";
when 11931 => note <= "011111110011011";
when 11932 => note <= "011101000100110";
when 11933 => note <= "010110010000011";
when 11934 => note <= "001100111100011";
when 11935 => note <= "000011010100001";
when 11936 => note <= "111011100011001";
when 11937 => note <= "110111010000111";
when 11938 => note <= "110111000101101";
when 11939 => note <= "111010100000010";
when 11940 => note <= "000000000000000";
when 11941 => note <= "000101011111110";
when 11942 => note <= "001000111010011";
when 11943 => note <= "001000101111001";
when 11944 => note <= "000100011100111";
when 11945 => note <= "111100101011111";
when 11946 => note <= "110011000011101";
when 11947 => note <= "101001101111101";
when 11948 => note <= "100010111011010";
when 11949 => note <= "100000001100101";
when 11950 => note <= "100010001001010";
when 11951 => note <= "101000001100101";
when 11952 => note <= "110000110010001";
when 11953 => note <= "111001101111101";
when 11954 => note <= "000000111010011";
when 11955 => note <= "000100101011111";
when 11956 => note <= "000100011100111";
when 11957 => note <= "000000101111001";
when 11958 => note <= "111011000011101";
when 11959 => note <= "110101011111110";
when 11960 => note <= "110010001001010";
when 11961 => note <= "110010100000010";
when 11962 => note <= "110111000101101";
when 11963 => note <= "111111010000111";
when 11964 => note <= "001001011001111";
when 11965 => note <= "010011010100001";
when 11966 => note <= "011010110011010";
when 11967 => note <= "011110010000011";
when 11968 => note <= "011101000100110";
when 11969 => note <= "010111110011011";
when 11970 => note <= "010000000000000";
when 11971 => note <= "000111110011011";
when 11972 => note <= "000001010111001";
when 11973 => note <= "111110010000011";
when 11974 => note <= "111111000101101";
when 11975 => note <= "000011010100001";
when 11976 => note <= "001001011001111";
when 11977 => note <= "001111010000111";
when 11978 => note <= "010010110011010";
when 11979 => note <= "010010100000010";
when 11980 => note <= "001101110110110";
when 11981 => note <= "000101011111110";
when 11982 => note <= "111011000011101";
when 11983 => note <= "110000101111001";
when 11984 => note <= "101000101111010";
when 11985 => note <= "100100101011111";
when 11986 => note <= "100101001100110";
when 11987 => note <= "101001101111101";
when 11988 => note <= "110000110010001";
when 11989 => note <= "111000001100101";
when 11990 => note <= "111101110110110";
when 11991 => note <= "000000001100101";
when 11992 => note <= "111110101000111";
when 11993 => note <= "111001101111101";
when 11994 => note <= "110011000011101";
when 11995 => note <= "101100101011111";
when 11996 => note <= "101000101111010";
when 11997 => note <= "101000101111001";
when 11998 => note <= "101101001100110";
when others => note <= "110101011111110";
end case;
nv <= '1';
noteidx <= (noteidx + 1) when (signed(resize(noteidx, 15)) < (Nsmp - 1)) else to_unsigned(0, 14);
else
sample_rate_cnt <= (sample_rate_cnt + 1);
nv <= '0';
end if;
end if;
end process M_MUSICBOX_RTL;
end architecture MyHDL;
| mit | a8cf76f18dba9df47fb179629b04e0bd | 0.483067 | 5.141081 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cpu_unit/mblite/hw/core/core.vhd | 2 | 4,787 | ----------------------------------------------------------------------------------------------
--
-- Input file : core.vhd
-- Design name : core
-- Author : Tamar Kranenburg
-- Company : Delft University of Technology
-- : Faculty EEMCS, Department ME&CE
-- : Systems and Circuits group
--
-- Description : Top level entity of the integer unit
--
--
----------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library mblite;
use mblite.config_Pkg.all;
use mblite.core_Pkg.all;
entity core is generic
(
G_INTERRUPT : boolean := CFG_INTERRUPT;
G_USE_HW_MUL : boolean := CFG_USE_HW_MUL;
G_USE_BARREL : boolean := CFG_USE_BARREL;
G_DEBUG : boolean := CFG_DEBUG
);
port
(
imem_o : out imem_out_type;
dmem_o : out dmem_out_type;
imem_i : in imem_in_type;
dmem_i : in dmem_in_type;
int_i : in std_logic;
int_o : out std_logic;
rst_i : in std_logic;
clk_i : in std_logic
);
end core;
architecture arch of core is
signal fetch_i : fetch_in_type;
signal fetch_o : fetch_out_type;
signal decode_i : decode_in_type;
signal decode_o : decode_out_type;
signal gprf_o : gprf_out_type;
signal exec_i : execute_in_type;
signal exec_o : execute_out_type;
signal mem_i : mem_in_type;
signal mem_o : mem_out_type;
signal ena_i : std_logic;
-- signal fetch_ena_i : std_logic;
-- signal rest_ena_i : std_logic;
begin
-- fetch_ena_i <= dmem_i.ena_i;
-- rest_ena_i <= dmem_i.ena_i and fetch_o.inst_valid;
ena_i <= dmem_i.ena_i and imem_i.ena_i;
fetch_i.hazard <= decode_o.hazard;
fetch_i.branch <= exec_o.branch;
fetch_i.branch_target <= exec_o.alu_result(CFG_IMEM_SIZE - 1 downto 0);
fetch0 : fetch port map
(
fetch_o => fetch_o,
imem_o => imem_o,
fetch_i => fetch_i,
imem_i => imem_i,
rst_i => rst_i,
ena_i => ena_i,
clk_i => clk_i
);
decode_i.program_counter <= fetch_o.program_counter;
decode_i.instruction <= fetch_o.instruction;
decode_i.inst_valid <= fetch_o.inst_valid;
decode_i.ctrl_wrb <= mem_o.ctrl_wrb;
decode_i.ctrl_mem_wrb <= mem_o.ctrl_mem_wrb;
decode_i.mem_result <= dmem_i.dat_i;
decode_i.alu_result <= mem_o.alu_result;
decode_i.interrupt <= int_i;
decode_i.interrupt_enable <= exec_o.interrupt_enable;
decode_i.flush_id <= exec_o.flush_id;
int_o <= decode_o.int_ack;
decode0: decode generic map
(
G_INTERRUPT => G_INTERRUPT,
G_USE_HW_MUL => G_USE_HW_MUL,
G_USE_BARREL => G_USE_BARREL,
G_DEBUG => G_DEBUG
)
port map
(
decode_o => decode_o,
decode_i => decode_i,
gprf_o => gprf_o,
ena_i => ena_i,
rst_i => rst_i,
clk_i => clk_i
);
exec_i.fwd_dec <= decode_o.fwd_dec;
exec_i.fwd_dec_result <= decode_o.fwd_dec_result;
exec_i.dat_a <= gprf_o.dat_a_o;
exec_i.dat_b <= gprf_o.dat_b_o;
exec_i.dat_d <= gprf_o.dat_d_o;
exec_i.reg_a <= decode_o.reg_a;
exec_i.reg_b <= decode_o.reg_b;
exec_i.imm <= decode_o.imm;
exec_i.program_counter <= decode_o.program_counter;
exec_i.ctrl_wrb <= decode_o.ctrl_wrb;
exec_i.ctrl_mem <= decode_o.ctrl_mem;
exec_i.ctrl_ex <= decode_o.ctrl_ex;
exec_i.fwd_mem <= mem_o.ctrl_wrb;
exec_i.mem_result <= dmem_i.dat_i;
exec_i.alu_result <= mem_o.alu_result;
exec_i.ctrl_mem_wrb <= mem_o.ctrl_mem_wrb;
execute0 : execute generic map
(
G_USE_HW_MUL => G_USE_HW_MUL,
G_USE_BARREL => G_USE_BARREL
)
port map
(
exec_o => exec_o,
exec_i => exec_i,
ena_i => ena_i,
rst_i => rst_i,
clk_i => clk_i
);
mem_i.alu_result <= exec_o.alu_result;
mem_i.program_counter <= exec_o.program_counter;
mem_i.branch <= exec_o.branch;
mem_i.dat_d <= exec_o.dat_d;
mem_i.ctrl_wrb <= exec_o.ctrl_wrb;
mem_i.ctrl_mem <= exec_o.ctrl_mem;
mem_i.mem_result <= dmem_i.dat_i;
mem0 : mem port map
(
mem_o => mem_o,
dmem_o => dmem_o,
mem_i => mem_i,
ena_i => ena_i,
rst_i => rst_i,
clk_i => clk_i
);
end arch;
| gpl-3.0 | 865600d36dcd7be84aa5cee53ff4dcd3 | 0.490077 | 3.078457 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cart_slot/vhdl_source/all_carts_v4.vhd | 1 | 39,605 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.slot_bus_pkg.all;
entity all_carts_v4 is
generic (
g_kernal_base : std_logic_vector(27 downto 0) := X"0EC8000"; -- multiple of 32K
g_rom_base : std_logic_vector(27 downto 0) := X"0F00000"; -- multiple of 1M
g_georam_base : std_logic_vector(27 downto 0) := X"1000000"; -- Shared with reu
g_ram_base : std_logic_vector(27 downto 0) := X"0EF0000" ); -- multiple of 64K
port (
clock : in std_logic;
reset : in std_logic;
RST_in : in std_logic;
c64_reset : in std_logic;
kernal_enable : in std_logic;
kernal_16k : in std_logic;
kernal_area : in std_logic;
freeze_trig : in std_logic; -- goes '1' when the button has been pressed and we're waiting to enter the freezer
freeze_act : in std_logic; -- goes '1' when we need to switch in the cartridge for freeze mode
unfreeze : out std_logic; -- indicates the freeze logic to switch back to non-freeze mode.
cart_active : out std_logic; -- indicates that the cartridge is active
cart_kill : in std_logic;
cart_logic : in std_logic_vector(4 downto 0); -- 1 out of 32 logic emulations
cart_force : in std_logic;
slot_req : in t_slot_req;
slot_resp : out t_slot_resp := c_slot_resp_init;
epyx_timeout : in std_logic;
serve_enable : out std_logic; -- enables fetching bus address PHI2=1
serve_vic : out std_logic; -- enables doing so for PHI2=0
serve_rom : out std_logic; -- ROML or ROMH
serve_io1 : out std_logic; -- IO1n
serve_io2 : out std_logic; -- IO2n
allow_write : out std_logic;
mem_addr : out unsigned(25 downto 0);
irq_n : out std_logic;
nmi_n : out std_logic;
exrom_n : out std_logic;
game_n : out std_logic;
sense : in std_logic;
CART_LEDn : out std_logic;
size_ctrl : in std_logic_vector(2 downto 0) := "001" );
end all_carts_v4;
architecture gideon of all_carts_v4 is
signal reset_in : std_logic;
signal ext_bank : std_logic_vector(18 downto 16);
signal bank_bits : std_logic_vector(15 downto 13);
signal mode_bits : std_logic_vector(2 downto 0);
signal ef_write : std_logic_vector(2 downto 0);
signal ef_write_addr : std_logic_vector(21 downto 0);
signal georam_bank : std_logic_vector(15 downto 0);
-- signal rom_enable : std_logic;
signal freeze_act_d : std_logic;
signal cart_en : std_logic;
signal do_io2 : std_logic;
signal allow_bank : std_logic;
signal hold_nmi : std_logic;
signal cart_logic_d : std_logic_vector(cart_logic'range) := (others => '0');
signal mem_addr_i : std_logic_vector(27 downto 0);
constant c_none : std_logic_vector(4 downto 0) := "00000";
constant c_8k : std_logic_vector(4 downto 0) := "00001";
constant c_16k : std_logic_vector(4 downto 0) := "00010";
constant c_16k_umax : std_logic_vector(4 downto 0) := "00011";
constant c_fc3 : std_logic_vector(4 downto 0) := "00100";
constant c_ss5 : std_logic_vector(4 downto 0) := "00101";
constant c_retro : std_logic_vector(4 downto 0) := "00110";
constant c_action : std_logic_vector(4 downto 0) := "00111";
constant c_system3 : std_logic_vector(4 downto 0) := "01000";
constant c_domark : std_logic_vector(4 downto 0) := "01001";
constant c_ocean128 : std_logic_vector(4 downto 0) := "01010";
constant c_ocean256 : std_logic_vector(4 downto 0) := "01011";
constant c_easy_flash : std_logic_vector(4 downto 0) := "01100";
constant c_epyx : std_logic_vector(4 downto 0) := "01110";
constant c_kcs : std_logic_vector(4 downto 0) := "10000";
constant c_fc : std_logic_vector(4 downto 0) := "10001";
constant c_comal80 : std_logic_vector(4 downto 0) := "10010";
constant c_sbasic : std_logic_vector(4 downto 0) := "10011";
constant c_westermann : std_logic_vector(4 downto 0) := "10100";
constant c_georam : std_logic_vector(4 downto 0) := "10101";
constant c_bbasic : std_logic_vector(4 downto 0) := "10110";
constant c_pagefox : std_logic_vector(4 downto 0) := "10111";
constant c_128 : std_logic_vector(4 downto 0) := "11000";
constant c_fc3plus : std_logic_vector(4 downto 0) := "11001";
constant c_comal80pakma : std_logic_vector(4 downto 0) := "11010";
constant c_supergames : std_logic_vector(4 downto 0) := "11011";
constant c_nordic : std_logic_vector(4 downto 0) := "11100";
constant c_serve_rom_rr : std_logic_vector(0 to 7) := "11011111";
constant c_serve_io_rr : std_logic_vector(0 to 7) := "10101111";
-- alias
signal slot_addr : std_logic_vector(15 downto 0);
signal slot_rwn : std_logic;
signal io_read : std_logic;
signal io_write : std_logic;
signal io_addr : std_logic_vector(8 downto 0);
signal io_wdata : std_logic_vector(7 downto 0);
signal georam_mask : std_logic_vector(15 downto 0);
begin
with size_ctrl select georam_mask <=
"0000000111111111" when "000",
"0000001111111111" when "001",
"0000011111111111" when "010",
"0000111111111111" when "011",
"0001111111111111" when "100",
"0011111111111111" when "101",
"0111111111111111" when "110",
"1111111111111111" when others;
serve_enable <= cart_en or kernal_enable;
cart_active <= cart_en;
slot_addr <= std_logic_vector(slot_req.bus_address);
slot_rwn <= slot_req.bus_rwn;
io_write <= slot_req.io_write;
io_read <= slot_req.io_read;
io_addr <= std_logic_vector(slot_req.io_address(8 downto 0));
io_wdata <= slot_req.data;
process(clock)
begin
if rising_edge(clock) then
reset_in <= reset or RST_in or c64_reset;
freeze_act_d <= freeze_act;
unfreeze <= '0';
-- control register
if reset_in='1' then
cart_logic_d <= cart_logic; -- activate change of mode!
mode_bits <= (others => '0');
bank_bits <= (others => '0');
ext_bank <= (others => '0');
georam_bank <= (others => '0');
ef_write <= (others => '0');
ef_write_addr <= (others => '0');
allow_bank <= '0';
do_io2 <= '1';
cart_en <= '1';
-- unfreeze <= '0';
hold_nmi <= '0';
elsif freeze_act='1' and freeze_act_d='0' then
bank_bits <= (others => '0');
mode_bits <= (others => '0');
--allow_bank <= '0';
cart_en <= '1';
-- unfreeze <= '0';
hold_nmi <= '1';
elsif cart_en = '0' then
cart_logic_d <= cart_logic; -- activate change of mode!
end if;
if cart_force = '1' then
cart_logic_d <= cart_logic; -- activate change of mode!
end if;
serve_vic <= '0';
case cart_logic_d is
when c_fc3 =>
-- unfreeze <= '0';
if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' then -- DFFF
bank_bits <= io_wdata(1 downto 0) & '0';
mode_bits <= '0' & io_wdata(4) & io_wdata(5);
unfreeze <= '1';
cart_en <= not io_wdata(7);
hold_nmi <= not io_wdata(6);
end if;
if freeze_act='1' then
game_n <= '0';
exrom_n <= '1';
else
game_n <= mode_bits(0);
exrom_n <= mode_bits(1);
end if;
if mode_bits(1 downto 0)="10" then
serve_vic <= '1';
end if;
serve_rom <= '1';
serve_io1 <= '1';
serve_io2 <= '1';
irq_n <= '1';
nmi_n <= not(freeze_trig or freeze_act or hold_nmi);
when c_fc3plus =>
if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' then -- DFFF
bank_bits <= io_wdata(1 downto 0) & '0';
ext_bank <= '0' & io_wdata(3 downto 2);
mode_bits <= '0' & io_wdata(4) & io_wdata(5);
unfreeze <= '1';
cart_en <= not io_wdata(7);
hold_nmi <= not io_wdata(6);
end if;
if freeze_act='1' then
game_n <= '0';
exrom_n <= '1';
else
game_n <= mode_bits(0);
exrom_n <= mode_bits(1);
end if;
if mode_bits(1 downto 0)="10" then
serve_vic <= '1';
end if;
serve_rom <= '1';
serve_io1 <= '1';
serve_io2 <= '1';
irq_n <= '1';
nmi_n <= not(freeze_trig or freeze_act or hold_nmi);
when c_action =>
if io_write='1' and io_addr(8) = '0' and cart_en='1' then
bank_bits <= io_wdata(7) & io_wdata(4 downto 3);
mode_bits <= io_wdata(5) & io_wdata(1 downto 0);
unfreeze <= io_wdata(6);
cart_en <= not io_wdata(2);
end if;
if freeze_act='1' then
game_n <= '0';
exrom_n <= '1';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
else
game_n <= not mode_bits(0);
exrom_n <= mode_bits(1);
serve_io1 <= c_serve_io_rr(to_integer(unsigned(mode_bits)));
serve_io2 <= c_serve_io_rr(to_integer(unsigned(mode_bits))) and do_io2;
serve_rom <= c_serve_rom_rr(to_integer(unsigned(mode_bits)));
end if;
irq_n <= not(freeze_trig or freeze_act);
nmi_n <= not(freeze_trig or freeze_act);
when c_retro =>
if io_write='1' and io_addr(8 downto 1) = X"00" and cart_en='1' then -- DE00/DE01
if io_addr(0)='0' then
bank_bits <= io_wdata(7) & io_wdata(4 downto 3);
mode_bits <= io_wdata(5) & io_wdata(1 downto 0);
unfreeze <= io_wdata(6);
cart_en <= not io_wdata(2);
else
if io_wdata(6)='1' then
do_io2 <= '0';
end if;
if io_wdata(1)='1' then
allow_bank <= '1';
end if;
end if;
end if;
if freeze_act='1' then
game_n <= '0';
exrom_n <= '1';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
else
game_n <= not mode_bits(0);
exrom_n <= mode_bits(1);
serve_io1 <= c_serve_io_rr(to_integer(unsigned(mode_bits)));
serve_io2 <= c_serve_io_rr(to_integer(unsigned(mode_bits))) and do_io2;
serve_rom <= c_serve_rom_rr(to_integer(unsigned(mode_bits)));
end if;
irq_n <= not(freeze_trig or freeze_act);
nmi_n <= not(freeze_trig or freeze_act);
when c_nordic =>
if io_write='1' and io_addr(8) = '0' and cart_en='1' then
bank_bits <= io_wdata(7) & io_wdata(4 downto 3);
mode_bits <= io_wdata(5) & io_wdata(1 downto 0);
unfreeze <= io_wdata(6);
cart_en <= not io_wdata(2);
end if;
if freeze_act='1' then
game_n <= '0';
exrom_n <= '1';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
else
if mode_bits(2 downto 0)="110" then
game_n <= '0';
-- Switch to Ultimax mode for writes to address A000-BFFF (disable C64 RAM write)
exrom_n <= slot_addr(15) and not slot_addr(14) and slot_addr(13) and not slot_rwn;
else
game_n <= not mode_bits(0);
exrom_n <= mode_bits(1);
end if;
serve_io1 <= c_serve_io_rr(to_integer(unsigned(mode_bits)));
serve_io2 <= c_serve_io_rr(to_integer(unsigned(mode_bits))) and do_io2;
serve_rom <= c_serve_rom_rr(to_integer(unsigned(mode_bits)));
end if;
irq_n <= not(freeze_trig or freeze_act);
nmi_n <= not(freeze_trig or freeze_act);
when c_easy_flash =>
if io_write='1' and io_addr(8)='0' and cart_en='1' then -- DExx
if io_addr(3 downto 0)="0000" then -- DE00
ext_bank <= io_wdata(5 downto 3);
bank_bits <= io_wdata(2 downto 0);
end if;
if io_addr(3 downto 0)="0010" then -- DE02
mode_bits <= io_wdata(2 downto 0); -- LED not implemented
end if;
if io_addr(3 downto 0)="1001" then -- DE09
ef_write <= "000";
end if;
if io_addr(3 downto 0)="1000" then -- DE08
case ef_write is
when "000" =>
if io_wdata(7 downto 0) = X"65" then
ef_write <= "001";
end if;
when "001" =>
if io_wdata(7 downto 0) = X"66" then
ef_write <= "010";
else
ef_write <= "000";
end if;
when "010" =>
if io_wdata(7 downto 0) = X"77" then
ef_write <= "011";
else
ef_write <= "000";
end if;
when "011" =>
ef_write_addr(7 downto 0) <= io_wdata(7 downto 0);
ef_write <= "100";
when "100" =>
ef_write_addr(12 downto 8) <= io_wdata(4 downto 0);
ef_write_addr(19) <= io_wdata(5);
ef_write <= "101";
when "101" =>
ef_write_addr(18 downto 13) <= io_wdata(5 downto 0);
ef_write <= "110";
when others =>
ef_write <= "000";
end case;
end if;
end if;
game_n <= not (mode_bits(0) or not mode_bits(2));
exrom_n <= not mode_bits(1);
serve_rom <= '1';
serve_io1 <= '1'; -- write registers only, no reads
serve_io2 <= '1'; -- RAM
irq_n <= '1';
nmi_n <= '1';
when c_ss5 =>
if io_write='1' and io_addr(8) = '0' and cart_en='1' then -- DE00-DEFF
bank_bits <= io_wdata(4) & io_wdata(2) & '0';
mode_bits <= io_wdata(3) & io_wdata(1) & io_wdata(0);
unfreeze <= not io_wdata(0);
cart_en <= not io_wdata(3);
end if;
game_n <= mode_bits(0);
exrom_n <= not mode_bits(1);
serve_io1 <= cart_en;
serve_io2 <= '0';
serve_rom <= cart_en;
irq_n <= not(freeze_trig or freeze_act);
nmi_n <= not(freeze_trig or freeze_act);
when c_8k =>
if io_write='1' and io_addr(8 downto 0) = "111111111" then -- DFFF
if cart_en='1' and io_wdata(7 downto 6) = "01" then
cart_en <= '0'; -- permanent off
end if;
end if;
game_n <= '1';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '1'; -- for EPYX test
irq_n <= '1';
nmi_n <= '1';
when c_16k =>
if io_write='1' and io_addr(8 downto 0) = "111111111" then -- DFFF
if cart_en='1' and io_wdata(7 downto 6) = "01" then
cart_en <= '0'; -- permanent off
end if;
end if;
game_n <= '0';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_16k_umax =>
if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' and io_wdata(7 downto 6) = "01" then -- DFFF
cart_en <= '0'; -- permanent off
end if;
game_n <= '0';
exrom_n <= '1';
serve_rom <= '1';
serve_vic <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_128 =>
game_n <= '1';
exrom_n <= '1';
serve_rom <= '1';
serve_io1 <= '1';
serve_io2 <= '1';
irq_n <= '1';
nmi_n <= '1';
serve_vic <= '1';
when c_ocean128 =>
if io_write='1' and io_addr(8)='0' then -- DE00 range
bank_bits <= io_wdata(2 downto 0);
ext_bank <= io_wdata(5 downto 3);
end if;
game_n <= '1';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_domark =>
if io_write='1' and io_addr(8)='0' then -- DE00 range
bank_bits <= io_wdata(2 downto 0);
ext_bank <= '0' & io_wdata(4 downto 3);
mode_bits(0) <= io_wdata(7);
-- if io_wdata(7 downto 5) /= "000" then -- permanent off
-- cart_en <= '0';
-- end if;
cart_en <= not (io_wdata(7) or io_wdata(6) or io_wdata(5));
end if;
game_n <= '1';
exrom_n <= mode_bits(0);
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_ocean256 =>
if io_write='1' and io_addr(8)='0' then -- DE00 range
bank_bits <= io_wdata(2 downto 0);
ext_bank <= "00" & io_wdata(3);
end if;
game_n <= '0';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_system3 => -- 16K, only 8K used?
if (io_write='1' or io_read='1') and io_addr(8)='0' then -- DE00 range
bank_bits <= io_addr(2 downto 0);
ext_bank <= io_addr(5 downto 3);
end if;
game_n <= '1';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_comal80 => -- 64K, 4x16K banks
if io_write='1' and io_addr(8)='0' then -- DE00-DEFF
bank_bits <= io_wdata(1 downto 0) & '0';
end if;
game_n <= '0';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_comal80pakma =>
if io_write='1' and io_addr(8)='0' then -- DE00-DEFF
bank_bits <= io_wdata(1 downto 0) & '0';
ext_bank <= "00" & io_wdata(2);
end if;
game_n <= '0';
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_supergames =>
if io_write='1' and io_addr(8)='1' and mode_bits(1) = '0' then -- DF00-DFFF
bank_bits <= io_wdata(1 downto 0) & '0';
mode_bits(1 downto 0) <= io_wdata(3 downto 2);
end if;
if mode_bits(1 downto 0) = "11" then -- Mostly to visualize
cart_en <= '0';
end if;
game_n <= mode_bits(0);
exrom_n <= mode_bits(0);
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_sbasic => -- 16K, upper 8k enabled by writing to DExx
-- and disabled by reading
if io_write='1' and io_addr(8)='0' then
mode_bits(0) <= '1';
elsif io_read='1' and io_addr(8)='0' then
mode_bits(0) <= '0';
end if;
game_n <= not mode_bits(0);
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_westermann => -- 16K, upper 8k disabled by reading to DFxx
-- and disabled by reading
if io_read='1' and io_addr(8)='1' then
mode_bits(0) <= '1';
end if;
game_n <= mode_bits(0);
exrom_n <= '0';
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_pagefox => -- 16K, upper 8k disabled by reading to DFxx
-- and disabled by reading
if io_write='1' and io_addr(8 downto 7) = "01" then
mode_bits(0) <= io_wdata(4);
bank_bits <= io_wdata(3 downto 1);
end if;
game_n <= mode_bits(0);
exrom_n <= mode_bits(0);
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_georam =>
if io_write='1' and io_addr(8 downto 7) = "11" then
if io_addr(0) = '0' then
georam_bank(5 downto 0) <= io_wdata(5 downto 0) and georam_mask(5 downto 0);
georam_bank(15 downto 14) <= io_wdata(7 downto 6) and georam_mask(15 downto 14);
else
georam_bank(13 downto 6) <= io_wdata(7 downto 0) and georam_mask(13 downto 6);
end if;
end if;
game_n <= '1';
exrom_n <= '1';
serve_rom <= '1';
serve_io1 <= '1';
serve_io2 <= '1';
irq_n <= '1';
nmi_n <= '1';
when c_bbasic =>
if io_write='1' and io_addr(8)='0' then
mode_bits(0) <= '0';
elsif io_read='1' and io_addr(8)='0' then
mode_bits(0) <= '1';
end if;
if mode_bits(0)='1' then
game_n <= '0';
exrom_n <= '0';
elsif slot_addr(15)='1' and not(slot_addr(14 downto 13) = "10") then
game_n <= '0';
exrom_n <= '1';
else
game_n <= '1';
exrom_n <= '1';
end if;
serve_rom <= '1';
serve_io1 <= '1';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
when c_epyx =>
game_n <= '1';
exrom_n <= epyx_timeout;
serve_rom <= '1';
serve_io1 <= '0';
serve_io2 <= '1'; -- rom visible df00-dfff
irq_n <= '1';
nmi_n <= '1';
when c_kcs =>
-- M1 M0 Ga Act | M1 M0 Ex Ga | M2 M1 M0 Recoded
---------------------+--------------------------+-----------------
-- x x x Reset | 0 0 0 0 (reset:16K) | 0 0 0 16K
-- x x x Freeze | 1 1 1 0 (freeze) | 0 1 0 UmaxF
-- x x x R:DE00 | 1 0 0 1 (8K mode) | 0 0 1 8K
-- x x x R:DE02 | 1 0 1 1 (off1) | 0 1 1 Off1
-- x x x W:DE80 | 0 0 0 0 (reset:16K) | 0 0 0 16K
-- 0 x 0 W:DE0x | 0 1 1 0 (Ultimax) | 1 1 0 UmaxS
-- 0 x 1 W:DE0x | 0 1 1 1 (Off2) | 1 1 1 Off2
-- 1 1 x W:DE00 | 0 0 0 0 (reset:16K) | 0 0 0 16K
-- 1 1 x W:DE02 | 1 0 0 1 (8K mode) | 0 0 1 8K
--
-- 0 0 0 0 16K
-- 0 1 0 0 ?
-- 0 0 1 0 ?
-- 0 1 1 0 Ultimax
--
-- 0 0 0 1 ?
-- 0 1 0 1 ?
-- 0 0 1 1 ?
-- 0 1 1 1 Off2
-- mode_bit(0) -> ULTIMAX
-- mode_bit(1) -> 16K Mode
-- io1 read
if io_read='1' and io_addr(8) = '0' then -- DE00-DEFF
mode_bits(0) <= '1'; -- When read and addr bit 1=0 : 8k GAME mode
mode_bits(1) <= io_addr(1); -- When read and addr bit 1=1 : Cartridge disabled mode
mode_bits(2) <= '0';
end if;
-- io1 write
if io_write='1' and io_addr(8 downto 7) = "01" then -- DE80-DEFF
mode_bits <= "000"; -- 16K mode
end if;
if io_write='1' and io_addr(8 downto 7) = "00" then -- DE00-DE7F
-- if in 16K 000 / UmaxS 110 / Off2 111
if mode_bits = "000" then -- 16K
mode_bits <= "110";
elsif mode_bits = "010" or mode_bits = "111" then -- Freeze of Off2
mode_bits <= "000"; -- When addr bit 1=0 : 16k GAME mode
mode_bits(0) <= io_addr(1); -- When addr bit 1=1 : 8k GAME mode
end if;
end if;
-- io2 read
if io_read='1' and io_addr(8 downto 7) = "11" then -- DF80-DFFF
unfreeze <= '1'; -- When read : release freeze
end if;
-- on freeze
if freeze_act='1' then
mode_bits <= "010";
end if;
game_n <= mode_bits(0);
exrom_n <= mode_bits(1);
serve_io1 <= '1';
serve_io2 <= '1';
serve_rom <= '1';
serve_vic <= mode_bits(1);
nmi_n <= not(freeze_trig or freeze_act);
when c_fc =>
-- io1 access
if io_read='1' and io_addr(8) = '0' then -- DE00-DEFF
game_n <= '1'; -- Cartridge disabled mode
exrom_n <= '1';
unfreeze <= '1';
end if;
if io_write='1' and io_addr(8) = '0' then -- DE00-DEFF
game_n <= '1'; -- Cartridge disabled mode
exrom_n <= '1';
unfreeze <= '1';
end if;
-- io2 access
if io_read='1' and io_addr(8) = '1' then -- DF00-DFFF
game_n <= '0'; -- 16K GAME mode
exrom_n <= '0';
unfreeze <= '1';
end if;
if io_write='1' and io_addr(8) = '1' then -- DF00-DFFF
game_n <= '0'; -- 16K GAME mode
exrom_n <= '0';
unfreeze <= '1';
end if;
-- on freeze
if freeze_trig='1' then
game_n <= '0'; -- ULTIMAX mode
exrom_n <= '1';
end if;
-- on reset/init
if reset_in='1' then
game_n <= '0'; -- 16K GAME mode
exrom_n <= '0';
unfreeze <= '1';
end if;
serve_io1 <= '1';
serve_io2 <= '1';
serve_rom <= '1';
nmi_n <= not(freeze_trig or freeze_act);
when others =>
game_n <= '1';
exrom_n <= '1';
serve_rom <= '0';
serve_io1 <= '0';
serve_io2 <= '0';
irq_n <= '1';
nmi_n <= '1';
end case;
if cart_kill='1' then
cart_en <= '0';
hold_nmi <= '0';
end if;
end if;
end process;
CART_LEDn <= not cart_en;
-- determine address
process(cart_logic_d, slot_addr, mode_bits, bank_bits, ext_bank, do_io2, allow_bank,
kernal_area, kernal_16k, georam_bank, sense, ef_write, ef_write_addr)
begin
mem_addr_i <= g_rom_base;
-- defaults
-- 64K, 8K banks, no writes
mem_addr_i(15 downto 0) <= bank_bits(15 downto 13) & slot_addr(12 downto 0);
allow_write <= '0';
case cart_logic_d is
when c_retro =>
-- 64K RAM
if mode_bits(2)='1' then
if slot_addr(13)='0' then
mem_addr_i <= g_ram_base(27 downto 16) & bank_bits(15 downto 13) & slot_addr(12 downto 0);
if allow_bank='0' and slot_addr(15 downto 13)="110" then -- io range exceptions
mem_addr_i <= g_ram_base(27 downto 16) & "000" & slot_addr(12 downto 0);
end if;
end if;
if slot_addr(15 downto 13)="100" then--and mode_bits(1 downto 0)/="10" then
allow_write <= '1';
end if;
if slot_addr(15 downto 8)=X"DE" and slot_addr(7 downto 1)/="0000000" then
allow_write <= '1';
end if;
if slot_addr(15 downto 8)=X"DF" and do_io2='1' then
allow_write <= '1';
end if;
end if;
when c_action =>
-- 8K RAM
if mode_bits(2)='1' then
if slot_addr(13)='0' then
mem_addr_i <= g_ram_base(27 downto 15) & "00" & slot_addr(12 downto 0);
end if;
if slot_addr(15 downto 13)="100" then -- and mode_bits(1 downto 0)="11" then
allow_write <= '1';
end if;
if slot_addr(15 downto 8)=X"DF" and do_io2='1' then
allow_write <= '1';
end if;
end if;
when c_nordic =>
-- 8K RAM
if mode_bits(2)='1' then
if slot_addr(13)='0' then
mem_addr_i <= g_ram_base(27 downto 15) & "00" & slot_addr(12 downto 0);
end if;
if slot_addr(15 downto 13)="100" then -- and mode_bits(1 downto 0)="11" then
allow_write <= '1';
end if;
if slot_addr(15 downto 8)=X"DF" and do_io2='1' then
allow_write <= '1';
end if;
end if;
if mode_bits(2 downto 0) ="110" then
if slot_addr(15 downto 13)="100" then
mem_addr_i <= g_rom_base(27 downto 15) & bank_bits(14 downto 13) & slot_addr(12 downto 0);
allow_write <= '0';
end if;
if slot_addr(15 downto 13)="101" then
mem_addr_i <= g_ram_base(27 downto 15) & "00" & slot_addr(12 downto 0);
allow_write <= '1';
end if;
if slot_addr(15 downto 8)=X"DF" and do_io2='1' then
mem_addr_i <= g_ram_base(27 downto 15) & "00" & slot_addr(12 downto 0);
end if;
end if;
when c_easy_flash =>
-- Little RAM
if slot_addr(15 downto 8)=X"DF" then
mem_addr_i <= g_ram_base(27 downto 8) & slot_addr(7 downto 0);
allow_write <= '1';
else
if slot_addr(15 downto 0)=X"DE07" and ef_write = "110" then
mem_addr_i <= g_rom_base(27 downto 20) & ef_write_addr(19 downto 0);
allow_write <= '1';
else
mem_addr_i <= g_rom_base(27 downto 20) & slot_addr(13) & ext_bank & bank_bits & slot_addr(12 downto 0);
end if;
end if;
when c_fc3 | c_comal80 | c_fc3plus | c_comal80pakma | c_supergames =>
mem_addr_i(17 downto 0) <= ext_bank(17 downto 16) & bank_bits(15 downto 14) & slot_addr(13 downto 0); -- 16K banks
when c_ss5 =>
if mode_bits(1 downto 0)="00" then
if slot_addr(15 downto 13)="100" then
allow_write <= '1';
mem_addr_i <= g_ram_base(27 downto 15) & bank_bits(15 downto 14) & slot_addr(12 downto 0);
else
mem_addr_i <= g_rom_base(27 downto 16) & bank_bits(15 downto 14) & slot_addr(13 downto 0);
end if;
else
mem_addr_i <= g_rom_base(27 downto 16) & bank_bits(15 downto 14) & slot_addr(13 downto 0);
end if;
when c_8k | c_epyx =>
mem_addr_i(27 downto 13) <= g_rom_base(27 downto 13);
mem_addr_i(12 downto 0) <= slot_addr(12 downto 0);
when c_16k | c_16k_umax =>
mem_addr_i(27 downto 14) <= g_rom_base(27 downto 14);
mem_addr_i(13 downto 0) <= slot_addr(13 downto 0);
when c_128 =>
mem_addr_i(27 downto 15) <= g_rom_base(27 downto 15);
mem_addr_i(14 downto 0) <= slot_addr(14 downto 0);
when c_ocean128 | c_system3 | c_domark | c_ocean256 =>
mem_addr_i <= g_rom_base(27 downto 20) & slot_addr(13) & ext_bank & bank_bits & slot_addr(12 downto 0);
-- when c_ocean256 =>
-- mem_addr_i(18 downto 0) <= ext_bank & bank_bits & slot_addr(12 downto 0);
-- mem_addr_i(19) <= slot_addr(13); -- map banks 16-31 to $A000. (second 128K)
when c_kcs =>
-- io2 ram access
if slot_addr(15 downto 8) = X"DF" then
mem_addr_i <= g_ram_base(27 downto 7) & slot_addr(6 downto 0);
allow_write <= '1';
else
-- rom access
mem_addr_i <= g_rom_base(27 downto 14) & slot_addr(13 downto 0);
end if;
when c_fc | c_westermann =>
-- rom access
mem_addr_i <= g_rom_base(27 downto 14) & slot_addr(13 downto 0);
when c_sbasic =>
-- rom access
mem_addr_i <= g_rom_base(27 downto 13) & slot_addr(12 downto 0);
mem_addr_i(19) <= slot_addr(13);
when c_bbasic =>
-- rom access
if slot_addr(15 downto 13)="100" then
mem_addr_i <= g_rom_base(27 downto 15) & "00" & slot_addr(12 downto 0);
elsif slot_addr(15 downto 13)="101" then
mem_addr_i <= g_rom_base(27 downto 15) & "01" & slot_addr(12 downto 0);
elsif slot_addr(15 downto 13)="111" then
mem_addr_i <= g_rom_base(27 downto 15) & "10" & slot_addr(12 downto 0);
end if;
when c_georam =>
if slot_addr(15 downto 8)=X"DE" then
mem_addr_i <= g_georam_base(27 downto 24) & georam_bank(15 downto 0) & slot_addr(7 downto 0);
allow_write <= '1';
end if;
when c_pagefox =>
if bank_bits(15) = '0' then
mem_addr_i <= g_rom_base(27 downto 16) & bank_bits(14) & bank_bits(13) & slot_addr(13 downto 0);
elsif bank_bits(14) = '0' then
mem_addr_i <= g_ram_base(27 downto 15) & bank_bits(13) & slot_addr(13 downto 0);
if slot_addr(15 downto 14)="10" then
allow_write <= '1';
end if;
end if;
when others =>
null;
end case;
if kernal_area='1' then
if kernal_16k='0' then
mem_addr_i <= g_kernal_base(27 downto 14) & slot_addr(12 downto 0) & '0';
else
mem_addr_i <= g_rom_base(27 downto 15) & (not sense) & slot_addr(12 downto 0) & '0';
end if;
end if;
end process;
mem_addr <= unsigned(mem_addr_i(mem_addr'range));
slot_resp.data(7) <= bank_bits(15);
slot_resp.data(6) <= '1';
slot_resp.data(5) <= '0';
slot_resp.data(4) <= bank_bits(14);
slot_resp.data(3) <= bank_bits(13);
slot_resp.data(2) <= '0'; -- freeze button pressed
slot_resp.data(1) <= allow_bank; -- '1'; -- allow bank bit stuck at '1' for 1541U
slot_resp.data(0) <= '0';
slot_resp.reg_output <= '1' when (slot_addr(8 downto 1)="00000000") and (cart_logic_d = c_retro) else '0';
end gideon;
| gpl-3.0 | efc838ff7f88685b2fa4600cacef9a21 | 0.405252 | 3.629158 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_source/floppy_param_mem.vhd | 1 | 3,154 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2006, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Floppy Parameter memory
-------------------------------------------------------------------------------
-- File : floppy.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: This module implements the emulator of the floppy drive.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library unisim;
use unisim.vcomponents.all;
library work;
use work.endianness_pkg.all;
use work.io_bus_pkg.all;
entity floppy_param_mem is
generic (
g_big_endian : boolean );
port (
clock : in std_logic;
reset : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
track : in unsigned(6 downto 0);
side : in std_logic := '0';
bit_time : out unsigned(9 downto 0);
track_start : out std_logic_vector(25 downto 0);
max_offset : out std_logic_vector(13 downto 0) );
end floppy_param_mem;
architecture gideon of floppy_param_mem is
signal toggle : std_logic;
signal param_addr : std_logic_vector(8 downto 0);
signal param_data : std_logic_vector(31 downto 0);
signal ram_data : std_logic_vector(31 downto 0);
signal cpu_ram_en : std_logic;
signal cpu_ram_en_d : std_logic;
signal cpu_rdata : std_logic_vector(7 downto 0);
begin
cpu_ram_en <= io_req.read or io_req.write;
cpu_ram_en_d <= cpu_ram_en when rising_edge(clock);
io_resp.ack <= cpu_ram_en_d;
io_resp.data <= cpu_rdata when cpu_ram_en_d = '1' else X"00";
ram: RAMB16_S9_S36
port map (
CLKA => clock,
SSRA => reset,
ENA => cpu_ram_en,
WEA => io_req.write,
ADDRA => std_logic_vector(io_req.address(10 downto 0)),
DIA => io_req.data,
DIPA => "0",
DOA => cpu_rdata,
DOPA => open,
CLKB => clock,
SSRB => reset,
ENB => '1',
WEB => '0',
ADDRB => param_addr,
DIB => X"00000000",
DIPB => X"0",
DOB => ram_data,
DOPB => open );
param_addr <= side & std_logic_vector(track) & toggle;
param_data <= byte_swap(ram_data, g_big_endian);
process(clock)
begin
if rising_edge(clock) then
if toggle='1' then -- even addresses (one clock later)
track_start <= param_data(track_start'range);
else
max_offset <= param_data(max_offset'range);
bit_time <= unsigned(param_data(bit_time'high+16 downto 16));
end if;
if reset='1' then
toggle <= '0';
else
toggle <= not toggle;
end if;
end if;
end process;
end gideon;
| gpl-3.0 | ef915655a5c1604ec0bf8f2bbac2bcc7 | 0.478123 | 3.688889 | false | false | false | false |
markusC64/1541ultimate2 | fpga/devices/vhdl_sim/amd_flash_tb.vhd | 1 | 4,544 | --------------------------------------------------------------------------------
-- Entity: amd_flash_tb
-- Date:2018-08-14
-- Author: gideon
--
-- Description: Testbench for EEPROM
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
use work.io_bus_bfm_pkg.all;
use work.tl_string_util_pkg.all;
entity amd_flash_tb is
end entity;
architecture test of amd_flash_tb is
signal clock : std_logic := '0';
signal reset : std_logic;
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal io_irq : std_logic;
signal allow_write : std_logic;
signal address : unsigned(19 downto 0) := (others => '0');
signal wdata : std_logic_vector(7 downto 0) := X"00";
signal write : std_logic := '0';
signal read : std_logic := '0';
signal rdata : std_logic_vector(7 downto 0);
signal rdata_valid : std_logic;
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_mut: entity work.amd_flash
port map (
clock => clock,
reset => reset,
io_req => io_req,
io_resp => io_resp,
io_irq => io_irq,
allow_write => allow_write,
address => address(18 downto 0),
wdata => wdata,
write => write,
read => read,
rdata => rdata,
rdata_valid => rdata_valid
);
i_bfm: entity work.io_bus_bfm
generic map(
g_name => "io"
)
port map(
clock => clock,
req => io_req,
resp => io_resp
);
p_test: process
procedure wr(ad : unsigned(19 downto 0); data: std_logic_vector(7 downto 0)) is
begin
wait until clock = '1';
address <= ad;
wdata <= data;
wait for 100 ns;
wait until clock = '1';
write <= '1';
wait until clock = '1';
write <= '0';
end procedure;
procedure rd(ad : unsigned(19 downto 0); data: out std_logic_vector(7 downto 0)) is
begin
wait until clock = '1';
address <= ad;
wdata <= X"FF";
wait for 100 ns;
wait until clock = '1';
data := rdata;
read <= '1';
wait until clock = '1';
read <= '0';
end procedure;
variable d : std_logic_vector(7 downto 0);
variable io : p_io_bus_bfm_object;
begin
wait until reset = '0';
wait for 1 us;
bind_io_bus_bfm("io", io);
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"05555", X"90");
rd(X"00000", d);
report "Read: " & hstr(d);
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"05555", X"90");
rd(X"00001", d);
report "Read: " & hstr(d);
io_read(io, X"00000", d);
assert d = X"00" report "Expected no erase" severity error;
io_read(io, X"00001", d);
assert d = X"00" report "Expected no dirty" severity error;
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"05555", X"A0");
wr(X"01234", X"55");
io_read(io, X"00000", d);
assert d = X"00" report "Expected no erase" severity error;
io_read(io, X"00001", d);
assert d = X"01" report "Expected dirty" severity error;
wait for 50 ns;
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"05555", X"80");
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"10000", X"30");
io_read(io, X"00000", d);
assert d = X"02" report "Expected single erase" severity error;
wait for 50 ns;
rd(X"00000", d);
rd(X"00000", d);
rd(X"00000", d);
rd(X"00000", d);
io_write(io, X"00000", X"00");
io_read(io, X"00000", d);
assert d = X"00" report "Expected no erase" severity error;
rd(X"00000", d);
rd(X"00000", d);
wait for 50 ns;
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"05555", X"80");
wr(X"05555", X"AA");
wr(X"02AAA", X"55");
wr(X"05555", X"10");
io_read(io, X"00000", d);
assert d = X"FF" report "Expected full erase" severity error;
wait;
end process;
end architecture;
| gpl-3.0 | 5d2611334fde45f2d038267ccf4f45dc | 0.466109 | 3.432024 | false | false | false | false |
nussbrot/AdvPT | tpl/wb_reg_no_rst_notify.tpl.vhd | 2 | 7,030 | -------------------------------------------------------------------------------
-- COPYRIGHT (c) SOLECTRIX GmbH, Germany, %TPL_YEAR% All rights reserved
--
-- The copyright to the document(s) herein is the property of SOLECTRIX GmbH
-- The document(s) may be used and/or copied only with the written permission
-- from SOLECTRIX GmbH or in accordance with the terms/conditions stipulated
-- in the agreement/contract under which the document(s) have been supplied
-------------------------------------------------------------------------------
-- Project : %TPL_PROJECT%
-- File : %TPL_VHDLFILE%
-- Created : %TPL_DATE%
-- Standard : VHDL'93/02
-------------------------------------------------------------------------------
--*
--* @short Wishbone register module
--* Auto-generated by '%TPL_SCRIPT%' based on '%TPL_TPLFILE%'
--*
--* Needed Libraries and Packages:
--* @li ieee.std_logic_1164 standard multi-value logic package
--* @li ieee.numeric_std
--*
--* @author %TPL_USER%
--* @date 30.06.2016
--* @internal
--/
-------------------------------------------------------------------------------
-- Modification history :
-- Date Author & Description
-- %TPL_DATE% %TPL_USER%: Created
-------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
%TPL_LIBRARY%
-------------------------------------------------------------------------------
ENTITY %TPL_MODULE% IS
GENERIC (
g_addr_bits : INTEGER := %TPL_WBSIZE%);
PORT (
-- Wishbone interface
clk : IN STD_LOGIC;
i_wb_cyc : IN STD_LOGIC;
i_wb_stb : IN STD_LOGIC;
i_wb_we : IN STD_LOGIC;
i_wb_sel : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
i_wb_addr : IN STD_LOGIC_VECTOR(g_addr_bits-1 DOWNTO 0);
i_wb_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
o_wb_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
o_wb_ack : OUT STD_LOGIC;
o_wb_rty : OUT STD_LOGIC;
o_wb_err : OUT STD_LOGIC;
-- Custom ports
%TPL_PORTS%
);
END ENTITY %TPL_MODULE%;
-------------------------------------------------------------------------------
ARCHITECTURE rtl OF %TPL_MODULE% IS
-----------------------------------------------------------------------------
-- Procedures
-----------------------------------------------------------------------------
%TPL_PROCEDURES%
-----------------------------------------------------------------------------
-- Constants
-----------------------------------------------------------------------------
%TPL_CONSTANTS%
-----------------------------------------------------------------------------
-- WB interface signals
-----------------------------------------------------------------------------
SIGNAL s_wb_ack : STD_LOGIC;
SIGNAL s_wb_err : STD_LOGIC;
SIGNAL s_wb_addr : UNSIGNED(i_wb_addr'HIGH DOWNTO 0);
SIGNAL s_int_addr : UNSIGNED(i_wb_addr'HIGH DOWNTO 0);
SIGNAL s_int_data : STD_LOGIC_VECTOR(i_wb_data'RANGE);
SIGNAL s_int_we : STD_LOGIC_VECTOR(i_wb_sel'RANGE);
SIGNAL s_int_trd : STD_LOGIC;
SIGNAL s_int_twr : STD_LOGIC;
SIGNAL s_int_addr_valid : STD_LOGIC;
SIGNAL s_int_data_rb : STD_LOGIC_VECTOR(i_wb_data'RANGE);
SIGNAL s_wb_data : STD_LOGIC_VECTOR(o_wb_data'RANGE);
TYPE t_wb_state IS (e_idle, e_delay, e_ack);
SIGNAL s_wb_state : t_wb_state := e_idle;
-----------------------------------------------------------------------------
-- Custom registers
-----------------------------------------------------------------------------
%TPL_REGISTER_SIGNALS%
BEGIN -- ARCHITECTURE rtl
-----------------------------------------------------------------------------
--* purpose : Wishbone Bus Control
--* type : sequential, rising edge, no reset
wb_ctrl : PROCESS (clk)
BEGIN
IF rising_edge(clk) THEN
s_wb_ack <= '0';
s_wb_err <= '0';
s_int_data <= i_wb_data;
s_int_addr <= s_wb_addr;
s_int_we <= (OTHERS => '0');
s_int_trd <= '0';
s_int_twr <= '0';
CASE s_wb_state IS
WHEN e_idle =>
-- check if anyone requests access
IF (i_wb_cyc = '1' AND i_wb_stb = '1') THEN
-- ack is delayed because we need 3 cycles
IF (i_wb_we = '1') THEN
s_wb_ack <= s_int_addr_valid;
s_wb_err <= NOT s_int_addr_valid;
s_wb_state <= e_ack;
s_int_we <= i_wb_sel;
s_int_twr <= '1';
ELSE
IF c_has_read_notifies THEN
s_wb_state <= e_delay;
s_int_trd <= '1';
ELSE
s_wb_ack <= s_int_addr_valid;
s_wb_err <= NOT s_int_addr_valid;
s_wb_state <= e_ack;
END IF;
END IF;
END IF;
WHEN e_delay =>
s_wb_ack <= s_int_addr_valid;
s_wb_err <= NOT s_int_addr_valid;
s_wb_state <= e_ack;
WHEN e_ack =>
s_wb_state <= e_idle;
END CASE;
s_wb_data <= s_int_data_rb;
END IF;
END PROCESS wb_ctrl;
s_wb_addr <= UNSIGNED(i_wb_addr);
o_wb_data <= s_wb_data;
o_wb_ack <= s_wb_ack;
o_wb_err <= s_wb_err;
o_wb_rty <= '0';
-----------------------------------------------------------------------------
-- WB address validation
WITH to_integer(s_wb_addr) SELECT
s_int_addr_valid <=
%TPL_ADDR_VALIDATION%
'0' WHEN OTHERS;
-----------------------------------------------------------------------------
--* purpose : register access
--* type : sequential, rising edge, high active synchronous reset
reg_access : PROCESS (clk)
BEGIN -- PROCESS reg_access
IF rising_edge(clk) THEN
-- default values / clear trigger signals
%TPL_REG_DEFAULT%
-- WRITE registers
CASE to_integer(s_int_addr) IS
%TPL_SIG_WR%
WHEN OTHERS => NULL;
END CASE;
END IF;
END PROCESS reg_access;
-----------------------------------------------------------------------------
p_comb_read_mux : PROCESS(s_wb_addr, %TPL_SENS_LIST%)
%TPL_VAR_DEC%
-- helper to ease template generation
PROCEDURE set(
l_input : STD_LOGIC_VECTOR(31 DOWNTO 0);
l_mask : STD_LOGIC_VECTOR(31 DOWNTO 0)) IS
BEGIN
s_int_data_rb <= l_input AND l_mask;
END PROCEDURE;
BEGIN
-- READ registers assignments
%TPL_VAR_RD%
-- WB output data multiplexer
CASE to_integer(s_wb_addr) IS
%TPL_CASE_OUT%
WHEN OTHERS => set((OTHERS => '0'), (OTHERS => '1'));
END CASE;
END PROCESS p_comb_read_mux;
-----------------------------------------------------------------------------
-- output mappings
%TPL_PORT_SIG_OUT%
END ARCHITECTURE rtl;
| mit | 8ff044e669cad9875afe4e71e74cecae | 0.423755 | 4.063584 | false | false | false | false |
xiadz/oscilloscope | src/single_debouncer.vhd | 1 | 1,068 | ----------------------------------------------------------------------------------
-- Author: Osowski Marcin
-- Create Date: 15:03:57 05/24/2011
----------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity single_debouncer is
generic (
n : natural := 5000
);
port (
nrst : in std_logic;
clk : in std_logic;
input : in std_logic;
output : out std_logic
);
end single_debouncer;
architecture behavioral of single_debouncer is
signal counter: natural range 0 to n := 0;
signal output2: std_logic := '0';
begin
output <= output2;
process (clk, nrst) is
begin
if nrst = '0' then
counter <= 0;
output2 <= '0';
elsif rising_edge (clk) then
if counter >= n then
if output2 /= input then
output2 <= input;
counter <= 0;
end if;
else
counter <= counter + 1;
end if;
end if;
end process;
end behavioral;
| mit | 67157e237656ee92aa476db1e39b9b01 | 0.476592 | 4.238095 | false | false | false | false |
armandas/Plong | vga_sync.vhd | 1 | 3,384 | library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity vga is
port(
clk, not_reset: in std_logic;
hsync, vsync: out std_logic;
video_on: out std_logic;
pixel_x, pixel_y: out std_logic_vector (9 downto 0)
);
end vga;
architecture sync of vga is
-- VGA 640x480 sync parameters
constant HD: integer := 640; -- horizontal display area
constant HF: integer := 16; -- h. front porch
constant HB: integer := 48; -- h. back porch
constant HR: integer := 96; -- h. retrace
constant VD: integer := 480; -- vertical display area
constant VF: integer := 11; -- v. front porch
constant VB: integer := 31; -- v. back porch
constant VR: integer := 2; -- v. retrace
-- mod-2 counter
signal mod2, mod2_next: std_logic;
-- sync counters
signal v_count, v_count_next: std_logic_vector(9 downto 0);
signal h_count, h_count_next: std_logic_vector(9 downto 0);
-- output buffer
signal v_sync, h_sync: std_logic;
signal v_sync_next, h_sync_next: std_logic;
-- status signal
signal h_end, v_end, pixel_tick: std_logic;
begin
process(clk, not_reset)
begin
if not_reset = '0' then
mod2 <= '0';
v_count <= (others => '0');
h_count <= (others => '0');
v_sync <= '0';
h_sync <= '0';
elsif clk'event and clk = '0' then
mod2 <= mod2_next;
v_count <= v_count_next;
h_count <= h_count_next;
v_sync <= v_sync_next;
h_sync <= h_sync_next;
end if;
end process;
-- mod-2 circuit to generate 25 MHz enable tick
mod2_next <= not mod2;
-- 25 MHz pixel tick
pixel_tick <= '1' when mod2 = '1' else '0';
-- end of counters (799 and 524 pixels)
h_end <= '1' when h_count = (HD + HF + HB + HR - 1) else '0';
v_end <= '1' when v_count = (VD + VF + VB + VR - 1) else '0';
-- mod-800 horizontal sync counter
process(h_count, h_end, pixel_tick)
begin
if pixel_tick = '1' then
if h_end = '1' then
h_count_next <= (others => '0');
else
h_count_next <= h_count + 1;
end if;
else
h_count_next <= h_count;
end if;
end process;
-- mod-524 vertical sync counter
process(v_count, h_end, v_end, pixel_tick)
begin
if pixel_tick = '1' and h_end = '1' then
if v_end = '1' then
v_count_next <= (others => '0');
else
v_count_next <= v_count + 1;
end if;
else
v_count_next <= v_count;
end if;
end process;
-- horizontal and vertical sync, buffered to avoid glitch
h_sync_next <= '1' when (h_count >= (HD + HF)) and
(h_count <= (HD + HF + HR - 1)) else
'0';
v_sync_next <= '1' when (v_count >= (VD + VF)) and
(v_count <= (VD + VF + VR - 1)) else
'0';
-- video on/off
video_on <= '1' when (h_count < HD) and (v_count < VD) else '0';
-- output signal
hsync <= h_sync;
vsync <= v_sync;
pixel_x <= h_count;
pixel_y <= v_count;
end sync;
| bsd-2-clause | 645841fb465665448f216c6e2501d1a0 | 0.495272 | 3.453061 | false | false | false | false |
markusC64/1541ultimate2 | fpga/sid6581/vhdl_source/sid_mapper.vhd | 1 | 6,218 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2011 Gideon's Logic Architectures'
--
-------------------------------------------------------------------------------
--
-- Author: Gideon Zweijtzer (gideon.zweijtzer (at) gmail.com)
--
-- Note that this file is copyrighted, and is not supposed to be used in other
-- projects without written permission from the author.
--
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.slot_bus_pkg.all;
use work.sid_io_regs_pkg.all;
entity sid_mapper is
port (
clock : in std_logic;
reset : in std_logic;
slot_req : in t_slot_req;
slot_resp : out t_slot_resp;
control : in t_sid_control;
sid_addr : out unsigned(7 downto 0);
sid_wren : out std_logic;
sid_wdata : out std_logic_vector(7 downto 0);
sid_rdata : in std_logic_vector(7 downto 0) );
end sid_mapper;
architecture mapping of sid_mapper is
signal sid_wren_l : std_logic;
signal sid_wren_r : std_logic;
signal sid_wren_d : std_logic;
signal sid_addr_l : unsigned(7 downto 0);
signal sid_addr_r : unsigned(7 downto 0);
signal sid_addr_d : unsigned(7 downto 0);
signal sid_wdata_l : std_logic_vector(7 downto 0);
signal sid_wdata_d : std_logic_vector(7 downto 0);
begin
slot_resp.data <= sid_rdata;
sid_wren <= sid_wren_l or sid_wren_d;
sid_addr <= sid_addr_d when sid_wren_d='1' else sid_addr_l;
sid_wdata <= sid_wdata_l; -- should work, but it's not neat!
process(clock)
begin
if rising_edge(clock) then
sid_wren_l <= '0';
sid_wren_r <= '0';
sid_wren_d <= sid_wren_r;
sid_addr_d <= sid_addr_r;
sid_wdata_l <= slot_req.data;
sid_wdata_d <= sid_wdata_l;
if slot_req.io_write='1' then
sid_addr_l <= slot_req.io_address(7 downto 0);
sid_addr_r <= slot_req.io_address(7 downto 0);
else
sid_addr_l <= slot_req.bus_address(7 downto 0);
sid_addr_r <= slot_req.bus_address(7 downto 0);
end if;
-- check for left channel access
if control.enable_left='1' then
if slot_req.bus_write='1' then
if control.snoop_left='1' and slot_req.bus_address(15 downto 12)=X"D" then
if control.extend_left='1' then
if slot_req.bus_address(11 downto 7)=control.base_left(11 downto 7) then
sid_addr_l(7) <= '0';
sid_wren_l <= '1';
end if;
else -- just 3 voices
if slot_req.bus_address(11 downto 5)=control.base_left(11 downto 5) then
sid_wren_l <= '1';
sid_addr_l(7 downto 5) <= "000"; -- truncated address
end if;
end if;
end if;
elsif slot_req.io_write='1' then
if control.snoop_left='0' then
if control.extend_left='1' and slot_req.io_address(8 downto 7)=control.base_left(8 downto 7) then
sid_addr_l(7) <= '0';
sid_wren_l <= '1';
elsif control.extend_left='0' and slot_req.io_address(8 downto 5)=control.base_left(8 downto 5) then
sid_addr_l(7 downto 5) <= "000";
sid_wren_l <= '1';
end if;
end if;
end if;
end if;
-- check for right channel access
if control.enable_right='1' then
if slot_req.bus_write='1' then
if control.snoop_right='1' and slot_req.bus_address(15 downto 12)=X"D" then
if control.extend_right='1' then
if slot_req.bus_address(11 downto 7)=control.base_right(11 downto 7) then
sid_addr_r(7) <= '1';
sid_wren_r <= '1';
end if;
else -- just 3 voices
if slot_req.bus_address(11 downto 5)=control.base_right(11 downto 5) then
sid_wren_r <= '1';
sid_addr_r(7 downto 5) <= "100"; -- truncated address
end if;
end if;
end if;
elsif slot_req.io_write='1' then
if control.snoop_right='0' then
if control.extend_right='1' and slot_req.io_address(8 downto 7)=control.base_right(8 downto 7) then
sid_addr_r(7) <= '1';
sid_wren_r <= '1';
elsif control.extend_right='0' and slot_req.io_address(8 downto 5)=control.base_right(8 downto 5) then
sid_addr_r(7 downto 5) <= "100";
sid_wren_r <= '1';
end if;
end if;
end if;
end if;
end if;
end process;
slot_resp.nmi <= '0';
slot_resp.irq <= '0';
slot_resp.reg_output <= '0';
end mapping;
-- Mapping options are as follows:
-- STD $D400-$D41F: Snoop='1' Base=$40. Extend='0' (bit 11...5 are significant)
-- STD $D500-$D51F: Snoop='1' Base=$50. Extend='0'
-- STD $DE00-$DE1F: Snoop='0' Base=$E0. Extend='0' (bit 8...5 are significant)
-- STD $DF00-$DF1F: Snoop='0' Base=$F0. Extend='0'
-- EXT $DF80-$DFFF: Snoop='0' Base=$F8. Extend='1' (bit 8...7 are significant)
-- EXT $D600-$D67F: Snoop='1' Base=$60. Extend='1' (bit 11..7 are significant)
-- .. etc
| gpl-3.0 | 60c32452a0cb347b2f701364f016ec3f | 0.456095 | 3.847772 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/audio/vhdl_sim/generic_mixer_tb.vhd | 1 | 2,935 | --------------------------------------------------------------------------------
-- Entity: generic_mixer_tb
-- Date:2018-08-02
-- Author: gideon
--
-- Description: Testbench for generic mixer
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.audio_type_pkg.all;
use work.io_bus_pkg.all;
use work.io_bus_bfm_pkg.all;
entity generic_mixer_tb is
end entity;
architecture tb of generic_mixer_tb is
signal clock : std_logic := '0';
signal reset : std_logic;
signal start : std_logic;
signal sys_clock : std_logic;
signal req : t_io_req;
signal resp : t_io_resp;
signal inputs : t_audio_array(0 to 7);
signal out_L : t_audio;
signal out_R : t_audio;
type t_byte_array is array(natural range <>) of std_logic_vector(7 downto 0);
constant c_gains : t_byte_array(0 to 15) := ( X"80", X"00",
X"00", X"80",
X"80", X"00",
X"00", X"80",
X"80", X"00",
X"00", X"80",
X"01", X"00",
X"00", X"80" );
begin
inputs <= ( 0 => to_signed(-5, 18),
1 => to_signed(6, 18),
2 => to_signed(-7, 18),
3 => to_signed(8, 18),
4 => to_signed(-9, 18),
5 => "011111111111111111",
6 => "100000000000000000",
7 => to_signed(12, 18) );
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_mut: entity work.generic_mixer
generic map(
g_num_sources => inputs'length
)
port map(
clock => clock,
reset => reset,
start => start,
sys_clock => clock,
req => req,
resp => resp,
inputs => inputs,
out_L => out_L,
out_R => out_R
);
i_bfm: entity work.io_bus_bfm
generic map (
g_name => "io_bus"
)
port map(
clock => clock,
req => req,
resp => resp
);
p_test: process
variable io : p_io_bus_bfm_object;
begin
start <= '0';
wait for 1 ns;
bind_io_bus_bfm("io_bus", io);
wait until reset = '0';
for i in 0 to 15 loop
io_write(io, to_unsigned(i, 20), c_gains(i));
end loop;
wait until clock = '1';
start <= '1';
wait until clock = '1';
start <= '0';
wait;
end process;
end architecture;
| gpl-3.0 | 456930421fe558c7d34fa6de63886d80 | 0.39523 | 4.031593 | false | false | false | false |
markusC64/1541ultimate2 | target/simulation/vhdl_sim/mb_model_tb.vhd | 2 | 2,882 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.tl_string_util_pkg.all;
library std;
use std.textio.all;
entity mb_model_tb is
end entity;
architecture test of mb_model_tb is
signal clock : std_logic := '0';
signal reset : std_logic;
signal io_addr : unsigned(31 downto 0);
signal io_write : std_logic;
signal io_read : std_logic;
signal io_byte_en : std_logic_vector(3 downto 0);
signal io_wdata : std_logic_vector(31 downto 0);
signal io_rdata : std_logic_vector(31 downto 0) := (others => 'Z');
signal io_ack : std_logic := '0';
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
model: entity work.mb_model
port map (
clock => clock,
reset => reset,
io_addr => io_addr,
io_byte_en=> io_byte_en,
io_write => io_write,
io_read => io_read,
io_wdata => io_wdata,
io_rdata => io_rdata,
io_ack => io_ack );
-- memory and IO
process(clock)
variable s : line;
variable char : character;
variable byte : std_logic_vector(7 downto 0);
begin
if rising_edge(clock) then
io_ack <= '0';
if io_write = '1' then
io_ack <= '1';
case io_addr(19 downto 0) is
when X"00000" => -- interrupt
null;
when X"00010" => -- UART_DATA
byte := io_wdata(31 downto 24);
char := character'val(to_integer(unsigned(byte)));
if byte = X"0D" then
-- Ignore character 13
elsif byte = X"0A" then
-- Writeline on character 10 (newline)
writeline(output, s);
else
-- Write to buffer
write(s, char);
end if;
when others =>
report "I/O write to " & hstr(io_addr) & " dropped";
end case;
elsif io_read = '1' then
io_ack <= '1';
case io_addr(19 downto 0) is
when X"0000C" => -- Capabilities
io_rdata <= X"00000002";
when X"00012" => -- UART_FLAGS
io_rdata <= X"40404040";
when X"2000A" => -- 1541_A memmap
io_rdata <= X"3F3F3F3F";
when X"2000B" => -- 1541_A audiomap
io_rdata <= X"3E3E3E3E";
when others =>
report "I/O read to " & hstr(io_addr) & " dropped";
io_rdata <= X"00000000";
end case;
end if;
end if;
end process;
end architecture;
| gpl-3.0 | c9b2a9e7841da2503edc420924e22460 | 0.459403 | 3.873656 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_source/cia_registers.vhd | 1 | 30,333 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.cia_pkg.all;
-- synthesis translate_off
use work.tl_string_util_pkg.all;
-- synthesis translate_on
entity cia_registers is
generic (
g_unit_name : string := "6526";
g_report : boolean := false );
port (
clock : in std_logic;
falling : in std_logic;
reset : in std_logic;
addr : in unsigned(3 downto 0);
wen : in std_logic;
ren : in std_logic;
data_in : in std_logic_vector(7 downto 0);
data_out : out std_logic_vector(7 downto 0);
turbo_en : in std_logic := '0';
wait_state : out std_logic;
-- PLD interface
pld_inhibit : in std_logic := '0';
pld_write : out std_logic;
pld_wdata : out std_logic_vector(7 downto 0);
pld_waddr : out std_logic;
pld_state : out std_logic_vector(15 downto 0);
-- pio --
port_a_o : out std_logic_vector(7 downto 0);
port_a_t : out std_logic_vector(7 downto 0);
port_a_i : in std_logic_vector(7 downto 0);
port_b_o : out std_logic_vector(7 downto 0);
port_b_t : out std_logic_vector(7 downto 0);
port_b_i : in std_logic_vector(7 downto 0);
-- serial pin
sp_o : out std_logic;
sp_i : in std_logic;
sp_t : out std_logic;
cnt_i : in std_logic;
cnt_o : out std_logic;
cnt_t : out std_logic;
tod_pin : in std_logic;
pc_o : out std_logic;
flag_i : in std_logic;
irq : out std_logic );
end cia_registers;
architecture Gideon of cia_registers is
signal pio_i : pio_t := pio_default;
signal timer_a_i : timer_t := timer_default;
signal timer_b_i : timer_t := timer_default;
signal tod_i : tod_t;
signal tod_copy : time_t;
signal tod_latch : std_logic;
signal tod_stop : std_logic;
signal tod_tick : std_logic;
signal irq_mask : std_logic_vector(4 downto 0);
signal irq_mask_r : std_logic_vector(4 downto 0);
signal irq_flags_r : std_logic_vector(4 downto 0);
signal irq_flags : std_logic_vector(4 downto 0);
signal irq_events : std_logic_vector(4 downto 0);
signal irq_out : std_logic;
signal irq_bit : std_logic;
signal irq_ack : std_logic;
signal irq_ack_d : std_logic := '0';
signal timer_a_reg : std_logic_vector(15 downto 0);
signal timer_a_in : std_logic_vector(15 downto 0);
signal timer_b_reg : std_logic_vector(15 downto 0);
signal timer_b_in : std_logic_vector(15 downto 0);
alias timer_a_evnt : std_logic is irq_events(0);
alias timer_b_evnt : std_logic is irq_events(1);
alias alarm_event : std_logic is irq_events(2);
alias serial_event : std_logic is irq_events(3);
alias flag_event : std_logic is irq_events(4);
signal timer_a_count : std_logic_vector(15 downto 0);
signal timer_b_count : std_logic_vector(15 downto 0);
signal timer_a_out : std_logic;
signal timer_b_out : std_logic;
signal timer_a_stop : std_logic;
signal timer_b_stop : std_logic;
signal timer_a_set_t : std_logic;
signal timer_b_set_t : std_logic;
signal cnt_out : std_logic;
signal sp_out : std_logic;
signal sr_buffer : std_logic_vector(7 downto 0);
signal spmode : std_logic;
signal flag_c : std_logic;
signal flag_d1 : std_logic;
signal flag_d2 : std_logic;
signal flag_d3 : std_logic;
signal ICR : std_logic_vector(7 downto 0);
signal cycle : natural := 0;
signal icr_modify : std_logic := '0';
signal pld_write_i : std_logic;
signal pld_wdata_i : std_logic_vector(7 downto 0);
signal pld_waddr_i : std_logic;
begin
irq <= irq_out;
process(clock)
variable v_data_out : std_logic_vector(7 downto 0);
variable flag_event_pre : std_logic := '0';
begin
if rising_edge(clock) then
if tod_latch='1' then
tod_copy <= tod_i.tod;
end if;
-- synthesis translate_off
if falling = '1' then
cycle <= cycle + 1;
end if;
-- synthesis translate_on
-- Interrupt logic
if falling = '1' then
-- by default ICR is not being modified
icr_modify <= '0';
-- keeping the mask register
irq_mask_r <= irq_mask;
-- keeping the flags in a register
irq_flags_r <= irq_flags;
if irq_ack = '1' then
irq_flags_r <= (others => '0');
end if;
if irq_ack_d = '1' then
irq_flags_r(1) <= '0'; -- Timer B fix
end if;
-- the actual IRQ output
if irq_ack = '1' then
irq_out <= '0';
elsif (irq_flags and irq_mask) /= "00000" then
irq_out <= '1';
end if;
irq_ack_d <= irq_ack;
-- the IRQ bit (MSB of ICR)
if (irq_flags and irq_mask) /= "00000" then
irq_bit <= '1';
elsif irq_ack = '1' or irq_ack_d = '1' then
irq_bit <= '0';
end if;
end if;
-- Time Of Day
if tod_tick='1' and falling='1' then
do_tod_tick(tod_i.tod);
end if;
-- PC output --
if falling='1' then
pc_o <= '1';
timer_a_i.load <= '0';
timer_b_i.load <= '0';
timer_a_reg <= timer_a_in;
timer_b_reg <= timer_b_in;
end if;
if timer_a_stop = '1' then timer_a_i.run <= '0'; end if;
if timer_b_stop = '1' then timer_b_i.run <= '0'; end if;
-- Writes --
if falling = '1' then
wait_state <= '0';
end if;
if wen='1' and falling = '1' then
-- synthesis translate_off
assert not g_report
report "Writing |" & g_unit_name & "| Reg |" & hstr(addr) & "| in cycle |" & integer'image(cycle) & "| to |" & hstr(data_in)
severity note;
-- synthesis translate_on
case addr is
when X"0" => -- PRA
pio_i.pra <= data_in;
when X"1" => -- PRB
pio_i.prb <= data_in;
pc_o <= '0';
when X"2" => -- DDRA
pio_i.ddra <= data_in;
when X"3" => -- DDRB
pio_i.ddrb <= data_in;
when X"4" => -- TA LO
when X"5" => -- TA HI
if timer_a_i.run = '0' then
timer_a_i.load <= '1';
end if;
when X"6" => -- TB LO
when X"7" => -- TB HI
if timer_b_i.run = '0' then
timer_b_i.load <= '1';
end if;
when X"8" => -- TOD 10ths
if tod_i.alarm_set='1' then
tod_i.alarm.tenths <= unsigned(data_in(3 downto 0));
else
tod_i.tod.tenths <= unsigned(data_in(3 downto 0));
tod_stop <= '0';
end if;
when X"9" => -- TOD SEC
if tod_i.alarm_set='1' then
tod_i.alarm.sech <= unsigned(data_in(6 downto 4));
tod_i.alarm.secl <= unsigned(data_in(3 downto 0));
else
tod_i.tod.sech <= unsigned(data_in(6 downto 4));
tod_i.tod.secl <= unsigned(data_in(3 downto 0));
end if;
when X"A" => -- TOD MIN
if tod_i.alarm_set='1' then
tod_i.alarm.minh <= unsigned(data_in(6 downto 4));
tod_i.alarm.minl <= unsigned(data_in(3 downto 0));
else
tod_i.tod.minh <= unsigned(data_in(6 downto 4));
tod_i.tod.minl <= unsigned(data_in(3 downto 0));
end if;
when X"B" => -- TOD HR
if tod_i.alarm_set='1' then
tod_i.alarm.pm <= data_in(7);
tod_i.alarm.hr <= unsigned(data_in(4 downto 0));
else
tod_stop <= '1';
-- What an idiocracy!
if data_in(4 downto 0) = "10010" then
tod_i.tod.pm <= not data_in(7);
else
tod_i.tod.pm <= data_in(7);
end if;
tod_i.tod.hr <= unsigned(data_in(4 downto 0));
end if;
when X"C" => -- SDR
when X"D" => -- ICR
if data_in(7)='0' then -- clear immediately
irq_mask_r <= irq_mask and not data_in(4 downto 0);
elsif data_in(7)='1' then -- set
irq_mask_r <= irq_mask or data_in(4 downto 0);
end if;
icr_modify <= '1';
when X"E" => -- CRA
timer_a_i.run <= data_in(0); -- '1' = run, one-shot underrun clears this bit
timer_a_i.pbon <= data_in(1); -- '1' forces ouput to PB6
timer_a_i.outmode <= data_in(2); -- '1' = toggle, '0' = pulse
timer_a_i.runmode <= data_in(3); -- '1' = one shot, '0' = cont
timer_a_i.load <= data_in(4); -- pulse
timer_a_i.inmode <= '0' & data_in(5); -- '1' = CNT(r), '0' = PHI2
spmode <= data_in(6); -- '1' = output
tod_i.freq_sel <= data_in(7); -- '1' = 50 Hz
wait_state <= turbo_en;
when X"F" => -- CRB
timer_b_i.run <= data_in(0); -- '1' = run, one-shot underrun clears this bit
timer_b_i.pbon <= data_in(1); -- '1' forces ouput to PB6
timer_b_i.outmode <= data_in(2); -- '1' = toggle, '0' = pulse
timer_b_i.runmode <= data_in(3); -- '1' = one shot, '0' = cont
timer_b_i.load <= data_in(4); -- pulse
timer_b_i.inmode <= data_in(6 downto 5); -- '01' = CNT(r), '00' = PHI2
-- '10' = timer_a underflow, '11' = underflow with CNT=high
tod_i.alarm_set <= data_in(7); -- '1' = alarm set, '0' = time set
wait_state <= turbo_en;
when others =>
null;
end case;
end if;
-- Reads --
v_data_out := X"FF";
case addr is
when X"0" => -- PRA
v_data_out := port_a_i;
when X"1" => -- PRB
v_data_out := port_b_i;
if ren='1' and falling='1' then
pc_o <= '0';
end if;
when X"2" => -- DDRA
v_data_out := pio_i.ddra;
when X"3" => -- DDRB
v_data_out := pio_i.ddrb;
when X"4" => -- TA LO
v_data_out := timer_a_count(7 downto 0);
when X"5" => -- TA HI
v_data_out := timer_a_count(15 downto 8);
when X"6" => -- TB LO
v_data_out := timer_b_count(7 downto 0);
when X"7" => -- TB HI
v_data_out := timer_b_count(15 downto 8);
when X"8" => -- TOD 10ths
v_data_out := X"0" & std_logic_vector(tod_copy.tenths);
if ren='1' and falling='1' then
tod_latch <= '1';
end if;
when X"9" => -- TOD SEC
v_data_out := '0' & std_logic_vector(tod_copy.sech & tod_copy.secl);
when X"A" => -- TOD MIN
v_data_out := '0' & std_logic_vector(tod_copy.minh & tod_copy.minl);
when X"B" => -- TOD HR
v_data_out := tod_copy.pm & "00" & std_logic_vector(tod_copy.hr);
if ren='1' and falling = '1' then
tod_latch <= '0';
end if;
when X"C" => -- SDR
v_data_out := sr_buffer;
when X"D" => -- ICR
v_data_out := irq_bit & "00" & (irq_flags or irq_events);
when X"E" => -- CRA
v_data_out(0) := timer_a_i.run; -- '1' = run, one-shot underrun clears this bit
v_data_out(1) := timer_a_i.pbon ; -- '1' forces ouput to PB6
v_data_out(2) := timer_a_i.outmode; -- '1' = toggle, '0' = pulse
v_data_out(3) := timer_a_i.runmode; -- '1' = one shot, '0' = cont
v_data_out(4) := '0';
v_data_out(5) := timer_a_i.inmode(0); -- '1' = CNT(r), '0' = PHI2
v_data_out(6) := spmode; -- '1' = output
v_data_out(7) := tod_i.freq_sel ; -- '1' = 50 Hz
when X"F" => -- CRB
v_data_out(0) := timer_b_i.run; -- '1' = run, one-shot underrun clears this bit
v_data_out(1) := timer_b_i.pbon ; -- '1' forces ouput to PB7
v_data_out(2) := timer_b_i.outmode; -- '1' = toggle, '0' = pulse
v_data_out(3) := timer_b_i.runmode; -- '1' = one shot, '0' = cont
v_data_out(4) := '0';
v_data_out(6 downto 5) := timer_b_i.inmode ; -- '01' = CNT(r), '00' = PHI2
-- '10' = timer_a underflow, '11' = underflow with CNT=high
v_data_out(7) := tod_i.alarm_set ; -- '1' = alarm set, '0' = time set
when others =>
null;
end case;
data_out <= v_data_out;
-- synthesis translate_off
assert not (g_report and falling = '1' and ren = '1')
report "Reading |" & g_unit_name & "| Reg |" & hstr(addr) & "| in cycle |" & integer'image(cycle) & "| val|" & hstr(v_data_out)
severity note;
-- synthesis translate_on
flag_c <= flag_i; -- synchronization flop
flag_d1 <= flag_c; -- flop 2; output is stable
flag_d2 <= flag_d1; -- flop 3: for edge detection
flag_d3 <= flag_d2; -- flop 4: for filtering
if flag_d3 = '1' and flag_d2 = '0' and flag_d1 = '0' then -- falling edge, minimum of two clock cycles low
flag_event_pre := '1';
end if;
if falling = '1' then
flag_event <= flag_event_pre;
flag_event_pre := '0';
end if;
if reset='1' then
flag_c <= '1'; -- resets avoid shift register
flag_d1 <= '1'; -- resets avoid shift register
flag_d2 <= '1'; -- resets avoid shift register
flag_d3 <= '1'; -- resets avoid shift register
spmode <= '0';
pc_o <= '1';
tod_latch <= '1';
tod_stop <= '1';
pio_i <= pio_default;
tod_i <= tod_default;
timer_a_i <= timer_default;
timer_b_i <= timer_default;
irq_ack_d <= '0';
irq_mask_r <= (others => '0');
irq_flags_r <= (others => '0');
irq_out <= '0';
irq_bit <= '0';
flag_event <= '0';
timer_a_reg <= (others => '1');
timer_b_reg <= (others => '1');
wait_state <= '0';
end if;
end if;
end process;
-- PLD data output
--process(wen, falling, addr, data_in, pio_i)
process(clock)
begin
if rising_edge(clock) then
pld_write_i <= '0';
pld_wdata_i <= (others => '1');
pld_waddr_i <= '0';
if wen='1' and falling = '1' then
case addr is
when X"0" => -- PRA
pld_write_i <= '1';
pld_wdata_i <= data_in or not pio_i.ddra;
pld_waddr_i <= '0'; -- Port A
when X"1" => -- PRB
pld_write_i <= '1';
pld_wdata_i <= data_in or not pio_i.ddrb;
pld_waddr_i <= '1'; -- Port B
when X"2" => -- DDRA
pld_write_i <= '1';
pld_wdata_i <= pio_i.pra or not data_in;
pld_waddr_i <= '0'; -- Port A
when X"3" => -- DDRB
pld_write_i <= '1';
pld_wdata_i <= pio_i.prb or not data_in;
pld_waddr_i <= '1'; -- Port B
when others =>
null;
end case;
end if;
if reset = '1' then
pld_state <= X"FFFF";
elsif pld_write_i = '1' then
if pld_waddr_i = '0' then
pld_state(7 downto 0) <= pld_wdata_i;
else
pld_state(15 downto 8) <= pld_wdata_i;
end if;
end if;
end if;
end process;
pld_write <= pld_write_i and not pld_inhibit;
pld_wdata <= pld_wdata_i;
pld_waddr <= pld_waddr_i;
-- write through of ta
process(addr, wen, data_in, timer_a_reg)
begin
timer_a_in <= timer_a_reg;
if addr = X"4" and wen = '1' then
timer_a_in(7 downto 0) <= data_in;
end if;
if addr = X"5" and wen = '1' then
timer_a_in(15 downto 8) <= data_in;
end if;
end process;
-- write through of tb
process(addr, wen, data_in, timer_b_reg)
begin
timer_b_in <= timer_b_reg;
if addr = X"6" and wen = '1' then
timer_b_in(7 downto 0) <= data_in;
end if;
if addr = X"7" and wen = '1' then
timer_b_in(15 downto 8) <= data_in;
end if;
end process;
-- write through of irq_mask, if and only if icr_modify is true
process(addr, wen, data_in, irq_mask_r, icr_modify)
begin
irq_mask <= irq_mask_r;
if addr = X"D" and wen = '1' and icr_modify = '1' then
if data_in(7)='0' then -- clear immediately
irq_mask <= irq_mask_r and not data_in(4 downto 0);
elsif data_in(7)='1' then -- set
irq_mask <= irq_mask_r or data_in(4 downto 0);
end if;
end if;
end process;
irq_ack <= '1' when addr = X"D" and ren = '1' else '0';
irq_flags <= irq_flags_r or irq_events;
ICR <= irq_bit & "00" & irq_flags;
-- combinatoric signal that indicates that the timer is about to start. Needed to set toggle to '1'.
timer_a_set_t <= '1' when (addr = X"E" and data_in(0) = '1' and wen = '1' and timer_a_i.run = '0') else '0';
timer_b_set_t <= '1' when (addr = X"F" and data_in(0) = '1' and wen = '1' and timer_b_i.run = '0') else '0';
-- Implement tod pin synchronization, edge detect and programmable prescaler
-- In addition, implement alarm compare logic with edge detect for event generation
b_tod: block
signal tod_c, tod_d : std_logic := '0';
signal tod_pre : unsigned(2 downto 0);
signal alarm_equal : boolean;
signal alarm_equal_d: boolean;
begin
-- alarm --
alarm_equal <= (tod_i.alarm = tod_i.tod);
--alarm_event <= '1' when alarm_equal else '0';
p_tod: process(clock)
begin
if rising_edge(clock) then
if falling = '1' then
tod_c <= tod_pin;
tod_d <= tod_c;
tod_tick <= '0';
if tod_stop = '0' then
if tod_c = '1' and tod_d = '0' then
-- if (tod_pre = "100" and tod_i.freq_sel='1') or
-- (tod_pre = "101" and tod_i.freq_sel='0') then
-- tod_pre <= "000";
-- tod_tick <= '1';
-- else
-- tod_pre <= tod_pre + 1;
-- end if;
if tod_pre = "000" then
tod_tick <='1';
tod_pre <= "10" & not tod_i.freq_sel;
else
tod_pre <= tod_pre - 1;
end if;
end if;
else
tod_pre <= "10" & not tod_i.freq_sel;
-- tod_pre <= "000";
end if;
-- alarm --
alarm_equal_d <= alarm_equal;
alarm_event <= '0';
if alarm_equal and not alarm_equal_d then
alarm_event <= '1';
end if;
end if;
if reset='1' then
tod_pre <= "000";
tod_tick <= '0';
alarm_event <= '0';
end if;
end if;
end process;
end block;
-- PIO Out select --
port_a_o <= pio_i.pra;
port_b_o(5 downto 0) <= pio_i.prb(5 downto 0);
port_b_o(6) <= pio_i.prb(6) when timer_a_i.pbon='0' else timer_a_out;
port_b_o(7) <= pio_i.prb(7) when timer_b_i.pbon='0' else timer_b_out;
port_a_t <= pio_i.ddra;
port_b_t(5 downto 0) <= pio_i.ddrb(5 downto 0);
port_b_t(6) <= pio_i.ddrb(6) or timer_a_i.pbon;
port_b_t(7) <= pio_i.ddrb(7) or timer_b_i.pbon;
-- Timer A
tmr_a: entity work.cia_timer
port map (
clock => clock,
reset => reset,
prescale_en => falling,
timer_ctrl => timer_a_i,
timer_set_t => timer_a_set_t,
timer_in => timer_a_in,
cnt => cnt_i,
othr_tmr_ev => '0',
timer_out => timer_a_out,
timer_stop => timer_a_stop,
timer_event => timer_a_evnt,
timer_count => timer_a_count );
-- Timer B
tmr_b: entity work.cia_timer
port map (
clock => clock,
reset => reset,
prescale_en => falling,
timer_ctrl => timer_b_i,
timer_set_t => timer_b_set_t,
timer_in => timer_b_in,
cnt => cnt_i,
othr_tmr_ev => timer_a_evnt,
timer_out => timer_b_out,
timer_stop => timer_b_stop,
timer_event => timer_b_evnt,
timer_count => timer_b_count );
ser: block
signal bit_cnt : integer range 0 to 7;
signal sr_shift : std_logic_vector(7 downto 0);
signal transmitting : std_logic := '0';
signal cnt_d1, cnt_d2, cnt_c : std_logic;
signal spmode_d : std_logic;
signal sr_dav : std_logic;
signal timer_a_evnt_d1 : std_logic := '0';
signal timer_a_evnt_d2 : std_logic := '0';
signal transmit_event : std_logic := '0';
signal transmit_event_d1: std_logic := '0';
signal receive_event : std_logic := '0';
signal receive_event_d1 : std_logic := '0';
begin
process(clock)
begin
if rising_edge(clock) then
if falling = '1' then
cnt_c <= cnt_i;
cnt_d1 <= cnt_c;
cnt_d2 <= cnt_d1;
spmode_d <= spmode;
receive_event <= '0';
transmit_event <= '0';
timer_a_evnt_d1 <= timer_a_evnt and transmitting;
timer_a_evnt_d2 <= timer_a_evnt_d1;
if spmode = '1' then -- output
if timer_a_evnt_d2='1' then
cnt_out <= not cnt_out;
if cnt_out='1' then -- was '1' -> falling edge
sp_out <= sr_shift(7);
sr_shift <= sr_shift(6 downto 0) & '0';
if bit_cnt = 0 then
transmit_event <= '1';
end if;
else
if bit_cnt=0 then
if sr_dav='1' then
sr_dav <= '0';
bit_cnt <= 7;
sr_shift <= sr_buffer;
transmitting <= '1';
else
transmitting <= '0';
end if;
else
bit_cnt <= bit_cnt - 1;
end if;
end if;
elsif sr_dav = '1' and transmitting = '0' then
sr_dav <= '0';
bit_cnt <= 7;
sr_shift <= sr_buffer;
transmitting <= '1';
end if;
else -- input mode
cnt_out <= '1';
if cnt_d2='0' and cnt_d1='1' then
sr_shift <= sr_shift(6 downto 0) & sp_i;
if bit_cnt = 0 then
bit_cnt <= 7;
receive_event <= '1';
else
bit_cnt <= bit_cnt - 1;
end if;
end if;
end if;
if wen='1' and addr=X"C" then
sr_dav <= '1';
sr_buffer <= data_in;
elsif receive_event = '1' then
sr_buffer <= sr_shift;
-- elsif wen='1' and addr=X"E" then
-- if transmitting='1' and data_in(6)='0' and spmode='1' then -- switching to input while transmitting
-- sr_buffer <= not sr_shift; -- ?
-- end if;
end if;
-- when switching to read mode, we assume there are 8 bits coming
if spmode='0' and spmode_d='1' then
sr_dav <= '0';
bit_cnt <= 7;
transmitting <= '0';
end if;
transmit_event_d1 <= transmit_event;
--transmit_event_d2 <= transmit_event_d1;
receive_event_d1 <= receive_event;
--receive_event_d2 <= receive_event_d1;
end if;
if reset='1' then
cnt_out <= '1';
sp_out <= '0';
bit_cnt <= 7;
transmitting <= '0';
sr_dav <= '0';
sr_shift <= (others => '0');
sr_buffer <= (others => '0');
transmit_event <= '0';
transmit_event_d1 <= '0';
receive_event <= '0';
receive_event_d1 <= '0';
end if;
end if;
end process;
serial_event <= receive_event_d1 or transmit_event_d1 or
'0';
-- (spmode and not spmode_d and not sr_dav) or -- when switching to output, and there is no data in the buffer
-- (not spmode and spmode_d and transmitting); -- when switching to input, and we are still in the transmit state
end block ser;
-- open drain
cnt_o <= '0';
sp_o <= '0';
cnt_t <= spmode and not cnt_out;
sp_t <= spmode and not sp_out;
end Gideon;
| gpl-3.0 | 199dc0ef19cc80d0a0309ba425f73693 | 0.390268 | 3.854257 | false | false | false | false |
mkreider/cocotb2 | tests/designs/viterbi_decoder_axi4s/src/dec_viterbi.vhd | 2 | 12,298 | --!
--! Copyright (C) 2011 - 2014 Creonic GmbH
--!
--! This file is part of the Creonic Viterbi Decoder, which is distributed
--! under the terms of the GNU General Public License version 2.
--!
--! @file
--! @brief Viterbi decoder top entity, connecting all decoder units.
--! @author Markus Fehrenz
--! @date 2011/12/05
--!
--! @details
--! The AXI std_logic_vector input is mapped to an internal information type.
--! Further the correct output order is handled.
--!
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library dec_viterbi;
use dec_viterbi.pkg_param.all;
use dec_viterbi.pkg_param_derived.all;
use dec_viterbi.pkg_types.all;
use dec_viterbi.pkg_components.all;
use dec_viterbi.pkg_trellis.all;
entity dec_viterbi is
port(
--
-- The core only uses AXI4-Stream interfaces,
-- based on AMBA4 AXI4-Stream Protocol with restrictions according to
-- Xilinx Migration, described in Xilinx AXI Reference UG761 (v13.3).
--
aclk : in std_logic;
-- Synchronous reset, active low.
aresetn : in std_logic;
--
-- Slave (input) data signals
-- Delivers the parity LLR values, one byte per LLR value.
--
s_axis_input_tvalid : in std_logic;
s_axis_input_tdata : in std_logic_vector(31 downto 0);
s_axis_input_tlast : in std_logic;
s_axis_input_tready : out std_logic;
--
-- Master (output) data signals
-- Delivers the decoded systematic (payload) bits.
--
m_axis_output_tvalid : out std_logic;
m_axis_output_tdata : out std_logic;
m_axis_output_tlast : out std_logic;
m_axis_output_tready : in std_logic;
--
-- Slave (input) configuration signals
-- Configures window length and acquisition length.
--
s_axis_ctrl_tvalid : in std_logic;
s_axis_ctrl_tdata : in std_logic_vector(31 downto 0);
s_axis_ctrl_tlast : in std_logic;
s_axis_ctrl_tready : out std_logic
);
end entity dec_viterbi;
architecture rtl of dec_viterbi is
alias clk is aclk;
signal rst : std_logic;
-- split tdata into input array
signal input : t_input_block;
-- buffer signals
signal buffer_tdata : std_logic_vector(31 downto 0);
signal buffer_tvalid : std_logic;
signal buffer_tlast : std_logic;
-- branch signals
signal branch_tvalid : std_logic_vector(NUMBER_BRANCH_UNITS - 1 downto 0);
signal branch_tdata : t_branch;
signal branch_tlast : std_logic_vector(NUMBER_BRANCH_UNITS - 1 downto 0);
signal branch_tready : std_logic_vector(NUMBER_BRANCH_UNITS - 1 downto 0);
-- acs signals
signal acs_tvalid : std_logic_vector(NUMBER_TRELLIS_STATES - 1 downto 0);
signal acs_tlast : std_logic_vector(NUMBER_TRELLIS_STATES - 1 downto 0);
signal acs_tready : std_logic_vector(NUMBER_TRELLIS_STATES - 1 downto 0);
signal acs_dec_tdata : std_logic_vector(NUMBER_TRELLIS_STATES - 1 downto 0);
signal acs_prob_tdata : t_node;
-- ram signals
signal ram_tready : std_logic;
signal ram_tvalid, ram_tlast, ram_window_tuser, ram_last_tuser : std_logic_vector(1 downto 0);
signal ram_tdata : t_ram_rd_data;
-- traceback signals
signal traceback_tvalid, traceback_tdata : std_logic_vector(1 downto 0);
signal traceback_tready, traceback_tlast : std_logic_vector(1 downto 0);
signal traceback_last_tuser : std_logic_vector(1 downto 0);
-- reorder signals
signal reorder_tready, reorder_tvalid : std_logic_vector(1 downto 0);
signal reorder_tdata, reorder_tlast : std_logic_vector(1 downto 0);
signal reorder_last_tuser : std_logic_vector(1 downto 0);
-- output signals
signal output_tready : std_logic_vector(1 downto 0);
signal current_active : integer range 1 downto 0;
begin
--
-- There is always one byte of data for each LLR value, even though each
-- LLR value is represented with BW_LLR_INPUT bits. Hence, only
-- BW_LLR_INPUT bits are extracted from the byte.
--
gen_input_assignment: for i in NUMBER_PARITY_BITS - 1 downto 0 generate
begin
input(i) <= signed(buffer_tdata(8 * i + BW_LLR_INPUT - 1 downto 8 * i));
end generate gen_input_assignment;
rst <= not aresetn;
------------------------------
--- Portmapping components ---
------------------------------
-------------------------------------
-- AXI4S input buffer
--------------------------------------
inst_axi4s_buffer: axi4s_buffer
generic map(
DATA_WIDTH => 32
)
port map(
clk => clk,
rst => rst,
input => s_axis_input_tdata,
input_valid => s_axis_input_tvalid,
input_last => s_axis_input_tlast,
input_accept => s_axis_input_tready,
output => buffer_tdata,
output_valid => buffer_tvalid,
output_last => buffer_tlast,
output_accept => branch_tready(0)
);
-------------------------------------
-- Branch metric unit
--------------------------------------
gen_branch_distance : for i in NUMBER_BRANCH_UNITS - 1 downto 0 generate
begin
inst_branch_distance : branch_distance
generic map(
EDGE_WEIGHT => std_logic_vector(to_unsigned(i, NUMBER_PARITY_BITS))
)
port map(
clk => clk,
rst => rst,
s_axis_input_tvalid => buffer_tvalid,
s_axis_input_tdata => input,
s_axis_input_tlast => buffer_tlast,
s_axis_input_tready => branch_tready(i),
m_axis_output_tvalid => branch_tvalid(i),
m_axis_output_tdata => branch_tdata(i),
m_axis_output_tlast => branch_tlast(i),
m_axis_output_tready => acs_tready(0)
);
end generate gen_branch_distance;
-------------------------------------
-- ACS unit (path metric calculation)
--------------------------------------
gen_acs : for i in 0 to NUMBER_TRELLIS_STATES - 1 generate
signal inbranch_tdata_low : std_logic_vector(BW_BRANCH_RESULT - 1 downto 0);
signal inbranch_tdata_high : std_logic_vector(BW_BRANCH_RESULT - 1 downto 0);
signal inprev_tdata_low : std_logic_vector(BW_MAX_PROBABILITY - 1 downto 0);
signal inprev_tdata_high : std_logic_vector(BW_MAX_PROBABILITY - 1 downto 0);
begin
inbranch_tdata_low <= branch_tdata(to_integer(unsigned(TRANSITIONS(i)(0))));
inbranch_tdata_high <= branch_tdata(to_integer(unsigned(TRANSITIONS(i)(1))));
inprev_tdata_low <= acs_prob_tdata(to_integer(unsigned(PREVIOUS_STATES(i)(0))));
inprev_tdata_high <= acs_prob_tdata(to_integer(unsigned(PREVIOUS_STATES(i)(1))));
inst_acs : acs
generic map(
initialize_value => INITIALIZE_TRELLIS(i)
)
port map(
clk => clk,
rst => rst,
s_axis_inbranch_tvalid => branch_tvalid(0),
s_axis_inbranch_tdata_low => inbranch_tdata_low,
s_axis_inbranch_tdata_high => inbranch_tdata_high,
s_axis_inbranch_tlast => branch_tlast(0),
s_axis_inbranch_tready => acs_tready(i),
s_axis_inprev_tvalid => '1',
s_axis_inprev_tdata_low => inprev_tdata_low,
s_axis_inprev_tdata_high => inprev_tdata_high,
s_axis_inprev_tready => open,
m_axis_outprob_tvalid => open,
m_axis_outprob_tdata => acs_prob_tdata(i),
m_axis_outprob_tready => '1',
m_axis_outdec_tvalid => acs_tvalid(i),
m_axis_outdec_tdata => acs_dec_tdata(i),
m_axis_outdec_tlast => acs_tlast(i),
m_axis_outdec_tready => ram_tready
);
end generate gen_acs;
-------------------------------
-- Traceback
-------------------------------
inst_ram_ctrl : ram_ctrl
port map (
clk => clk,
rst => rst,
s_axis_input_tvalid => acs_tvalid(0),
s_axis_input_tdata => acs_dec_tdata,
s_axis_input_tlast => acs_tlast(0),
s_axis_input_tready => ram_tready,
m_axis_output_tvalid => ram_tvalid,
m_axis_output_tdata => ram_tdata,
m_axis_output_tlast => ram_tlast,
m_axis_output_tready => traceback_tready,
m_axis_output_window_tuser => ram_window_tuser,
m_axis_output_last_tuser => ram_last_tuser,
s_axis_ctrl_tvalid => s_axis_ctrl_tvalid,
s_axis_ctrl_tdata => s_axis_ctrl_tdata,
s_axis_ctrl_tready => s_axis_ctrl_tready
);
gen_inst_trellis_traceback : for i in 1 downto 0 generate
begin
inst_trellis_traceback : trellis_traceback
port map(
clk => clk,
rst => rst,
s_axis_input_tvalid => ram_tvalid(i),
s_axis_input_tdata => ram_tdata(i),
s_axis_input_tlast => ram_tlast(i),
s_axis_input_tready => traceback_tready(i),
s_axis_input_window_tuser => ram_window_tuser(i),
s_axis_input_last_tuser => ram_last_tuser(i),
m_axis_output_tvalid => traceback_tvalid(i),
m_axis_output_tdata => traceback_tdata(i),
m_axis_output_tlast => traceback_tlast(i),
m_axis_output_last_tuser => traceback_last_tuser(i),
m_axis_output_tready => reorder_tready(i)
);
end generate gen_inst_trellis_traceback;
-------------------------------
-- Reverse output order
-------------------------------
gen_inst_reorder : for i in 1 downto 0 generate
begin
inst_reorder : reorder
port map(
clk => clk,
rst => rst,
s_axis_input_tvalid => traceback_tvalid(i),
s_axis_input_tdata => traceback_tdata(i),
s_axis_input_tlast => traceback_tlast(i),
s_axis_input_last_tuser => traceback_last_tuser(i),
s_axis_input_tready => reorder_tready(i),
m_axis_output_tvalid => reorder_tvalid(i),
m_axis_output_tdata => reorder_tdata(i),
m_axis_output_tlast => reorder_tlast(i),
m_axis_output_last_tuser => reorder_last_tuser(i),
m_axis_output_tready => output_tready(i)
);
end generate gen_inst_reorder;
------------------------------
-- Recursive codes handling --
------------------------------
gen_inst_recursion : if FEEDBACK_POLYNOMIAL /= 0 generate
signal reorder_recursion_tvalid : std_logic;
signal reorder_recursion_tdata : std_logic;
signal reorder_recursion_tlast : std_logic;
signal recursion_tready : std_logic;
begin
inst_recursion : recursion
port map(
clk => clk,
rst => rst,
s_axis_input_tvalid => reorder_recursion_tvalid,
s_axis_input_tdata => reorder_recursion_tdata,
s_axis_input_tlast => reorder_recursion_tlast,
s_axis_input_tready => recursion_tready,
m_axis_output_tvalid => m_axis_output_tvalid,
m_axis_output_tdata => m_axis_output_tdata,
m_axis_output_tlast => m_axis_output_tlast,
m_axis_output_tready => m_axis_output_tready
);
-------------------------------
-- Output interface handling
-------------------------------
reorder_recursion_tvalid <= '1' when reorder_tvalid(0) = '1' or reorder_tvalid(1) = '1' else
'0';
reorder_recursion_tdata <= reorder_tdata(0) when current_active = 0 else
reorder_tdata(1);
reorder_recursion_tlast <= '1' when reorder_tlast(0) = '1' or reorder_tlast(1) = '1' else
'0';
output_tready(0) <= '1' when (current_active = 0) and m_axis_output_tready = '1' else
'0';
output_tready(1) <= '1' when (current_active = 1) and m_axis_output_tready = '1' else
'0';
end generate gen_inst_recursion;
no_recursion: if FEEDBACK_POLYNOMIAL = 0 generate
-------------------------------
-- Output interface handling
-------------------------------
m_axis_output_tdata <= reorder_tdata(0) when current_active = 0 else
reorder_tdata(1);
m_axis_output_tvalid <= '1' when reorder_tvalid(0) = '1' or reorder_tvalid(1) = '1' else
'0';
m_axis_output_tlast <= '1' when reorder_tlast(0) = '1' or reorder_tlast(1) = '1' else
'0';
output_tready(0) <= '1' when (current_active = 0) and m_axis_output_tready = '1' else
'0';
output_tready(1) <= '1' when (current_active = 1) and m_axis_output_tready = '1' else
'0';
end generate no_recursion;
recursion : if FEEDBACK_POLYNOMIAL /= 0 generate
begin
end generate recursion;
-- Check and merge reordering outputs and block if necessary.
pr_reorder_tready : process(clk) is
begin
if rising_edge(clk) then
if rst = '1' then
current_active <= 0;
else
if reorder_tvalid(current_active) = '1' and m_axis_output_tready = '1' and reorder_last_tuser(current_active) = '1' then
current_active <= 1 - current_active;
end if;
end if;
end if;
end process pr_reorder_tready;
end architecture rtl;
| bsd-3-clause | 692914f2d1113c3c70563605317842df | 0.617336 | 3.186836 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/video/vhdl_source/char_generator_peripheral.vhd | 1 | 6,519 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2010, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Character Generator
-------------------------------------------------------------------------------
-- File : char_generator_peripheral.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Character generator top
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.char_generator_pkg.all;
entity char_generator_peripheral is
generic (
g_color_ram : boolean := false;
g_screen_size : natural := 11 );
port (
clock : in std_logic;
reset : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
overlay_on : out std_logic;
keyb_row : in std_logic_vector(7 downto 0) := (others => '0');
keyb_col : inout std_logic_vector(7 downto 0) := (others => '0');
pix_clock : in std_logic;
pix_reset : in std_logic;
data_enable : in std_logic := '1';
h_count : in unsigned(11 downto 0);
v_count : in unsigned(11 downto 0);
pixel_active : out std_logic;
pixel_opaque : out std_logic;
pixel_data : out unsigned(3 downto 0) );
end entity;
architecture structural of char_generator_peripheral is
signal control : t_chargen_control;
signal screen_addr : unsigned(g_screen_size-1 downto 0);
signal screen_data : std_logic_vector(7 downto 0);
signal color_data : std_logic_vector(7 downto 0) := X"0F";
signal char_addr : unsigned(10 downto 0);
signal char_data : std_logic_vector(7 downto 0);
signal io_req_regs : t_io_req := c_io_req_init;
signal io_req_regs_p : t_io_req := c_io_req_init;
signal io_req_scr : t_io_req := c_io_req_init;
signal io_req_color : t_io_req := c_io_req_init;
signal io_resp_regs : t_io_resp := c_io_resp_init;
signal io_resp_regs_p : t_io_resp := c_io_resp_init;
signal io_resp_scr : t_io_resp := c_io_resp_init;
signal io_resp_color : t_io_resp := c_io_resp_init;
begin
overlay_on <= control.overlay_on;
-- allocate 32K for character memory
-- allocate 32K for color memory
-- allocate another space for registers
i_split: entity work.io_bus_splitter
generic map (
g_range_lo => g_screen_size,
g_range_hi => g_screen_size+1,
g_ports => 3 )
port map (
clock => clock,
req => io_req,
resp => io_resp,
reqs(0) => io_req_regs, -- size=15: xxx0000, size=11: xxx0000
reqs(1) => io_req_scr, -- size=15: xxx8000, size=11: xxx0800
reqs(2) => io_req_color, -- size=15: xx10000, size=11: xxx1000
resps(0) => io_resp_regs,
resps(1) => io_resp_scr,
resps(2) => io_resp_color );
i_bridge: entity work.io_bus_bridge2
generic map (
g_addr_width => 20
)
port map(
clock_a => clock,
reset_a => reset,
req_a => io_req_regs,
resp_a => io_resp_regs,
clock_b => pix_clock,
reset_b => pix_reset,
req_b => io_req_regs_p,
resp_b => io_resp_regs_p );
i_regs: entity work.char_generator_regs
port map (
clock => pix_clock,
reset => pix_reset,
io_req => io_req_regs_p,
io_resp => io_resp_regs_p,
keyb_row => keyb_row,
keyb_col => keyb_col,
control => control );
i_timing: entity work.char_generator_slave
generic map (
g_screen_size => g_screen_size )
port map (
clock => pix_clock,
reset => pix_reset,
data_enable => data_enable,
h_count => h_count,
v_count => v_count,
control => control,
screen_addr => screen_addr,
screen_data => screen_data,
color_data => color_data,
char_addr => char_addr,
char_data => char_data,
pixel_active => pixel_active,
pixel_opaque => pixel_opaque,
pixel_data => pixel_data );
i_rom: entity work.char_generator_rom
port map (
clock => pix_clock,
enable => '1',
address => char_addr,
data => char_data );
-- process(pix_clock)
-- begin
-- if rising_edge(pix_clock) then
-- screen_data <= std_logic_vector(screen_addr(7 downto 0));
-- color_data <= std_logic_vector(screen_addr(10 downto 3));
-- end if;
-- end process;
i_screen: entity work.dpram_io
generic map (
g_depth_bits => g_screen_size, -- max = 15 for 1920x1080
g_default => X"20",
g_storage => "block" )
port map (
a_clock => pix_clock,
a_address => screen_addr,
a_rdata => screen_Data,
b_clock => clock,
b_req => io_req_scr,
b_resp => io_resp_scr );
r_color: if g_color_ram generate
i_color: entity work.dpram_io
generic map (
g_depth_bits => g_screen_size, -- max = 15 for 1920x1080
g_default => X"0F",
g_storage => "block" )
port map (
a_clock => pix_clock,
a_address => screen_addr,
a_rdata => color_data,
b_clock => clock,
b_req => io_req_color,
b_resp => io_resp_color );
end generate;
end structural;
| gpl-3.0 | 9dcdd29a915863a3a98422d1fa4d6915 | 0.44562 | 3.703977 | false | false | false | false |
markusC64/1541ultimate2 | fpga/devices/vhdl_source/amd_flash.vhd | 1 | 7,167 | --------------------------------------------------------------------------------
-- Entity: amd_flash
-- Date:2018-08-12
-- Author: gideon
--
-- Description: Emulation of AMD flash, in this case 29F040 (512K)
-- This is a behavioral model of a Flash chip. It does not store the actual data
-- The 'allow_write' signal tells the client of this model to store the data
-- into the array. Erase functions will need to be performed by software to
-- modify the array accordingly. For this purpose, the erase byte can be polled
-- and cleared by software. A non-zero value indicates the sector that needs
-- to be erased. One bit for each sector. When 'FF' a chip-erase is requested.
-- In case of a pending erase, the rdata indicates whether the erase is done.
-- When rdata_valid is active, the client should forward the rdata from this
-- module, rather than the data from the array.
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
entity amd_flash is
port (
clock : in std_logic;
reset : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
io_irq : out std_logic;
allow_write : out std_logic;
-- flash bus
address : in unsigned(18 downto 0);
wdata : in std_logic_vector(7 downto 0);
write : in std_logic;
read : in std_logic;
rdata : out std_logic_vector(7 downto 0);
rdata_valid : out std_logic );
end entity;
architecture arch of amd_flash is
type t_state is (idle, prot1, prot2, program, erase1, erase2, erase3, erasing, suspend, auto_select);
signal state : t_state;
signal toggle : std_logic;
signal dirty : std_logic;
signal erase_sectors : std_logic_vector(7 downto 0);
begin
process(clock)
begin
if rising_edge(clock) then
io_resp <= c_io_resp_init;
if io_req.read = '1' then
io_resp.ack <= '1';
if io_req.address(0) = '0' then
io_resp.data <= erase_sectors;
else
io_resp.data(0) <= dirty;
end if;
elsif io_req.write = '1' then
io_resp.ack <= '1';
erase_sectors <= X"00";
io_irq <= '0';
dirty <= '0';
end if;
if write = '1' then
if wdata = X"F0" then
allow_write <= '0';
state <= idle;
else
case state is
when idle =>
if address(14 downto 0) = "101010101010101" and wdata = X"AA" then
state <= prot1;
end if;
when prot1 =>
if address(14 downto 0) = "010101010101010" and wdata = X"55" then
state <= prot2;
else
state <= idle;
end if;
when prot2 =>
if address(14 downto 0) = "101010101010101" then
case wdata is
when X"90" =>
state <= auto_select;
when X"A0" =>
allow_write <= '1';
state <= program;
when X"80" =>
state <= erase1;
when others =>
state <= idle;
end case;
else
state <= idle;
end if;
when program =>
allow_write <= '0';
dirty <= '1';
state <= idle;
when erase1 =>
if address(14 downto 0) = "101010101010101" and wdata = X"AA" then
state <= erase2;
else
state <= idle;
end if;
when erase2 =>
if address(14 downto 0) = "010101010101010" and wdata = X"55" then
state <= erase3;
else
state <= idle;
end if;
when erase3 =>
if address(14 downto 0) = "101010101010101" and wdata = X"10" then
erase_sectors <= (others => '1');
state <= erasing;
io_irq <= '1';
elsif wdata = X"30" then
erase_sectors(to_integer(address(18 downto 16))) <= '1';
state <= erasing;
io_irq <= '1';
else
state <= idle;
end if;
when erasing =>
if wdata = X"B0" then
state <= suspend;
end if;
when suspend =>
if wdata = X"30" then
state <= erasing;
end if;
when others =>
null;
end case;
end if;
elsif read = '1' then
case state is
when idle | prot1 | prot2 | auto_select | erase1 | erase2 | erase3 =>
state <= idle;
toggle <= '0';
when erasing =>
toggle <= not toggle;
when others =>
null;
end case;
end if;
if state = erasing and erase_sectors = X"00" then
state <= idle;
end if;
if reset = '1' then
state <= idle;
allow_write <= '0';
erase_sectors <= (others => '0');
io_irq <= '0';
toggle <= '0';
dirty <= '0';
end if;
end if;
end process;
process(state, address, toggle)
begin
rdata_valid <= '0';
rdata <= X"00";
case state is
when erasing =>
rdata_valid <= '1';
rdata <= '0' & toggle & "000000";
when auto_select =>
rdata_valid <= '1';
if address(7 downto 0) = X"00" then
rdata <= X"01";
elsif address(7 downto 0) = X"01" then
rdata <= X"A4";
end if;
when others =>
null;
end case;
end process;
end architecture;
| gpl-3.0 | cb23900fbbe922f82d125c0e0d1aec22 | 0.386354 | 4.994425 | false | false | false | false |
trondd/mkjpeg | tb/vhdl/DCT_TROM.vhd | 2 | 5,924 | --------------------------------------------------------------------------------
-- --
-- V H D L F I L E --
-- COPYRIGHT (C) 2006 --
-- --
--------------------------------------------------------------------------------
--
-- Title : DCT
-- Design : MDCT Core
-- Author : Michal Krepa
--
--------------------------------------------------------------------------------
--
-- File : DCT_TROM.VHD
-- Created : Sun Aug 27 18:09 2006
--
--------------------------------------------------------------------------------
--
-- Description : ROM for DCT quantizer matrix
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.numeric_std.all;
entity DCT_TROM is
generic
(
ROMADDR_W : INTEGER := 9;
ROMDATA_W : INTEGER := 8
);
port(
addr : in STD_LOGIC_VECTOR(ROMADDR_W-1 downto 0);
clk : in STD_LOGIC;
datao : out STD_LOGIC_VECTOR(ROMDATA_W-1 downto 0)
);
end DCT_TROM;
architecture RTL of DCT_TROM is
type DCT_TROM_TYPE is array (0 to 2**ROMADDR_W-1)
of INTEGER;
constant rom : DCT_TROM_TYPE :=
-- (
-- 16,11,10,16,24,40,51,61,
-- 12,12,14,19,26,58,60,55,
-- 14,13,16,24,40,57,69,56,
-- 14,17,22,29,51,87,80,62,
-- 18,22,37,56,68,109,103,77,
-- 24,35,55,64,81,104,113,92,
-- 49,64,78,87,103,121,120,101,
-- 72,92,95,98,112,100,103,99);
(
-280, 48, -20, 16, -26, 46, -42, 27,
45, 12, -34, -31, 11, -1, 16, -44,
-5, -63, -34, 36, 24, -27, 6, 1,
-12, 12, -8, 34, 5, 2, -12, 5,
22, -18, 15, 9, 12, -5, 1, -11,
1, 10, 6, 12, -15, -11, -5, -10,
5, -16, -4, 10, -1, -11, -5, -11,
-9, 11, 5, -3, -14, 4, 0, 0,
-213, -110, -78, 38, 32, 2, -1, -9,
28, 62, -7, -7, 22, -11, 5, 7,
85, -21, 33, -28, -37, 36, -11, 5,
-34, -18, 2, -24, 8, -12, -11, -8,
-13, 8, 39, -63, 27, 0, 1, -4,
-32, -4, -8, 24, -22, 11, 20, -4,
-12, 8, 43, 41, -16, -12, 4, -10,
-11, 14, 15, 7, -11, 9, -32, 0,
-225, 10, 25, 18, -30, 18, -14, 7,
44, -13, -93, -7, 20, -7, 5, -11,
-88, -53, 6, 36, 2, 1, 22, 2,
-46, -10, 17, 23, 16, 32, -7, 8,
66, 46, -10, -3, -17, 4, -5, -5,
-51, -18, -9, 6, 37, 15, 23, -4,
-21, 22, 44, 49, 25, 21, 1, -12,
25, 12, -5, -2, -19, -8, -15, 0,
390, -97, -41, -15, 20, 6, 0, 12,
4, -62, 21, -5, -31, -7, -3, -20,
-352, 44, 27, 36, 35, 6, 5, 10,
33, 48, 48, 14, -8, 14, 10, -9,
-95, 108, 5, 1, -11, -23, -20, 1,
54, -7, -43, -32, -15, 3, 9, 3,
-42, 57, -32, -19, -4, 6, 5, -3,
23, -31, -22, -1, 19, 24, 22, 1,
-14, 148, 70, 67, 54, 30, 2, -10,
76, 20, 20, -39, 14, -10, -8, -11,
-86, -65, -15, -33, -33, -38, -2, 10,
61, 20, 50, 18, -15, -25, -23, 2,
11, -3, 12, 12, 15, 8, -18, -5,
-13, -14, -13, 16, 34, 15, -22, -18,
-8, -13, -3, 11, 19, 26, 9, -5,
1, 1, 2, -9, -11, 2, 7, 0,
-317, -9, 63, 17, 10, -26, 1, -11,
159, -41, -29, 42, -3, 21, 11, 1,
-6, -13, -18, 9, -19, 5, 15, 7,
-8, -9, -11, 16, -4, -1, -12, -3,
1, 15, -1, 3, -13, -8, 5, -1,
-9, 3, 2, 5, 7, -6, 12, -11,
-3, 1, -6, 1, -5, -4, 9, 6,
3, 7, 7, 3, -3, -5, -2, 0,
-404, 148, 70, 67, 54, 30, 2, -10,
76, 20, 20, -39, 14, -10, -8, -11,
-86, -65, -15, -33, -33, -38, -2, 10,
61, 20, 50, 18, -15, -25, -23, 2,
11, -3, 12, 12, 15, 8, -18, -5,
-13, -14, -13, 16, 34, 15, -22, -18,
-8, -13, -3, 11, 19, 26, 9, -5,
1, 1, 2, -9, -11, 2, 7, 0,
-404, 148, 70, 67, 54, 30, 2, -10,
76, 20, 20, -39, 14, -10, -8, -11,
-86, -65, -15, -33, -33, -38, -2, 10,
61, 20, 50, 18, -15, -25, -23, 2,
11, -3, 12, 12, 15, 8, -18, -5,
-13, -14, -13, 16, 34, 15, -22, -18,
-8, -13, -3, 11, 19, 26, 9, -5,
1, 1, 2, -9, -11, 2, 7, 0
);
signal addr_reg : STD_LOGIC_VECTOR(ROMADDR_W-1 downto 0);
begin
datao <= STD_LOGIC_VECTOR(TO_SIGNED( rom( TO_INTEGER(UNSIGNED(addr_reg)) ), ROMDATA_W));
process(clk)
begin
if clk = '1' and clk'event then
addr_reg <= addr;
end if;
end process;
end RTL;
| lgpl-3.0 | 0b396000e1b159d94e2f055c59d29765 | 0.270257 | 2.575652 | false | false | false | false |
asicguy/crash | fpga/src/toplevel/zedboard.vhd | 2 | 63,749 | -------------------------------------------------------------------------------
-- Copyright 2013-2014 Jonathon Pendlum
--
-- This 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 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/>.
--
--
-- File: zc706.vhd
-- Author: Jonathon Pendlum ([email protected])
-- Description: Toplevel file for Zedboard.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library unisim;
use unisim.vcomponents.all;
entity zedboard is
port (
-- ARM Connections
MIO : inout std_logic_vector(53 downto 0);
PS_SRSTB : in std_logic;
PS_CLK : in std_logic;
PS_PORB : in std_logic;
DDR_Clk : inout std_logic;
DDR_Clk_n : inout std_logic;
DDR_CKE : inout std_logic;
DDR_CS_n : inout std_logic;
DDR_RAS_n : inout std_logic;
DDR_CAS_n : inout std_logic;
DDR_WEB_pin : out std_logic;
DDR_BankAddr : inout std_logic_vector(2 downto 0);
DDR_Addr : inout std_logic_vector(14 downto 0);
DDR_ODT : inout std_logic;
DDR_DRSTB : inout std_logic;
DDR_DQ : inout std_logic_vector(31 downto 0);
DDR_DM : inout std_logic_vector(3 downto 0);
DDR_DQS : inout std_logic_vector(3 downto 0);
DDR_DQS_n : inout std_logic_vector(3 downto 0);
DDR_VRP : inout std_logic;
DDR_VRN : inout std_logic;
-- USRP DDR Interface
RX_DATA_CLK_N : in std_logic;
RX_DATA_CLK_P : in std_logic;
RX_DATA_N : in std_logic_vector(6 downto 0);
RX_DATA_P : in std_logic_vector(6 downto 0);
TX_DATA_N : out std_logic_vector(7 downto 0);
TX_DATA_P : out std_logic_vector(7 downto 0);
SPARE : out std_logic;
UART_TX : out std_logic);
end entity;
architecture RTL of zedboard is
-------------------------------------------------------------------------------
-- Component Declaration
-------------------------------------------------------------------------------
component zedboard_ps is
port (
processing_system7_0_MIO : inout std_logic_vector(53 downto 0);
processing_system7_0_PS_SRSTB_pin : in std_logic;
processing_system7_0_PS_CLK_pin : in std_logic;
processing_system7_0_PS_PORB_pin : in std_logic;
processing_system7_0_DDR_Clk : inout std_logic;
processing_system7_0_DDR_Clk_n : inout std_logic;
processing_system7_0_DDR_CKE : inout std_logic;
processing_system7_0_DDR_CS_n : inout std_logic;
processing_system7_0_DDR_RAS_n : inout std_logic;
processing_system7_0_DDR_CAS_n : inout std_logic;
processing_system7_0_DDR_WEB_pin : out std_logic;
processing_system7_0_DDR_BankAddr : inout std_logic_vector(2 downto 0);
processing_system7_0_DDR_Addr : inout std_logic_vector(14 downto 0);
processing_system7_0_DDR_ODT : inout std_logic;
processing_system7_0_DDR_DRSTB : inout std_logic;
processing_system7_0_DDR_DQ : inout std_logic_vector(31 downto 0);
processing_system7_0_DDR_DM : inout std_logic_vector(3 downto 0);
processing_system7_0_DDR_DQS : inout std_logic_vector(3 downto 0);
processing_system7_0_DDR_DQS_n : inout std_logic_vector(3 downto 0);
processing_system7_0_DDR_VRN : inout std_logic;
processing_system7_0_DDR_VRP : inout std_logic;
axi_ext_slave_conn_0_M_AXI_AWADDR_pin : out std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_AWVALID_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_AWREADY_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_WDATA_pin : out std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_WSTRB_pin : out std_logic_vector(3 downto 0);
axi_ext_slave_conn_0_M_AXI_WVALID_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_WREADY_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_BRESP_pin : in std_logic_vector(1 downto 0);
axi_ext_slave_conn_0_M_AXI_BVALID_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_BREADY_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_ARADDR_pin : out std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_ARVALID_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_ARREADY_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_RDATA_pin : in std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_RRESP_pin : in std_logic_vector(1 downto 0);
axi_ext_slave_conn_0_M_AXI_RVALID_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_RREADY_pin : out std_logic;
processing_system7_0_IRQ_F2P_pin : in std_logic_vector(15 downto 0);
processing_system7_0_FCLK_CLK0_pin : out std_logic;
processing_system7_0_FCLK_RESET0_N_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_AWADDR_pin : in std_logic_vector(31 downto 0);
axi_ext_master_conn_0_S_AXI_AWLEN_pin : in std_logic_vector(7 downto 0);
axi_ext_master_conn_0_S_AXI_AWSIZE_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_AWBURST_pin : in std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_AWCACHE_pin : in std_logic_vector(3 downto 0);
axi_ext_master_conn_0_S_AXI_AWPROT_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_AWVALID_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_AWREADY_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_WDATA_pin : in std_logic_vector(63 downto 0);
axi_ext_master_conn_0_S_AXI_WSTRB_pin : in std_logic_vector(7 downto 0);
axi_ext_master_conn_0_S_AXI_WLAST_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_WVALID_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_WREADY_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_BRESP_pin : out std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_BVALID_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_BREADY_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_ARADDR_pin : in std_logic_vector(31 downto 0);
axi_ext_master_conn_0_S_AXI_ARLEN_pin : in std_logic_vector(7 downto 0);
axi_ext_master_conn_0_S_AXI_ARSIZE_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_ARBURST_pin : in std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_ARCACHE_pin : in std_logic_vector(3 downto 0);
axi_ext_master_conn_0_S_AXI_ARPROT_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_ARVALID_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_ARREADY_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_RDATA_pin : out std_logic_vector(63 downto 0);
axi_ext_master_conn_0_S_AXI_RRESP_pin : out std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_RLAST_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_RVALID_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_RREADY_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_AWUSER_pin : in std_logic_vector(4 downto 0);
axi_ext_master_conn_0_S_AXI_ARUSER_pin : in std_logic_vector(4 downto 0));
end component;
component ps_pl_interface is
generic (
C_BASEADDR : std_logic_vector(31 downto 0) := x"40000000";
C_HIGHADDR : std_logic_vector(31 downto 0) := x"4001ffff");
port (
-- AXIS Stream Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- AXI-Lite Slave bus for access to control & status registers
S_AXI_AWADDR : in std_logic_vector(31 downto 0);
S_AXI_AWVALID : in std_logic;
S_AXI_AWREADY : out std_logic;
S_AXI_WDATA : in std_logic_vector(31 downto 0);
S_AXI_WSTRB : in std_logic_vector(3 downto 0);
S_AXI_WVALID : in std_logic;
S_AXI_WREADY : out std_logic;
S_AXI_BRESP : out std_logic_vector(1 downto 0);
S_AXI_BVALID : out std_logic;
S_AXI_BREADY : in std_logic;
S_AXI_ARADDR : in std_logic_vector(31 downto 0);
S_AXI_ARVALID : in std_logic;
S_AXI_ARREADY : out std_logic;
S_AXI_RDATA : out std_logic_vector(31 downto 0);
S_AXI_RRESP : out std_logic_vector(1 downto 0);
S_AXI_RVALID : out std_logic;
S_AXI_RREADY : in std_logic;
-- AXI ACP Bus to interface with processor system
M_AXI_AWADDR : out std_logic_vector(31 downto 0);
M_AXI_AWPROT : out std_logic_vector(2 downto 0);
M_AXI_AWVALID : out std_logic;
M_AXI_AWREADY : in std_logic;
M_AXI_WDATA : out std_logic_vector(63 downto 0);
M_AXI_WSTRB : out std_logic_vector(7 downto 0);
M_AXI_WVALID : out std_logic;
M_AXI_WREADY : in std_logic;
M_AXI_BRESP : in std_logic_vector(1 downto 0);
M_AXI_BVALID : in std_logic;
M_AXI_BREADY : out std_logic;
M_AXI_AWLEN : out std_logic_vector(7 downto 0);
M_AXI_AWSIZE : out std_logic_vector(2 downto 0);
M_AXI_AWBURST : out std_logic_vector(1 downto 0);
M_AXI_AWCACHE : out std_logic_vector(3 downto 0);
M_AXI_AWUSER : out std_logic_vector(4 downto 0);
M_AXI_WLAST : out std_logic;
M_AXI_ARADDR : out std_logic_vector(31 downto 0);
M_AXI_ARPROT : out std_logic_vector(2 downto 0);
M_AXI_ARVALID : out std_logic;
M_AXI_ARREADY : in std_logic;
M_AXI_RDATA : in std_logic_vector(63 downto 0);
M_AXI_RRESP : in std_logic_vector(1 downto 0);
M_AXI_RVALID : in std_logic;
M_AXI_RREADY : out std_logic;
M_AXI_RLAST : in std_logic;
M_AXI_ARCACHE : out std_logic_vector(3 downto 0);
M_AXI_ARUSER : out std_logic_vector(4 downto 0);
M_AXI_ARLEN : out std_logic_vector(7 downto 0);
M_AXI_ARBURST : out std_logic_vector(1 downto 0);
M_AXI_ARSIZE : out std_logic_vector(2 downto 0);
-- Interrupt on successfully completed AXI ACP writes
irq : out std_logic;
-- Global reset for all accelerators
rst_glb_n : out std_logic;
-- Accelerator interfaces
-- Note: Master & Slave 0 are not listed as the Datamover componeent
-- uses both.
-- Accelerator 1
-- Accelerator 1
axis_master_1_tvalid : in std_logic;
axis_master_1_tready : out std_logic;
axis_master_1_tdata : in std_logic_vector(63 downto 0);
axis_master_1_tdest : in std_logic_vector(2 downto 0);
axis_master_1_tlast : in std_logic;
axis_master_1_irq : in std_logic;
axis_slave_1_tvalid : out std_logic;
axis_slave_1_tready : in std_logic;
axis_slave_1_tdata : out std_logic_vector(63 downto 0);
axis_slave_1_tid : out std_logic_vector(2 downto 0);
axis_slave_1_tlast : out std_logic;
axis_slave_1_irq : in std_logic;
status_1_addr : out std_logic_vector(7 downto 0);
status_1_data : in std_logic_vector(31 downto 0);
status_1_stb : out std_logic;
ctrl_1_addr : out std_logic_vector(7 downto 0);
ctrl_1_data : out std_logic_vector(31 downto 0);
ctrl_1_stb : out std_logic;
-- Accelerator 2
axis_master_2_tvalid : in std_logic;
axis_master_2_tready : out std_logic;
axis_master_2_tdata : in std_logic_vector(63 downto 0);
axis_master_2_tdest : in std_logic_vector(2 downto 0);
axis_master_2_tlast : in std_logic;
axis_master_2_irq : in std_logic;
axis_slave_2_tvalid : out std_logic;
axis_slave_2_tready : in std_logic;
axis_slave_2_tdata : out std_logic_vector(63 downto 0);
axis_slave_2_tid : out std_logic_vector(2 downto 0);
axis_slave_2_tlast : out std_logic;
axis_slave_2_irq : in std_logic;
status_2_addr : out std_logic_vector(7 downto 0);
status_2_data : in std_logic_vector(31 downto 0);
status_2_stb : out std_logic;
ctrl_2_addr : out std_logic_vector(7 downto 0);
ctrl_2_data : out std_logic_vector(31 downto 0);
ctrl_2_stb : out std_logic;
-- Accelerator 3
axis_master_3_tvalid : in std_logic;
axis_master_3_tready : out std_logic;
axis_master_3_tdata : in std_logic_vector(63 downto 0);
axis_master_3_tdest : in std_logic_vector(2 downto 0);
axis_master_3_tlast : in std_logic;
axis_master_3_irq : in std_logic;
axis_slave_3_tvalid : out std_logic;
axis_slave_3_tready : in std_logic;
axis_slave_3_tdata : out std_logic_vector(63 downto 0);
axis_slave_3_tid : out std_logic_vector(2 downto 0);
axis_slave_3_tlast : out std_logic;
axis_slave_3_irq : in std_logic;
status_3_addr : out std_logic_vector(7 downto 0);
status_3_data : in std_logic_vector(31 downto 0);
status_3_stb : out std_logic;
ctrl_3_addr : out std_logic_vector(7 downto 0);
ctrl_3_data : out std_logic_vector(31 downto 0);
ctrl_3_stb : out std_logic;
-- Accelerator 4
axis_master_4_tvalid : in std_logic;
axis_master_4_tready : out std_logic;
axis_master_4_tdata : in std_logic_vector(63 downto 0);
axis_master_4_tdest : in std_logic_vector(2 downto 0);
axis_master_4_tlast : in std_logic;
axis_master_4_irq : in std_logic;
axis_slave_4_tvalid : out std_logic;
axis_slave_4_tready : in std_logic;
axis_slave_4_tdata : out std_logic_vector(63 downto 0);
axis_slave_4_tid : out std_logic_vector(2 downto 0);
axis_slave_4_tlast : out std_logic;
axis_slave_4_irq : in std_logic;
status_4_addr : out std_logic_vector(7 downto 0);
status_4_data : in std_logic_vector(31 downto 0);
status_4_stb : out std_logic;
ctrl_4_addr : out std_logic_vector(7 downto 0);
ctrl_4_data : out std_logic_vector(31 downto 0);
ctrl_4_stb : out std_logic;
-- Accelerator 5
axis_master_5_tvalid : in std_logic;
axis_master_5_tready : out std_logic;
axis_master_5_tdata : in std_logic_vector(63 downto 0);
axis_master_5_tdest : in std_logic_vector(2 downto 0);
axis_master_5_tlast : in std_logic;
axis_master_5_irq : in std_logic;
axis_slave_5_tvalid : out std_logic;
axis_slave_5_tready : in std_logic;
axis_slave_5_tdata : out std_logic_vector(63 downto 0);
axis_slave_5_tid : out std_logic_vector(2 downto 0);
axis_slave_5_tlast : out std_logic;
axis_slave_5_irq : in std_logic;
status_5_addr : out std_logic_vector(7 downto 0);
status_5_data : in std_logic_vector(31 downto 0);
status_5_stb : out std_logic;
ctrl_5_addr : out std_logic_vector(7 downto 0);
ctrl_5_data : out std_logic_vector(31 downto 0);
ctrl_5_stb : out std_logic;
-- Accelerator 6
axis_master_6_tvalid : in std_logic;
axis_master_6_tready : out std_logic;
axis_master_6_tdata : in std_logic_vector(63 downto 0);
axis_master_6_tdest : in std_logic_vector(2 downto 0);
axis_master_6_tlast : in std_logic;
axis_master_6_irq : in std_logic;
axis_slave_6_tvalid : out std_logic;
axis_slave_6_tready : in std_logic;
axis_slave_6_tdata : out std_logic_vector(63 downto 0);
axis_slave_6_tid : out std_logic_vector(2 downto 0);
axis_slave_6_tlast : out std_logic;
axis_slave_6_irq : in std_logic;
status_6_addr : out std_logic_vector(7 downto 0);
status_6_data : in std_logic_vector(31 downto 0);
status_6_stb : out std_logic;
ctrl_6_addr : out std_logic_vector(7 downto 0);
ctrl_6_data : out std_logic_vector(31 downto 0);
ctrl_6_stb : out std_logic;
-- Accelerator 7
axis_master_7_tvalid : in std_logic;
axis_master_7_tready : out std_logic;
axis_master_7_tdata : in std_logic_vector(63 downto 0);
axis_master_7_tdest : in std_logic_vector(2 downto 0);
axis_master_7_tlast : in std_logic;
axis_master_7_irq : in std_logic;
axis_slave_7_tvalid : out std_logic;
axis_slave_7_tready : in std_logic;
axis_slave_7_tdata : out std_logic_vector(63 downto 0);
axis_slave_7_tid : out std_logic_vector(2 downto 0);
axis_slave_7_tlast : out std_logic;
axis_slave_7_irq : in std_logic;
status_7_addr : out std_logic_vector(7 downto 0);
status_7_data : in std_logic_vector(31 downto 0);
status_7_stb : out std_logic;
ctrl_7_addr : out std_logic_vector(7 downto 0);
ctrl_7_data : out std_logic_vector(31 downto 0);
ctrl_7_stb : out std_logic);
end component;
component usrp_ddr_intf_axis is
generic (
DDR_CLOCK_FREQ : integer := 100e6; -- Clock rate of DDR interface
BAUD : integer := 115200); -- UART baud rate
port (
-- USRP Interface
UART_TX : out std_logic; -- UART
RX_DATA_CLK_N : in std_logic; -- Receive data clock (N)
RX_DATA_CLK_P : in std_logic; -- Receive data clock (P)
RX_DATA_N : in std_logic_vector(6 downto 0); -- Receive data (N)
RX_DATA_P : in std_logic_vector(6 downto 0); -- Receive data (N)
TX_DATA_N : out std_logic_vector(7 downto 0); -- Transmit data (N)
TX_DATA_P : out std_logic_vector(7 downto 0); -- Transmit data (P)
-- Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- Control and Status Registers
status_addr : in std_logic_vector(7 downto 0);
status_data : out std_logic_vector(31 downto 0);
status_stb : in std_logic;
ctrl_addr : in std_logic_vector(7 downto 0);
ctrl_data : in std_logic_vector(31 downto 0);
ctrl_stb : in std_logic;
-- AXIS Stream Slave Interface (DAC / TX Data)
axis_slave_tvalid : in std_logic;
axis_slave_tready : out std_logic;
axis_slave_tdata : in std_logic_vector(63 downto 0);
axis_slave_tid : in std_logic_vector(2 downto 0);
axis_slave_tlast : in std_logic;
axis_slave_irq : out std_logic; -- Not used
-- AXIS Stream Master Interface (ADC / RX Data)
axis_master_tvalid : out std_logic;
axis_master_tready : in std_logic;
axis_master_tdata : out std_logic_vector(63 downto 0);
axis_master_tdest : out std_logic_vector(2 downto 0);
axis_master_tlast : out std_logic;
axis_master_irq : out std_logic; -- Not used
-- Sideband signals
rx_enable_aux : in std_logic;
tx_enable_aux : in std_logic);
end component;
component spectrum_sense is
port (
-- Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- Control and Status Registers
status_addr : in std_logic_vector(7 downto 0);
status_data : out std_logic_vector(31 downto 0);
status_stb : in std_logic;
ctrl_addr : in std_logic_vector(7 downto 0);
ctrl_data : in std_logic_vector(31 downto 0);
ctrl_stb : in std_logic;
-- AXIS Stream Slave Interface (Time Domain / FFT Input)
axis_slave_tvalid : in std_logic;
axis_slave_tready : out std_logic;
axis_slave_tdata : in std_logic_vector(63 downto 0);
axis_slave_tid : in std_logic_vector(2 downto 0);
axis_slave_tlast : in std_logic;
axis_slave_irq : out std_logic; -- Not used
-- AXIS Stream Master Interface (Frequency Domain / FFT Output)
axis_master_tvalid : out std_logic;
axis_master_tready : in std_logic;
axis_master_tdata : out std_logic_vector(63 downto 0);
axis_master_tdest : out std_logic_vector(2 downto 0);
axis_master_tlast : out std_logic;
axis_master_irq : out std_logic; -- Strobes when threshold exceeded
-- Sideband signals
threshold_not_exceeded : out std_logic;
threshold_not_exceeded_stb : out std_logic;
threshold_exceeded : out std_logic;
threshold_exceeded_stb : out std_logic);
end component;
component bpsk_mod is
port (
-- Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- Control and Status Registers
status_addr : in std_logic_vector(7 downto 0);
status_data : out std_logic_vector(31 downto 0);
status_stb : in std_logic;
ctrl_addr : in std_logic_vector(7 downto 0);
ctrl_data : in std_logic_vector(31 downto 0);
ctrl_stb : in std_logic;
-- AXIS Stream Slave Interface (Binary Data)
axis_slave_tvalid : in std_logic;
axis_slave_tready : out std_logic;
axis_slave_tdata : in std_logic_vector(63 downto 0);
axis_slave_tid : in std_logic_vector(2 downto 0);
axis_slave_tlast : in std_logic;
axis_slave_irq : out std_logic; -- Not used (TODO: maybe use for near empty input FIFO?)
-- AXIS Stream Master Interface (Modulated complex samples)
axis_master_tvalid : out std_logic;
axis_master_tready : in std_logic;
axis_master_tdata : out std_logic_vector(63 downto 0);
axis_master_tdest : out std_logic_vector(2 downto 0);
axis_master_tlast : out std_logic;
axis_master_irq : out std_logic; -- Not used
-- Sideband signals
trigger_stb : in std_logic);
end component;
-----------------------------------------------------------------------------
-- Signals Declaration
-----------------------------------------------------------------------------
signal clk : std_logic;
signal rst_n : std_logic;
signal S_AXI_AWADDR : std_logic_vector(31 downto 0);
signal S_AXI_AWVALID : std_logic;
signal S_AXI_AWREADY : std_logic;
signal S_AXI_WDATA : std_logic_vector(31 downto 0);
signal S_AXI_WSTRB : std_logic_vector(3 downto 0);
signal S_AXI_WVALID : std_logic;
signal S_AXI_WREADY : std_logic;
signal S_AXI_BRESP : std_logic_vector(1 downto 0);
signal S_AXI_BVALID : std_logic;
signal S_AXI_BREADY : std_logic;
signal S_AXI_ARADDR : std_logic_vector(31 downto 0);
signal S_AXI_ARVALID : std_logic;
signal S_AXI_ARREADY : std_logic;
signal S_AXI_RDATA : std_logic_vector(31 downto 0);
signal S_AXI_RRESP : std_logic_vector(1 downto 0);
signal S_AXI_RVALID : std_logic;
signal S_AXI_RREADY : std_logic;
signal M_AXI_AWADDR : std_logic_vector(31 downto 0);
signal M_AXI_AWPROT : std_logic_vector(2 downto 0);
signal M_AXI_AWVALID : std_logic;
signal M_AXI_AWREADY : std_logic;
signal M_AXI_WDATA : std_logic_vector(63 downto 0);
signal M_AXI_WSTRB : std_logic_vector(7 downto 0);
signal M_AXI_WVALID : std_logic;
signal M_AXI_WREADY : std_logic;
signal M_AXI_BRESP : std_logic_vector(1 downto 0);
signal M_AXI_BVALID : std_logic;
signal M_AXI_BREADY : std_logic;
signal M_AXI_AWLEN : std_logic_vector(7 downto 0);
signal M_AXI_AWSIZE : std_logic_vector(2 downto 0);
signal M_AXI_AWBURST : std_logic_vector(1 downto 0);
signal M_AXI_AWCACHE : std_logic_vector(3 downto 0);
signal M_AXI_AWUSER : std_logic_vector(4 downto 0);
signal M_AXI_WLAST : std_logic;
signal M_AXI_ARADDR : std_logic_vector(31 downto 0);
signal M_AXI_ARPROT : std_logic_vector(2 downto 0);
signal M_AXI_ARVALID : std_logic;
signal M_AXI_ARREADY : std_logic;
signal M_AXI_RDATA : std_logic_vector(63 downto 0);
signal M_AXI_RRESP : std_logic_vector(1 downto 0);
signal M_AXI_RVALID : std_logic;
signal M_AXI_RREADY : std_logic;
signal M_AXI_RLAST : std_logic;
signal M_AXI_ARCACHE : std_logic_vector(3 downto 0);
signal M_AXI_ARUSER : std_logic_vector(4 downto 0);
signal M_AXI_ARLEN : std_logic_vector(7 downto 0);
signal M_AXI_ARBURST : std_logic_vector(1 downto 0);
signal M_AXI_ARSIZE : std_logic_vector(2 downto 0);
signal processing_system7_0_IRQ_F2P_pin : std_logic_vector(15 downto 0);
signal irq : std_logic;
signal rst_glb_n : std_logic;
signal axis_master_1_tvalid : std_logic;
signal axis_master_1_tready : std_logic;
signal axis_master_1_tdata : std_logic_vector(63 downto 0);
signal axis_master_1_tdest : std_logic_vector(2 downto 0);
signal axis_master_1_tlast : std_logic;
signal axis_master_1_irq : std_logic;
signal axis_slave_1_tvalid : std_logic;
signal axis_slave_1_tready : std_logic;
signal axis_slave_1_tdata : std_logic_vector(63 downto 0);
signal axis_slave_1_tid : std_logic_vector(2 downto 0);
signal axis_slave_1_tlast : std_logic;
signal axis_slave_1_irq : std_logic;
signal status_1_addr : std_logic_vector(7 downto 0);
signal status_1_data : std_logic_vector(31 downto 0);
signal status_1_stb : std_logic;
signal ctrl_1_addr : std_logic_vector(7 downto 0);
signal ctrl_1_data : std_logic_vector(31 downto 0);
signal ctrl_1_stb : std_logic;
signal axis_master_2_tvalid : std_logic;
signal axis_master_2_tready : std_logic;
signal axis_master_2_tdata : std_logic_vector(63 downto 0);
signal axis_master_2_tdest : std_logic_vector(2 downto 0);
signal axis_master_2_tlast : std_logic;
signal axis_master_2_irq : std_logic;
signal axis_slave_2_tvalid : std_logic;
signal axis_slave_2_tready : std_logic;
signal axis_slave_2_tdata : std_logic_vector(63 downto 0);
signal axis_slave_2_tid : std_logic_vector(2 downto 0);
signal axis_slave_2_tlast : std_logic;
signal axis_slave_2_irq : std_logic;
signal status_2_addr : std_logic_vector(7 downto 0);
signal status_2_data : std_logic_vector(31 downto 0);
signal status_2_stb : std_logic;
signal ctrl_2_addr : std_logic_vector(7 downto 0);
signal ctrl_2_data : std_logic_vector(31 downto 0);
signal ctrl_2_stb : std_logic;
signal axis_master_3_tvalid : std_logic;
signal axis_master_3_tready : std_logic;
signal axis_master_3_tdata : std_logic_vector(63 downto 0);
signal axis_master_3_tdest : std_logic_vector(2 downto 0);
signal axis_master_3_tlast : std_logic;
signal axis_master_3_irq : std_logic;
signal axis_slave_3_tvalid : std_logic;
signal axis_slave_3_tready : std_logic;
signal axis_slave_3_tdata : std_logic_vector(63 downto 0);
signal axis_slave_3_tid : std_logic_vector(2 downto 0);
signal axis_slave_3_tlast : std_logic;
signal axis_slave_3_irq : std_logic;
signal status_3_addr : std_logic_vector(7 downto 0);
signal status_3_data : std_logic_vector(31 downto 0);
signal status_3_stb : std_logic;
signal ctrl_3_addr : std_logic_vector(7 downto 0);
signal ctrl_3_data : std_logic_vector(31 downto 0);
signal ctrl_3_stb : std_logic;
signal axis_master_4_tvalid : std_logic;
signal axis_master_4_tready : std_logic;
signal axis_master_4_tdata : std_logic_vector(63 downto 0);
signal axis_master_4_tdest : std_logic_vector(2 downto 0);
signal axis_master_4_tlast : std_logic;
signal axis_master_4_irq : std_logic;
signal axis_slave_4_tvalid : std_logic;
signal axis_slave_4_tready : std_logic;
signal axis_slave_4_tdata : std_logic_vector(63 downto 0);
signal axis_slave_4_tid : std_logic_vector(2 downto 0);
signal axis_slave_4_tlast : std_logic;
signal axis_slave_4_irq : std_logic;
signal status_4_addr : std_logic_vector(7 downto 0);
signal status_4_data : std_logic_vector(31 downto 0);
signal status_4_stb : std_logic;
signal ctrl_4_addr : std_logic_vector(7 downto 0);
signal ctrl_4_data : std_logic_vector(31 downto 0);
signal ctrl_4_stb : std_logic;
signal axis_master_5_tvalid : std_logic;
signal axis_master_5_tready : std_logic;
signal axis_master_5_tdata : std_logic_vector(63 downto 0);
signal axis_master_5_tdest : std_logic_vector(2 downto 0);
signal axis_master_5_tlast : std_logic;
signal axis_master_5_irq : std_logic;
signal axis_slave_5_tvalid : std_logic;
signal axis_slave_5_tready : std_logic;
signal axis_slave_5_tdata : std_logic_vector(63 downto 0);
signal axis_slave_5_tid : std_logic_vector(2 downto 0);
signal axis_slave_5_tlast : std_logic;
signal axis_slave_5_irq : std_logic;
signal status_5_addr : std_logic_vector(7 downto 0);
signal status_5_data : std_logic_vector(31 downto 0);
signal status_5_stb : std_logic;
signal ctrl_5_addr : std_logic_vector(7 downto 0);
signal ctrl_5_data : std_logic_vector(31 downto 0);
signal ctrl_5_stb : std_logic;
signal axis_master_6_tvalid : std_logic;
signal axis_master_6_tready : std_logic;
signal axis_master_6_tdata : std_logic_vector(63 downto 0);
signal axis_master_6_tdest : std_logic_vector(2 downto 0);
signal axis_master_6_tlast : std_logic;
signal axis_master_6_irq : std_logic;
signal axis_slave_6_tvalid : std_logic;
signal axis_slave_6_tready : std_logic;
signal axis_slave_6_tdata : std_logic_vector(63 downto 0);
signal axis_slave_6_tid : std_logic_vector(2 downto 0);
signal axis_slave_6_tlast : std_logic;
signal axis_slave_6_irq : std_logic;
signal status_6_addr : std_logic_vector(7 downto 0);
signal status_6_data : std_logic_vector(31 downto 0);
signal status_6_stb : std_logic;
signal ctrl_6_addr : std_logic_vector(7 downto 0);
signal ctrl_6_data : std_logic_vector(31 downto 0);
signal ctrl_6_stb : std_logic;
signal axis_master_7_tvalid : std_logic;
signal axis_master_7_tready : std_logic;
signal axis_master_7_tdata : std_logic_vector(63 downto 0);
signal axis_master_7_tdest : std_logic_vector(2 downto 0);
signal axis_master_7_tlast : std_logic;
signal axis_master_7_irq : std_logic;
signal axis_slave_7_tvalid : std_logic;
signal axis_slave_7_tready : std_logic;
signal axis_slave_7_tdata : std_logic_vector(63 downto 0);
signal axis_slave_7_tid : std_logic_vector(2 downto 0);
signal axis_slave_7_tlast : std_logic;
signal axis_slave_7_irq : std_logic;
signal status_7_addr : std_logic_vector(7 downto 0);
signal status_7_data : std_logic_vector(31 downto 0);
signal status_7_stb : std_logic;
signal ctrl_7_addr : std_logic_vector(7 downto 0);
signal ctrl_7_data : std_logic_vector(31 downto 0);
signal ctrl_7_stb : std_logic;
signal rx_enable_aux : std_logic;
signal tx_enable_aux : std_logic;
signal threshold_not_exceeded : std_logic;
signal threshold_not_exceeded_stb : std_logic;
signal threshold_exceeded : std_logic;
signal threshold_exceeded_stb : std_logic;
signal trigger_stb : std_logic;
begin
inst_zedboard_ps : zedboard_ps
port map (
processing_system7_0_MIO => MIO,
processing_system7_0_PS_SRSTB_pin => PS_SRSTB,
processing_system7_0_PS_CLK_pin => PS_CLK,
processing_system7_0_PS_PORB_pin => PS_PORB,
processing_system7_0_DDR_Clk => DDR_Clk,
processing_system7_0_DDR_Clk_n => DDR_Clk_n,
processing_system7_0_DDR_CKE => DDR_CKE,
processing_system7_0_DDR_CS_n => DDR_CS_n,
processing_system7_0_DDR_RAS_n => DDR_RAS_n,
processing_system7_0_DDR_CAS_n => DDR_CAS_n,
processing_system7_0_DDR_WEB_pin => DDR_WEB_pin,
processing_system7_0_DDR_BankAddr => DDR_BankAddr,
processing_system7_0_DDR_Addr => DDR_Addr,
processing_system7_0_DDR_ODT => DDR_ODT,
processing_system7_0_DDR_DRSTB => DDR_DRSTB,
processing_system7_0_DDR_DQ => DDR_DQ,
processing_system7_0_DDR_DM => DDR_DM,
processing_system7_0_DDR_DQS => DDR_DQS,
processing_system7_0_DDR_DQS_n => DDR_DQS_n,
processing_system7_0_DDR_VRN => DDR_VRN,
processing_system7_0_DDR_VRP => DDR_VRP,
axi_ext_slave_conn_0_M_AXI_AWADDR_pin => S_AXI_AWADDR,
axi_ext_slave_conn_0_M_AXI_AWVALID_pin => S_AXI_AWVALID,
axi_ext_slave_conn_0_M_AXI_AWREADY_pin => S_AXI_AWREADY,
axi_ext_slave_conn_0_M_AXI_WDATA_pin => S_AXI_WDATA,
axi_ext_slave_conn_0_M_AXI_WSTRB_pin => S_AXI_WSTRB,
axi_ext_slave_conn_0_M_AXI_WVALID_pin => S_AXI_WVALID,
axi_ext_slave_conn_0_M_AXI_WREADY_pin => S_AXI_WREADY,
axi_ext_slave_conn_0_M_AXI_BRESP_pin => S_AXI_BRESP,
axi_ext_slave_conn_0_M_AXI_BVALID_pin => S_AXI_BVALID,
axi_ext_slave_conn_0_M_AXI_BREADY_pin => S_AXI_BREADY,
axi_ext_slave_conn_0_M_AXI_ARADDR_pin => S_AXI_ARADDR,
axi_ext_slave_conn_0_M_AXI_ARVALID_pin => S_AXI_ARVALID,
axi_ext_slave_conn_0_M_AXI_ARREADY_pin => S_AXI_ARREADY,
axi_ext_slave_conn_0_M_AXI_RDATA_pin => S_AXI_RDATA,
axi_ext_slave_conn_0_M_AXI_RRESP_pin => S_AXI_RRESP,
axi_ext_slave_conn_0_M_AXI_RVALID_pin => S_AXI_RVALID,
axi_ext_slave_conn_0_M_AXI_RREADY_pin => S_AXI_RREADY,
processing_system7_0_IRQ_F2P_pin => processing_system7_0_IRQ_F2P_pin,
processing_system7_0_FCLK_CLK0_pin => clk,
processing_system7_0_FCLK_RESET0_N_pin => rst_n,
axi_ext_master_conn_0_S_AXI_AWADDR_pin => M_AXI_AWADDR,
axi_ext_master_conn_0_S_AXI_AWLEN_pin => M_AXI_AWLEN,
axi_ext_master_conn_0_S_AXI_AWSIZE_pin => M_AXI_AWSIZE,
axi_ext_master_conn_0_S_AXI_AWBURST_pin => M_AXI_AWBURST,
axi_ext_master_conn_0_S_AXI_AWCACHE_pin => M_AXI_AWCACHE,
axi_ext_master_conn_0_S_AXI_AWPROT_pin => M_AXI_AWPROT,
axi_ext_master_conn_0_S_AXI_AWVALID_pin => M_AXI_AWVALID,
axi_ext_master_conn_0_S_AXI_AWREADY_pin => M_AXI_AWREADY,
axi_ext_master_conn_0_S_AXI_WDATA_pin => M_AXI_WDATA,
axi_ext_master_conn_0_S_AXI_WSTRB_pin => M_AXI_WSTRB,
axi_ext_master_conn_0_S_AXI_WLAST_pin => M_AXI_WLAST,
axi_ext_master_conn_0_S_AXI_WVALID_pin => M_AXI_WVALID,
axi_ext_master_conn_0_S_AXI_WREADY_pin => M_AXI_WREADY,
axi_ext_master_conn_0_S_AXI_BRESP_pin => M_AXI_BRESP,
axi_ext_master_conn_0_S_AXI_BVALID_pin => M_AXI_BVALID,
axi_ext_master_conn_0_S_AXI_BREADY_pin => M_AXI_BREADY,
axi_ext_master_conn_0_S_AXI_ARADDR_pin => M_AXI_ARADDR,
axi_ext_master_conn_0_S_AXI_ARLEN_pin => M_AXI_ARLEN,
axi_ext_master_conn_0_S_AXI_ARSIZE_pin => M_AXI_ARSIZE,
axi_ext_master_conn_0_S_AXI_ARBURST_pin => M_AXI_ARBURST,
axi_ext_master_conn_0_S_AXI_ARCACHE_pin => M_AXI_ARCACHE,
axi_ext_master_conn_0_S_AXI_ARPROT_pin => M_AXI_ARPROT,
axi_ext_master_conn_0_S_AXI_ARVALID_pin => M_AXI_ARVALID,
axi_ext_master_conn_0_S_AXI_ARREADY_pin => M_AXI_ARREADY,
axi_ext_master_conn_0_S_AXI_RDATA_pin => M_AXI_RDATA,
axi_ext_master_conn_0_S_AXI_RRESP_pin => M_AXI_RRESP,
axi_ext_master_conn_0_S_AXI_RLAST_pin => M_AXI_RLAST,
axi_ext_master_conn_0_S_AXI_RVALID_pin => M_AXI_RVALID,
axi_ext_master_conn_0_S_AXI_RREADY_pin => M_AXI_RREADY,
axi_ext_master_conn_0_S_AXI_AWUSER_pin => M_AXI_AWUSER,
axi_ext_master_conn_0_S_AXI_ARUSER_pin => M_AXI_ARUSER);
processing_system7_0_IRQ_F2P_pin(15) <= irq;
inst_ps_pl_interface : ps_pl_interface
generic map (
C_BASEADDR => x"40000000",
C_HIGHADDR => x"4001ffff")
port map (
clk => clk,
rst_n => rst_n,
S_AXI_AWADDR => S_AXI_AWADDR,
S_AXI_AWVALID => S_AXI_AWVALID,
S_AXI_AWREADY => S_AXI_AWREADY,
S_AXI_WDATA => S_AXI_WDATA,
S_AXI_WSTRB => S_AXI_WSTRB,
S_AXI_WVALID => S_AXI_WVALID,
S_AXI_WREADY => S_AXI_WREADY,
S_AXI_BRESP => S_AXI_BRESP,
S_AXI_BVALID => S_AXI_BVALID,
S_AXI_BREADY => S_AXI_BREADY,
S_AXI_ARADDR => S_AXI_ARADDR,
S_AXI_ARVALID => S_AXI_ARVALID,
S_AXI_ARREADY => S_AXI_ARREADY,
S_AXI_RDATA => S_AXI_RDATA,
S_AXI_RRESP => S_AXI_RRESP,
S_AXI_RVALID => S_AXI_RVALID,
S_AXI_RREADY => S_AXI_RREADY,
M_AXI_AWADDR => M_AXI_AWADDR,
M_AXI_AWPROT => M_AXI_AWPROT,
M_AXI_AWVALID => M_AXI_AWVALID,
M_AXI_AWREADY => M_AXI_AWREADY,
M_AXI_WDATA => M_AXI_WDATA,
M_AXI_WSTRB => M_AXI_WSTRB,
M_AXI_WVALID => M_AXI_WVALID,
M_AXI_WREADY => M_AXI_WREADY,
M_AXI_BRESP => M_AXI_BRESP,
M_AXI_BVALID => M_AXI_BVALID,
M_AXI_BREADY => M_AXI_BREADY,
M_AXI_AWLEN => M_AXI_AWLEN,
M_AXI_AWSIZE => M_AXI_AWSIZE,
M_AXI_AWBURST => M_AXI_AWBURST,
M_AXI_AWCACHE => M_AXI_AWCACHE,
M_AXI_AWUSER => M_AXI_AWUSER,
M_AXI_WLAST => M_AXI_WLAST,
M_AXI_ARADDR => M_AXI_ARADDR,
M_AXI_ARPROT => M_AXI_ARPROT,
M_AXI_ARVALID => M_AXI_ARVALID,
M_AXI_ARREADY => M_AXI_ARREADY,
M_AXI_RDATA => M_AXI_RDATA,
M_AXI_RRESP => M_AXI_RRESP,
M_AXI_RVALID => M_AXI_RVALID,
M_AXI_RREADY => M_AXI_RREADY,
M_AXI_RLAST => M_AXI_RLAST,
M_AXI_ARCACHE => M_AXI_ARCACHE,
M_AXI_ARUSER => M_AXI_ARUSER,
M_AXI_ARLEN => M_AXI_ARLEN,
M_AXI_ARBURST => M_AXI_ARBURST,
M_AXI_ARSIZE => M_AXI_ARSIZE,
irq => irq,
rst_glb_n => rst_glb_n,
-- Note: Master 0 & Slave 0 interfaces are occupied by the
-- datamover component internally.
axis_master_1_tvalid => axis_master_1_tvalid,
axis_master_1_tready => axis_master_1_tready,
axis_master_1_tdata => axis_master_1_tdata,
axis_master_1_tdest => axis_master_1_tdest,
axis_master_1_tlast => axis_master_1_tlast,
axis_master_1_irq => axis_master_1_irq,
axis_slave_1_tvalid => axis_slave_1_tvalid,
axis_slave_1_tready => axis_slave_1_tready,
axis_slave_1_tdata => axis_slave_1_tdata,
axis_slave_1_tid => axis_slave_1_tid,
axis_slave_1_tlast => axis_slave_1_tlast,
axis_slave_1_irq => axis_slave_1_irq,
status_1_addr => status_1_addr,
status_1_data => status_1_data,
status_1_stb => status_1_stb,
ctrl_1_addr => ctrl_1_addr,
ctrl_1_data => ctrl_1_data,
ctrl_1_stb => ctrl_1_stb,
axis_master_2_tvalid => axis_master_2_tvalid,
axis_master_2_tready => axis_master_2_tready,
axis_master_2_tdata => axis_master_2_tdata,
axis_master_2_tdest => axis_master_2_tdest,
axis_master_2_tlast => axis_master_2_tlast,
axis_master_2_irq => axis_master_2_irq,
axis_slave_2_tvalid => axis_slave_2_tvalid,
axis_slave_2_tready => axis_slave_2_tready,
axis_slave_2_tdata => axis_slave_2_tdata,
axis_slave_2_tid => axis_slave_2_tid,
axis_slave_2_tlast => axis_slave_2_tlast,
axis_slave_2_irq => axis_slave_2_irq,
status_2_addr => status_2_addr,
status_2_data => status_2_data,
status_2_stb => status_2_stb,
ctrl_2_addr => ctrl_2_addr,
ctrl_2_data => ctrl_2_data,
ctrl_2_stb => ctrl_2_stb,
axis_master_3_tvalid => axis_master_3_tvalid,
axis_master_3_tready => axis_master_3_tready,
axis_master_3_tdata => axis_master_3_tdata,
axis_master_3_tdest => axis_master_3_tdest,
axis_master_3_tlast => axis_master_3_tlast,
axis_master_3_irq => axis_master_3_irq,
axis_slave_3_tvalid => axis_slave_3_tvalid,
axis_slave_3_tready => axis_slave_3_tready,
axis_slave_3_tdata => axis_slave_3_tdata,
axis_slave_3_tid => axis_slave_3_tid,
axis_slave_3_tlast => axis_slave_3_tlast,
axis_slave_3_irq => axis_slave_3_irq,
status_3_addr => status_3_addr,
status_3_data => status_3_data,
status_3_stb => status_3_stb,
ctrl_3_addr => ctrl_3_addr,
ctrl_3_data => ctrl_3_data,
ctrl_3_stb => ctrl_3_stb,
axis_master_4_tvalid => axis_master_4_tvalid,
axis_master_4_tready => axis_master_4_tready,
axis_master_4_tdata => axis_master_4_tdata,
axis_master_4_tdest => axis_master_4_tdest,
axis_master_4_tlast => axis_master_4_tlast,
axis_master_4_irq => axis_master_4_irq,
axis_slave_4_tvalid => axis_slave_4_tvalid,
axis_slave_4_tready => axis_slave_4_tready,
axis_slave_4_tdata => axis_slave_4_tdata,
axis_slave_4_tid => axis_slave_4_tid,
axis_slave_4_tlast => axis_slave_4_tlast,
axis_slave_4_irq => axis_slave_4_irq,
status_4_addr => status_4_addr,
status_4_data => status_4_data,
status_4_stb => status_4_stb,
ctrl_4_addr => ctrl_4_addr,
ctrl_4_data => ctrl_4_data,
ctrl_4_stb => ctrl_4_stb,
axis_master_5_tvalid => axis_master_5_tvalid,
axis_master_5_tready => axis_master_5_tready,
axis_master_5_tdata => axis_master_5_tdata,
axis_master_5_tdest => axis_master_5_tdest,
axis_master_5_tlast => axis_master_5_tlast,
axis_master_5_irq => axis_master_5_irq,
axis_slave_5_tvalid => axis_slave_5_tvalid,
axis_slave_5_tready => axis_slave_5_tready,
axis_slave_5_tdata => axis_slave_5_tdata,
axis_slave_5_tid => axis_slave_5_tid,
axis_slave_5_tlast => axis_slave_5_tlast,
axis_slave_5_irq => axis_slave_5_irq,
status_5_addr => status_5_addr,
status_5_data => status_5_data,
status_5_stb => status_5_stb,
ctrl_5_addr => ctrl_5_addr,
ctrl_5_data => ctrl_5_data,
ctrl_5_stb => ctrl_5_stb,
axis_master_6_tvalid => axis_master_6_tvalid,
axis_master_6_tready => axis_master_6_tready,
axis_master_6_tdata => axis_master_6_tdata,
axis_master_6_tdest => axis_master_6_tdest,
axis_master_6_tlast => axis_master_6_tlast,
axis_master_6_irq => axis_master_6_irq,
axis_slave_6_tvalid => axis_slave_6_tvalid,
axis_slave_6_tready => axis_slave_6_tready,
axis_slave_6_tdata => axis_slave_6_tdata,
axis_slave_6_tid => axis_slave_6_tid,
axis_slave_6_tlast => axis_slave_6_tlast,
axis_slave_6_irq => axis_slave_6_irq,
status_6_addr => status_6_addr,
status_6_data => status_6_data,
status_6_stb => status_6_stb,
ctrl_6_addr => ctrl_6_addr,
ctrl_6_data => ctrl_6_data,
ctrl_6_stb => ctrl_6_stb,
axis_master_7_tvalid => axis_master_7_tvalid,
axis_master_7_tready => axis_master_7_tready,
axis_master_7_tdata => axis_master_7_tdata,
axis_master_7_tdest => axis_master_7_tdest,
axis_master_7_tlast => axis_master_7_tlast,
axis_master_7_irq => axis_master_7_irq,
axis_slave_7_tvalid => axis_slave_7_tvalid,
axis_slave_7_tready => axis_slave_7_tready,
axis_slave_7_tdata => axis_slave_7_tdata,
axis_slave_7_tid => axis_slave_7_tid,
axis_slave_7_tlast => axis_slave_7_tlast,
axis_slave_7_irq => axis_slave_7_irq,
status_7_addr => status_7_addr,
status_7_data => status_7_data,
status_7_stb => status_7_stb,
ctrl_7_addr => ctrl_7_addr,
ctrl_7_data => ctrl_7_data,
ctrl_7_stb => ctrl_7_stb);
-- Accelerator 1
inst_usrp_ddr_intf_axis : usrp_ddr_intf_axis
generic map (
DDR_CLOCK_FREQ => 100e6,
BAUD => 115200)
port map (
UART_TX => UART_TX,
RX_DATA_CLK_N => RX_DATA_CLK_N,
RX_DATA_CLK_P => RX_DATA_CLK_P,
RX_DATA_N => RX_DATA_N,
RX_DATA_P => RX_DATA_P,
TX_DATA_N => TX_DATA_N,
TX_DATA_P => TX_DATA_P,
clk => clk,
rst_n => rst_glb_n,
status_addr => status_1_addr,
status_data => status_1_data,
status_stb => status_1_stb,
ctrl_addr => ctrl_1_addr,
ctrl_data => ctrl_1_data,
ctrl_stb => ctrl_1_stb,
axis_slave_tvalid => axis_slave_1_tvalid,
axis_slave_tready => axis_slave_1_tready,
axis_slave_tdata => axis_slave_1_tdata,
axis_slave_tid => axis_slave_1_tid,
axis_slave_tlast => axis_slave_1_tlast,
axis_slave_irq => axis_slave_1_irq,
axis_master_tvalid => axis_master_1_tvalid,
axis_master_tready => axis_master_1_tready,
axis_master_tdata => axis_master_1_tdata,
axis_master_tdest => axis_master_1_tdest,
axis_master_tlast => axis_master_1_tlast,
axis_master_irq => axis_master_1_irq,
rx_enable_aux => rx_enable_aux,
tx_enable_aux => tx_enable_aux);
rx_enable_aux <= '0';
tx_enable_aux <= threshold_exceeded OR threshold_not_exceeded;
-- Accelerator 2
inst_spectrum_sense : spectrum_sense
port map (
clk => clk,
rst_n => rst_glb_n,
status_addr => status_2_addr,
status_data => status_2_data,
status_stb => status_2_stb,
ctrl_addr => ctrl_2_addr,
ctrl_data => ctrl_2_data,
ctrl_stb => ctrl_2_stb,
axis_slave_tvalid => axis_slave_2_tvalid,
axis_slave_tready => axis_slave_2_tready,
axis_slave_tdata => axis_slave_2_tdata,
axis_slave_tid => axis_slave_2_tid,
axis_slave_tlast => axis_slave_2_tlast,
axis_slave_irq => axis_slave_2_irq,
axis_master_tvalid => axis_master_2_tvalid,
axis_master_tready => axis_master_2_tready,
axis_master_tdata => axis_master_2_tdata,
axis_master_tdest => axis_master_2_tdest,
axis_master_tlast => axis_master_2_tlast,
axis_master_irq => axis_master_2_irq,
threshold_not_exceeded => threshold_not_exceeded,
threshold_not_exceeded_stb => threshold_not_exceeded_stb,
threshold_exceeded => threshold_exceeded,
threshold_exceeded_stb => threshold_exceeded_stb);
-- Accelerator 3
inst_bpsk_mod : bpsk_mod
port map (
clk => clk,
rst_n => rst_glb_n,
status_addr => status_3_addr,
status_data => status_3_data,
status_stb => status_3_stb,
ctrl_addr => ctrl_3_addr,
ctrl_data => ctrl_3_data,
ctrl_stb => ctrl_3_stb,
axis_slave_tvalid => axis_slave_3_tvalid,
axis_slave_tready => axis_slave_3_tready,
axis_slave_tdata => axis_slave_3_tdata,
axis_slave_tid => axis_slave_3_tid,
axis_slave_tlast => axis_slave_3_tlast,
axis_slave_irq => axis_slave_3_irq,
axis_master_tvalid => axis_master_3_tvalid,
axis_master_tready => axis_master_3_tready,
axis_master_tdata => axis_master_3_tdata,
axis_master_tdest => axis_master_3_tdest,
axis_master_tlast => axis_master_3_tlast,
axis_master_irq => axis_master_3_irq,
trigger_stb => trigger_stb);
-- The output of either threshold trigger is controlled by control registers, so ORing them is
-- not an issue as only one should be active at a time.
trigger_stb <= threshold_exceeded_stb OR threshold_not_exceeded_stb;
-- Unused Accelerators
axis_slave_4_tready <= '0';
axis_slave_4_irq <= '0';
axis_master_4_tvalid <= '0';
axis_master_4_tdata <= x"0000000000000000";
axis_master_4_tdest <= "000";
axis_master_4_tlast <= '0';
axis_master_4_irq <= '0';
status_4_data <= x"00000000";
axis_slave_5_tready <= '0';
axis_slave_5_irq <= '0';
axis_master_5_tvalid <= '0';
axis_master_5_tdata <= x"0000000000000000";
axis_master_5_tdest <= "000";
axis_master_5_tlast <= '0';
axis_master_5_irq <= '0';
status_5_data <= x"00000000";
axis_slave_6_tready <= '0';
axis_slave_6_irq <= '0';
axis_master_6_tvalid <= '0';
axis_master_6_tdata <= x"0000000000000000";
axis_master_6_tdest <= "000";
axis_master_6_tlast <= '0';
axis_master_6_irq <= '0';
status_6_data <= x"00000000";
axis_slave_7_tready <= '0';
axis_slave_7_irq <= '0';
axis_master_7_tvalid <= '0';
axis_master_7_tdata <= x"0000000000000000";
axis_master_7_tdest <= "000";
axis_master_7_tlast <= '0';
axis_master_7_irq <= '0';
status_7_data <= x"00000000";
SPARE <= 'Z';
end architecture; | gpl-3.0 | 1eba7f977dc49120f63430af84e3d268 | 0.465482 | 3.809094 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/free_queue/vhdl_source/free_queue.vhd | 1 | 11,524 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : free_queue
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: A simple source of free memory blocks. Software provides, hardware uses.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.block_bus_pkg.all;
entity free_queue is
generic (
g_store_size : boolean := true;
g_block_size : natural := 1536 );
port (
clock : in std_logic;
reset : in std_logic;
-- free block interface
alloc_req : in std_logic;
alloc_resp : out t_alloc_resp;
used_req : in t_used_req;
used_resp : out std_logic;
-- io interface for local cpu
io_req : in t_io_req;
io_resp : out t_io_resp;
io_irq : out std_logic );
end entity;
architecture gideon of free_queue is
function iif(c : boolean; t : natural; f : natural) return natural is
begin
if c then return t; else return f; end if;
end function iif;
constant c_mem_width : natural := iif(g_store_size, 20, 8);
type t_state is (idle, calc_offset, calc_addr, allocating, popping);
signal state : t_state;
signal next_state : t_state;
signal alloc_resp_c : t_alloc_resp;
signal alloc_resp_i : t_alloc_resp;
signal offset_c : unsigned(23 downto 0);
signal offset_r : unsigned(offset_c'range);
signal used_head : unsigned(6 downto 0);
signal used_tail : unsigned(6 downto 0);
signal free_head : unsigned(6 downto 0);
signal free_tail : unsigned(6 downto 0);
signal used_head_next : unsigned(6 downto 0);
signal used_tail_next : unsigned(6 downto 0);
signal free_head_next : unsigned(6 downto 0);
signal free_tail_next : unsigned(6 downto 0);
signal table_addr : unsigned(7 downto 0);
signal table_rdata : std_logic_vector(19 downto 0) := (others => '0');
signal table_wdata : std_logic_vector(19 downto 0) := (others => '0');
signal table_en : std_logic;
signal table_we : std_logic;
signal sw_insert : std_logic;
signal sw_done : std_logic;
signal sw_addr : std_logic_vector(25 downto 0) := (others => '0');
signal sw_id : std_logic_vector(7 downto 0) := (others => '0');
signal sw_pop : std_logic;
signal sw_pop_valid : std_logic;
signal sw_pop_id : std_logic_vector(7 downto 0) := (others => '0');
signal sw_pop_size : std_logic_vector(11 downto 0) := (others => '0');
signal used_valid : std_logic;
signal soft_reset : std_logic;
signal free_full : std_logic;
begin
io_irq <= used_valid;
process(clock)
alias local_addr : unsigned(3 downto 0) is io_req.address(3 downto 0);
begin
if rising_edge(clock) then
io_resp <= c_io_resp_init;
if sw_done = '1' then
sw_insert <= '0';
sw_pop <= '0';
end if;
-- fall through logic
if used_valid = '0' then
if sw_pop_valid = '1' then
sw_pop_id <= table_rdata(7 downto 0);
if g_store_size then
sw_pop_size <= table_rdata(19 downto 8);
end if;
used_valid <= '1';
sw_pop <= '0';
end if;
if (used_head /= used_tail) and sw_pop = '0' then
sw_pop <= '1';
end if;
end if;
soft_reset <= '0';
if io_req.write = '1' then
io_resp.ack <= '1';
case local_addr is
when X"0" =>
null;
when X"1" =>
sw_addr(15 downto 8) <= io_req.data;
when X"2" =>
sw_addr(23 downto 16) <= io_req.data;
when X"3" =>
sw_addr(25 downto 24) <= io_req.data(1 downto 0);
when X"4" => -- free / insert
sw_id <= io_req.data;
sw_insert <= '1';
when X"F" =>
used_valid <= '0';
when X"E" =>
soft_reset <= '1';
when others =>
null;
end case;
end if;
if io_req.read = '1' then
io_resp.ack <= '1';
case local_addr is
-- when X"0" =>
-- io_resp.data <= '0' & std_logic_vector(used_head);
-- when X"1" =>
-- io_resp.data <= '0' & std_logic_vector(used_tail);
-- when X"2" =>
-- io_resp.data <= '0' & std_logic_vector(free_head);
-- when X"3" =>
-- io_resp.data <= '0' & std_logic_vector(free_tail);
when X"4" =>
io_resp.data(0) <= sw_insert;
io_resp.data(1) <= free_full;
when X"8" =>
io_resp.data <= sw_pop_id;
when X"A" =>
io_resp.data <= sw_pop_size(7 downto 0);
when X"B" =>
io_resp.data <= X"0" & sw_pop_size(11 downto 8);
when X"F" =>
io_resp.data(0) <= used_valid;
when others =>
null;
end case;
end if;
if reset = '1' then
sw_insert <= '0';
sw_pop <= '0';
used_valid <= '0';
end if;
end if;
end process;
-- Important note:
-- This 'RAM' makes up two small FIFOs, so there are four pointers and two areas.
-- One area is for free blocks; the other for allocated blocks. Number of free
-- blocks is now limited to 128.
i_table: entity work.spram
generic map (
g_width_bits => c_mem_width,
g_depth_bits => 8,
g_read_first => true
)
port map (
clock => clock,
address => table_addr,
rdata => table_rdata(c_mem_width-1 downto 0),
wdata => table_wdata(c_mem_width-1 downto 0),
en => table_en,
we => table_we
);
-- i_table: entity work.spram_freequeue
-- port map (
-- address => std_logic_vector(table_addr),
-- clock => clock,
-- data => table_wdata(c_mem_width-1 downto 0),
-- rden => table_en,
-- wren => table_we,
-- q => table_rdata(c_mem_width-1 downto 0)
-- );
alloc_resp <= alloc_resp_i;
process(alloc_req, alloc_resp_i, state, sw_insert, sw_pop, sw_id, sw_addr, used_req,
free_head, free_tail, used_head, used_tail, offset_r, table_rdata, free_full)
begin
next_state <= state;
alloc_resp_c <= alloc_resp_i;
table_addr <= (others => 'X');
table_wdata <= (others => '0');
table_we <= '0';
table_en <= '0';
free_head_next <= free_head;
free_tail_next <= free_tail;
used_head_next <= used_head;
used_tail_next <= used_tail;
used_resp <= '0';
sw_done <= '0';
sw_pop_valid <= '0';
alloc_resp_c.done <= '0';
offset_c <= offset_r;
if g_store_size then
table_wdata(19 downto 8) <= std_logic_vector(used_req.bytes);
end if;
if (free_head + 1) = free_tail then
free_full <= '1';
else
free_full <= '0';
end if;
case state is
when idle =>
if sw_insert = '1' then
-- Push into Free area
table_addr <= '0' & free_head;
table_wdata(7 downto 0) <= sw_id;
if free_full = '0' then
table_we <= '1';
table_en <= '1';
free_head_next <= free_head + 1;
end if;
sw_done <= '1';
elsif used_req.request = '1' then
-- Push into Used Area
table_addr <= '1' & used_head;
table_wdata(7 downto 0) <= std_logic_vector(used_req.id);
table_we <= '1';
table_en <= '1';
used_resp <= '1';
used_head_next <= used_head + 1;
elsif alloc_req = '1' and alloc_resp_i.done = '0' then
-- Pop from Free area
table_addr <= '0' & free_tail;
table_en <= '1';
if free_tail = free_head then
alloc_resp_c.error <= '1';
alloc_resp_c.done <= '1';
else
next_state <= allocating;
end if;
elsif sw_pop = '1' then
-- Pop from Used area
table_addr <= '1' & used_tail;
table_en <= '1';
if used_tail /= used_head then
next_state <= popping;
end if;
end if;
when allocating =>
free_tail_next <= free_tail + 1;
alloc_resp_c.id <= unsigned(table_rdata(7 downto 0));
next_state <= calc_offset;
when calc_offset =>
offset_c <= to_unsigned(g_block_size, 16) * alloc_resp_i.id;
next_state <= calc_addr;
when calc_addr =>
alloc_resp_c.address <= unsigned(sw_addr) + offset_r;
alloc_resp_c.done <= '1';
alloc_resp_c.error <= '0';
next_state <= idle;
when popping =>
used_tail_next <= used_tail + 1;
sw_pop_valid <= '1';
next_state <= idle;
end case;
end process;
process(clock)
begin
if rising_edge(clock) then
alloc_resp_i <= alloc_resp_c;
offset_r <= offset_c;
free_tail <= free_tail_next;
free_head <= free_head_next;
used_tail <= used_tail_next;
used_head <= used_head_next;
state <= next_state;
if reset = '1' or soft_reset = '1' then
state <= idle;
alloc_resp_i <= c_alloc_resp_init;
used_tail <= (others => '0');
used_head <= (others => '0');
free_tail <= (others => '0');
free_head <= (others => '0');
end if;
end if;
end process;
end architecture;
-- WAS: free_queue 287 (110) 193 (71) 0 (0) 8704 3 0 0 0 100 0 94 (35) 36 (9) 157 (65)
-- ID: free_queue 182 (181) 121 (121) 0 (0) 2048 1 0 0 0 101 0 61 (60) 24 (24) 97 (97)
-- ID+SIZE: free_queue 196 (195) 133 (133) 0 (0) 5120 1 0 0 0 101 0 63 (62) 32 (32) 101 (101)
-- size: only 14 cells more!
| gpl-3.0 | f1d502ff9d2ce1c5337996867376f8e0 | 0.439431 | 3.772177 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_source/floppy_stream.vhd | 1 | 10,007 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2006, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Floppy Emulator
-------------------------------------------------------------------------------
-- File : floppy_stream.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: This module implements the emulator of the floppy drive.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
--library work;
--use work.floppy_emu_pkg.all;
entity floppy_stream is
port (
clock : in std_logic;
reset : in std_logic;
tick_16MHz : in std_logic;
-- data from memory
mem_rdata : in std_logic_vector(7 downto 0);
do_read : out std_logic;
do_write : out std_logic;
do_advance : out std_logic;
-- info about the head
track : out unsigned(6 downto 0);
track_is_0 : out std_logic;
do_head_bang : out std_logic;
do_track_out : out std_logic;
do_track_in : out std_logic;
-- control i/o
floppy_inserted : in std_logic;
stepper_en : in std_logic;
motor_on : in std_logic;
sync : out std_logic;
mode : in std_logic;
write_prot_n : in std_logic;
step : in std_logic_vector(1 downto 0);
byte_ready : out std_logic;
rate_ctrl : in std_logic_vector(1 downto 0);
bit_time : in unsigned(9 downto 0); -- in steps of 10 ns
-- data to drive CPU
read_data : out std_logic_vector(7 downto 0) );
end floppy_stream;
architecture gideon of floppy_stream is
signal bit_tick : std_logic;
signal bit_timer : unsigned(8 downto 0);
signal bit_carry : std_logic;
signal mem_bit_cnt : unsigned(2 downto 0);
signal rd_bit_cnt : unsigned(2 downto 0) := "000";
signal mem_shift : std_logic_vector(7 downto 0);
signal rd_shift : std_logic_vector(9 downto 0) := (others => '0');
signal sync_i : std_logic;
signal byte_rdy_i : std_logic_vector(3 downto 0);
alias mem_rd_bit : std_logic is mem_shift(7);
signal track_i : unsigned(6 downto 0);
signal mode_d : std_logic;
signal write_delay : integer range 0 to 3;
signal random_bit : std_logic;
signal byte_ready_cnt : natural range 0 to 127 := 0;
-- resample
signal transition_pulse : std_logic;
signal cnt16 : unsigned(3 downto 0);
signal sampl : unsigned(3 downto 0);
signal rd_shift_pulse : std_logic;
signal rd_shift_data : std_logic;
signal rd_shift_phase : std_logic;
signal rd_shift_phase_d : std_logic;
-- weak bit implementation
signal random_data : std_logic_vector(15 downto 0);
signal random_trans : std_logic;
begin
p_clock_div: process(clock)
begin
if rising_edge(clock) then
bit_tick <= '0';
if bit_timer = 0 then
bit_tick <= motor_on;
bit_carry <= not bit_carry and bit_time(0); -- toggle if bit 0 is set
if bit_carry='1' then
bit_timer <= bit_time(9 downto 1);
else
bit_timer <= bit_time(9 downto 1) - 1;
end if;
else
bit_timer <= bit_timer - 1;
end if;
if reset='1' then
bit_timer <= to_unsigned(10, bit_timer'length);
bit_carry <= '0';
end if;
end if;
end process;
i_noise: entity work.noise_generator
generic map (
g_type => "Galois",
g_polynom => X"1020",
g_seed => X"569A"
)
port map (
clock => clock,
enable => tick_16MHz,
reset => reset,
q => random_data );
-- stream from memory
p_stream: process(clock)
variable history : std_logic_vector(4 downto 0) := "11111";
begin
if rising_edge(clock) then
do_read <= '0';
if bit_tick='1' then
random_bit <= '0';
history := history(3 downto 0) & mem_rd_bit;
if history = "00000" then -- something weird can happen now:
random_bit <= '1'; --random_data(2) and random_data(7) and random_data(11) and random_data(12); -- 1/16
end if;
mem_bit_cnt <= mem_bit_cnt + 1;
if mem_bit_cnt="000" then
mem_shift <= mem_rdata;
do_read <= mode; --'1'; does not pulse when in write mode
else
mem_shift <= mem_shift(6 downto 0) & '1';
end if;
end if;
if reset='1' then
mem_shift <= (others => '1');
mem_bit_cnt <= "000";
random_bit <= '0';
end if;
end if;
end process;
-- Pulse from the floppy (a one-clock pulse that happens only when data is '1')
random_trans <= '1' when random_data(10 downto 0) = "10010010101" else '0';
-- These pulses only in read mode
transition_pulse <= mode and ((bit_tick and mem_rd_bit) or (random_trans and random_bit));
p_resample: process(clock)
begin
if rising_edge(clock) then
if transition_pulse = '1' or reset = '1' then
cnt16 <= "00" & unsigned(rate_ctrl);
elsif tick_16MHz = '1' then
if cnt16 = X"F" then
cnt16 <= "00" & unsigned(rate_ctrl);
else
cnt16 <= cnt16 + 1;
end if;
end if;
rd_shift_pulse <= '0';
if transition_pulse = '1' or reset = '1' then
sampl <= (others => '0');
elsif tick_16MHz = '1' and cnt16 = X"F" then
if sampl(1 downto 0) = "01" then
rd_shift_pulse <= '1';
end if;
sampl <= sampl + 1;
end if;
end if;
end process;
rd_shift_data <= sampl(3) nor sampl(2);
rd_shift_phase <= not sampl(1);
-- parallelize stream and generate sync
-- and handle writes
p_reading: process(clock)
variable s : std_logic;
begin
if rising_edge(clock) then
if rd_shift = "1111111111" and mode='1' then
s := '0';
else
s := '1';
end if;
sync_i <= s;
do_advance <= '0';
do_write <= '0';
mode_d <= mode;
if mode_d='1' and mode='0' then -- going to write
write_delay <= 1;
-- do_advance <= '1';
end if;
if rd_shift_pulse = '1' then
rd_shift <= rd_shift(8 downto 0) & rd_shift_data;
rd_bit_cnt <= rd_bit_cnt + 1;
end if;
if s = '0' then
rd_bit_cnt <= "000";
end if;
rd_shift_phase_d <= rd_shift_phase;
if (rd_bit_cnt="111") and (rd_shift_phase='1') and (rd_shift_phase_d='0') then
byte_ready <= '0';
byte_ready_cnt <= 127; -- 8 us!
if mode = '0' then -- if writing
if write_delay = 0 then
if write_prot_n = '1' and floppy_inserted = '1' then
do_write <= '1';
else
do_advance <= '1';
end if;
else
write_delay <= write_delay - 1;
do_advance <= '1';
end if;
end if;
elsif byte_ready_cnt = 0 then
byte_ready <= '1';
elsif tick_16MHz = '1' then
byte_ready_cnt <= byte_ready_cnt - 1;
end if;
end if;
end process;
p_move: process(clock)
variable st : std_logic_vector(3 downto 0);
begin
if rising_edge(clock) then
do_track_in <= '0';
do_track_out <= '0';
do_head_bang <= '0';
if stepper_en='1' then
st := std_logic_vector(track_i(1 downto 0)) & step;
case st is
when "0001" | "0110" | "1011" | "1100" => -- up
do_track_in <= '1';
if track_i /= 83 then
track_i <= track_i + 1;
end if;
when "0011" | "0100" | "1001" | "1110" => -- down
do_track_out <= '1';
if track_i /= 0 then
track_i <= track_i - 1;
end if;
when others =>
null;
end case;
end if;
if reset='1' then
track_i <= "0000000";
end if;
end if;
end process;
-- outputs
sync <= sync_i;
read_data <= rd_shift(7 downto 0);
-- byte_ready <= byte_rdy_i;
track <= track_i;
track_is_0 <= '1' when track_i = "0000000" else '0';
end gideon;
| gpl-3.0 | 5ef21b8ccbc7e670ac8201d15e59e064 | 0.426402 | 4.087827 | false | false | false | false |
xiadz/oscilloscope | src/trace_pixgen.vhd | 1 | 6,938 | ----------------------------------------------------------------------------------
-- Author: Osowski Marcin
-- Create Date: 20:16:43 05/22/2011
----------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.types.all;
entity trace_pixgen is
port (
nrst : in std_logic;
clk108 : in std_logic;
segment : in integer range 0 to 15;
segment_change : in std_logic;
subsegment : in integer range 0 to 3;
subsegment_change : in std_logic;
line : in integer range 0 to 15;
line_change : in std_logic;
column : in integer range 0 to 1279;
column_change : in std_logic;
page_change : in std_logic;
active_pixgen_source : in PIXGEN_SOURCE_T;
currently_read_screen_segment : in natural range 0 to 13;
currently_read_screen_column : in natural range 0 to 1279;
time_resolution : in integer range 0 to 15;
is_reading_active : in std_logic;
doutb : in std_logic_vector (8 downto 0);
addrb : out std_logic_vector (12 downto 0);
vout : out std_logic_vector (7 downto 0)
);
end trace_pixgen;
architecture behavioral of trace_pixgen is
signal position_div_3 : integer range 0 to 5973;
signal position_mod_3 : integer range 0 to 2;
signal delayed_active_pixgen_source : PIXGEN_SOURCE_T;
signal delayed_subsegment : integer range 0 to 3;
signal delayed_position_mod_3 : integer range 0 to 2;
signal delayed_line : integer range 0 to 15;
signal position_div_3_on_beginning_segment : integer range 0 to 5973;
signal position_mod_3_on_beginning_segment : integer range 0 to 2;
signal currently_inside_reading_zone : std_logic;
begin
-- Computing current position
process (nrst, clk108, position_mod_3, position_div_3) is
variable incremented_position_div_3 : integer range 0 to 5973;
variable incremented_position_mod_3 : integer range 0 to 2;
begin
if position_mod_3 = 2 then
incremented_position_div_3 := position_div_3 + 1;
incremented_position_mod_3 := 0;
else
incremented_position_div_3 := position_div_3;
incremented_position_mod_3 := position_mod_3 + 1;
end if;
if nrst = '0' then
position_div_3 <= 0;
position_mod_3 <= 0;
currently_inside_reading_zone <= '0';
elsif rising_edge (clk108) then
if currently_read_screen_segment = 0 and currently_read_screen_column = 0 then
currently_inside_reading_zone <= '0';
else
if time_resolution >= 10 or is_reading_active = '0' then
if segment = currently_read_screen_segment and
column - currently_read_screen_column < 6 and
column - currently_read_screen_column >= 0 then
currently_inside_reading_zone <= '1';
else
currently_inside_reading_zone <= '0';
end if;
elsif time_resolution >= 7 then
if segment = currently_read_screen_segment then
currently_inside_reading_zone <= '1';
else
currently_inside_reading_zone <= '0';
end if;
else
currently_inside_reading_zone <= '0';
end if;
end if;
if active_pixgen_source = TRACE_PIXGEN_T then
if page_change = '1' then
position_div_3 <= 0;
position_mod_3 <= 0;
position_div_3_on_beginning_segment <= 0;
position_mod_3_on_beginning_segment <= 0;
elsif segment_change = '1' then
position_div_3 <= incremented_position_div_3;
position_mod_3 <= incremented_position_mod_3;
position_div_3_on_beginning_segment <= incremented_position_div_3;
position_mod_3_on_beginning_segment <= incremented_position_mod_3;
elsif line_change = '1' then
position_div_3 <= position_div_3_on_beginning_segment;
position_mod_3 <= position_mod_3_on_beginning_segment;
else
position_div_3 <= incremented_position_div_3;
position_mod_3 <= incremented_position_mod_3;
end if;
end if;
end if;
end process;
addrb <= std_logic_vector (to_unsigned (position_div_3, 13));
delayed_active_pixgen_source <= active_pixgen_source when rising_edge (clk108);
delayed_subsegment <= subsegment when rising_edge (clk108);
delayed_position_mod_3 <= position_mod_3 when rising_edge (clk108);
delayed_line <= line when rising_edge (clk108);
process (nrst, delayed_active_pixgen_source, delayed_subsegment, delayed_position_mod_3, delayed_line, currently_inside_reading_zone) is
begin
if nrst = '0' or delayed_active_pixgen_source /= TRACE_PIXGEN_T then
vout <= "00000000";
else
if currently_inside_reading_zone = '1' then
vout <= "10010010";
elsif delayed_subsegment = 0 then
-- red
if delayed_line = 15 then
vout <= "11100000";
elsif doutb (3 * delayed_position_mod_3) = '1' then
vout <= "11100000";
else
vout <= "00000000";
end if;
elsif delayed_subsegment = 1 then
-- green
if delayed_line = 15 then
vout <= "00011100";
elsif doutb (3 * delayed_position_mod_3 + 1) = '1' then
vout <= "00011100";
else
vout <= "00000000";
end if;
elsif delayed_subsegment = 2 then
-- blue
if delayed_line = 15 then
vout <= "00000011";
elsif doutb (3 * delayed_position_mod_3 + 2) = '1' then
vout <= "00000011";
else
vout <= "00000000";
end if;
else
vout <= "00000000";
end if;
end if;
end process;
end behavioral;
| mit | 11704b7fe0667571f34e78f86dbac012 | 0.493082 | 4.543549 | false | false | false | false |
fpgaddicted/5bit-shift-register-structural- | debounce.vhd | 1 | 1,785 | ----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 19:37:54 04/11/2017
-- Design Name:
-- Module Name: debounce - logic
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
ENTITY debounce IS
GENERIC(
counter_size : INTEGER := 20); --counter size (19 bits gives 10.5ms with 50MHz clock)
PORT(
clk : IN STD_LOGIC; --input clock
button : IN STD_LOGIC; --input signal to be debounced
result : OUT STD_LOGIC); --debounced signal
END debounce;
ARCHITECTURE logic OF debounce IS
SIGNAL flipflops : STD_LOGIC_VECTOR(1 DOWNTO 0); --input flip flops
SIGNAL counter_set : STD_LOGIC; --sync reset to zero
SIGNAL counter_out : STD_LOGIC_VECTOR(counter_size DOWNTO 0) := (OTHERS => '0'); --counter output
BEGIN
counter_set <= flipflops(0) xor flipflops(1); --determine when to start/reset counter
PROCESS(clk)
BEGIN
IF(clk'EVENT and clk = '1') THEN
flipflops(0) <= button;
flipflops(1) <= flipflops(0);
If(counter_set = '1') THEN --reset counter because input is changing
counter_out <= (OTHERS => '0');
ELSIF(counter_out(counter_size) = '0') THEN --stable input time is not yet met
counter_out <= counter_out + 1;
ELSE --stable input time is met
result <= flipflops(1);
END IF;
END IF;
END PROCESS;
END logic; | gpl-3.0 | e8e6e736783a9d638b80ec77bb2e6b5a | 0.546218 | 3.949115 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/extender/vhdl_source/extender_u64.vhd | 1 | 5,623 | --------------------------------------------------------------------------------
-- Entity: extender
-- Date:2017-04-22
-- Author: Gideon
--
-- Description: This unit is meant to fit in an external PLD for I/O extension
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity extender_u64 is
port (
reset_n : in std_logic;
data : inout std_logic_vector(7 downto 0);
read : in std_logic;
write : in std_logic;
address : in unsigned(2 downto 0);
cia1_pa : inout std_logic_vector(7 downto 0);
cia1_pb : inout std_logic_vector(7 downto 0);
cia2_pa : inout std_logic_vector(7 downto 0);
cia2_pb : inout std_logic_vector(7 downto 0);
lightpen : out std_logic
);
end entity;
architecture arch of extender_u64 is
signal cia1_pa_t : std_logic_vector(7 downto 0) := (others => '0');
signal cia1_pa_o : std_logic_vector(7 downto 0) := (others => '0');
signal cia1_pb_t : std_logic_vector(7 downto 0) := (others => '0');
signal cia1_pb_o : std_logic_vector(7 downto 0) := (others => '0');
signal cia2_pa_t : std_logic_vector(7 downto 0) := (others => '0');
signal cia2_pa_o : std_logic_vector(7 downto 0) := (others => '0');
signal cia2_pb_t : std_logic_vector(7 downto 0) := (others => '0');
signal cia2_pb_o : std_logic_vector(7 downto 0) := (others => '0');
signal read_data : std_logic_vector(7 downto 0);
signal read_2pa : std_logic_vector(7 downto 0);
begin
-- CIA1 Port A and B have pull ups on the board (joy / keyboard: read pin)
-- CIA2 Port A:
-- 0: VA14 (should read '1' when input, else read output)
-- 1: VA15 (should read '1' when input, else read output)
-- 2: UserPort pin (needs pull up), read actual pin
-- 3: ATN Out (should read '1' when input, else read output)
-- 4: CLOCK Out (should read '1' when input, else read output)
-- 5: DATA Out (should read '1' when input, else read output)
-- 6: CLOCK In - connected to CLK pin of IEC bus, reads the correct value
-- 7: DATA In - connected to DATA pin of IEC bus, reads the correct value
-- CIA2 Port B:
-- 0: UserPort pin (needs pull up, read pin)
-- 1: UserPort pin (needs pull up, read pin)
-- 2: UserPort pin (needs pull up, read pin)
-- 3: UserPort pin (needs pull up, read pin)
-- 4: UserPort pin (needs pull up, read pin)
-- 5: UserPort pin (needs pull up, read pin)
-- 6: UserPort pin (needs pull up, read pin)
-- 7: UserPort pin (needs pull up, read pin)
read_2pa(0) <= cia2_pa_o(0) or not cia2_pa_t(0);
read_2pa(1) <= cia2_pa_o(1) or not cia2_pa_t(1);
read_2pa(2) <= cia2_pa(2);
read_2pa(3) <= cia2_pa_o(3) or not cia2_pa_t(3);
read_2pa(4) <= cia2_pa_o(4) or not cia2_pa_t(4);
read_2pa(5) <= cia2_pa_o(5) or not cia2_pa_t(5);
read_2pa(6) <= cia2_pa(6);
read_2pa(7) <= cia2_pa(7);
process(cia1_pa, cia1_pb, cia2_pa, read_2pa, address)
begin
case address is
when "000" =>
read_data <= cia1_pa;
when "001" =>
read_data <= cia1_pb;
-- when "010" =>
-- read_data <= cia1_pa_t;
-- when "011" =>
-- read_data <= cia1_pb_t;
when "100" =>
read_data <= read_2pa;
when "101" =>
read_data <= cia2_pa;
-- when "110" =>
-- read_data <= cia2_pa_t;
-- when "111" =>
-- read_data <= cia2_pb_t;
when others =>
read_data <= X"FF";
end case;
end process;
data <= read_data when read = '0' else "ZZZZZZZZ";
process(write, reset_n)
begin
if reset_n = '0' then
cia1_pa_t <= (others => '0');
cia1_pa_o <= (others => '0');
cia1_pb_t <= (others => '0');
cia1_pb_o <= (others => '0');
cia2_pa_t <= (others => '0');
cia2_pa_o <= (others => '0');
cia2_pb_t <= (others => '0');
cia2_pb_o <= (others => '0');
elsif rising_edge(write) then
case address is
when "000" => -- CIA1 PA
cia1_pa_o <= data;
when "001" => -- CIA1 PB
cia1_pb_o <= data;
when "010" => -- CIA1 PA DDR
cia1_pa_t <= data;
when "011" => -- CIA1 PB DDR
cia1_pb_t(5 downto 0) <= data(5 downto 0); -- we never drive the B ports, bit 6 and 7, the FPGA does
when "100" => -- CIA2 PA
cia2_pa_o <= data;
when "101" => -- CIA2 PB
cia2_pb_o <= data;
when "110" => -- CIA2 PA DDR
cia2_pa_t <= data;
when "111" => -- CIA2 PB DDR
cia2_pb_t(5 downto 0) <= data(5 downto 0); -- we never drive the B ports, bit 6 and 7, the FPGA does
when others =>
null;
end case;
end if;
end process;
r1: for i in 0 to 7 generate
cia1_pa(i) <= '0' when cia1_pa_o(i) = '0' and cia1_pa_t(i) = '1' else 'Z';
cia1_pb(i) <= '0' when cia1_pb_o(i) = '0' and cia1_pb_t(i) = '1' else 'Z';
end generate;
-- cia2_pa <= "ZZZZZZZZ";
cia2_pb <= "ZZZZZZZZ";
r2: for i in 0 to 7 generate
cia2_pa(i) <= cia2_pa_o(i) when cia2_pa_t(i) = '1' else 'Z';
-- cia2_pb(i) <= '0' when cia2_pb_o(i) = '0' and cia2_pb_t(i) = '1' else 'Z';
end generate;
lightpen <= cia1_pb(4);
end architecture;
| gpl-3.0 | 3e49637ecd9d3050a5610ebf1b00aa4d | 0.503112 | 3.08956 | false | false | false | false |
chiggs/nvc | test/parse/bitstring.vhd | 3 | 307 | package bitstring is
constant x : t := X"1234";
constant y : t := O"1234";
constant z : t := X"ab";
constant b : t := B"101";
constant c : t := x"f";
constant d : t := X"a_b";
end package;
package bitstring_error is
constant e1 : t := O"9"; -- Error
end package;
| gpl-3.0 | 51f533ca447dbf788827dc1a91feef9c | 0.52443 | 3.10101 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cart_slot/vhdl_source/slot_timing.vhd | 1 | 5,804 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity slot_timing is
port (
clock : in std_logic;
reset : in std_logic;
-- Cartridge pins
PHI2 : in std_logic;
BA : in std_logic;
serve_vic : in std_logic;
serve_enable : in std_logic;
serve_inhibit : in std_logic;
timing_addr : in unsigned(2 downto 0) := "000";
edge_recover : in std_logic;
allow_serve : out std_logic;
phi2_tick : out std_logic;
phi2_fall : out std_logic;
phi2_recovered : out std_logic;
clock_det : out std_logic;
vic_cycle : out std_logic;
inhibit : out std_logic;
do_sample_addr : out std_logic;
do_probe_end : out std_logic;
do_sample_io : out std_logic;
do_io_event : out std_logic );
end slot_timing;
architecture gideon of slot_timing is
signal phi2_c : std_logic;
signal phi2_d : std_logic;
signal ba_c : std_logic;
signal phase_h : integer range 0 to 63 := 0;
signal phase_l : integer range 0 to 63 := 0;
signal allow_tick_h : boolean := true;
signal allow_tick_l : boolean := true;
signal phi2_falling : std_logic;
signal ba_hist : std_logic_vector(3 downto 0) := (others => '0');
signal phi2_rec_i : std_logic := '0';
signal phi2_tick_i : std_logic;
signal serve_en_i : std_logic := '0';
signal off_cnt : integer range 0 to 7;
constant c_memdelay : integer := 5;
constant c_sample : integer := 6;
constant c_probe_end : integer := 11;
constant c_sample_vic : integer := 10;
constant c_io : integer := 19;
attribute register_duplication : string;
attribute register_duplication of ba_c : signal is "no";
attribute register_duplication of phi2_c : signal is "no";
begin
vic_cycle <= '1' when (ba_hist = "0000") else '0';
phi2_recovered <= phi2_rec_i;
phi2_tick <= phi2_tick_i;
phi2_fall <= phi2_d and not phi2_c;
process(clock)
begin
if rising_edge(clock) then
ba_c <= BA;
phi2_c <= PHI2;
phi2_d <= phi2_c;
phi2_tick_i <= '0';
-- Off counter, to allow software to gracefully quit
if serve_enable='1' and serve_inhibit='0' then
off_cnt <= 7;
serve_en_i <= '1';
elsif off_cnt = 0 then
serve_en_i <= '0';
elsif phi2_tick_i='1' and ba_c='1' then
off_cnt <= off_cnt - 1;
serve_en_i <= '1';
end if;
-- if (phi2_rec_i='0' and allow_tick_h) or
-- (phi2_rec_i='1' and allow_tick_l) then
-- phi2_rec_i <= PHI2;
-- end if;
-- related to rising edge
-- if then -- rising edge
if ((edge_recover = '1') and (phase_l = 24)) or
((edge_recover = '0') and phi2_d='0' and phi2_c='1' and allow_tick_h) then
ba_hist <= ba_hist(2 downto 0) & ba_c;
phi2_tick_i <= '1';
phi2_rec_i <= '1';
phase_h <= 0;
clock_det <= '1';
allow_tick_h <= false; -- filter
elsif phase_h = 63 then
clock_det <= '0';
else
phase_h <= phase_h + 1;
end if;
if phase_h = 46 then -- max 1.06 MHz
allow_tick_h <= true;
end if;
-- related to falling edge
phi2_falling <= '0';
if phi2_d='1' and phi2_c='0' and allow_tick_l then -- falling edge
phi2_falling <= '1';
phi2_rec_i <= '0';
phase_l <= 0;
allow_tick_l <= false; -- filter
elsif phase_l /= 63 then
phase_l <= phase_l + 1;
end if;
if phase_l = 46 then -- max 1.06 MHz
allow_tick_l <= true;
end if;
do_io_event <= phi2_falling;
-- timing pulses
if phase_h = 0 then
inhibit <= serve_en_i;
elsif phase_h = c_sample then
inhibit <= '0';
end if;
do_sample_addr <= '0';
if phase_h = timing_addr then
do_sample_addr <= '1';
end if;
do_probe_end <= '0';
if phase_h = c_probe_end then
do_probe_end <= '1';
end if;
if serve_vic='1' then
if phase_l = (c_sample_vic - c_memdelay) then
inhibit <= serve_en_i;
elsif phase_l = (c_sample_vic - 1) then
do_sample_addr <= '1';
end if;
end if;
if phase_l = c_sample_vic then
inhibit <= '0';
end if;
do_sample_io <= '0';
if phase_h = c_io - 1 then
do_sample_io <= '1';
end if;
if reset='1' then
allow_tick_h <= true;
allow_tick_l <= true;
phase_h <= 63;
phase_l <= 63;
inhibit <= '0';
clock_det <= '0';
end if;
end if;
end process;
allow_serve <= serve_en_i;
end gideon;
| gpl-3.0 | 7d9165d4bf67dffe135751f44a507b73 | 0.429187 | 3.710997 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/busses/vhdl_source/slot_bus_pkg.vhd | 1 | 2,502 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package slot_bus_pkg is
type t_slot_req is record
bus_address : unsigned(15 downto 0); -- for async reads and direct bus writes
bus_rwn : std_logic; -- for async reads and writes
bus_write : std_logic; -- Qualified write condition after setup
io_address : unsigned(15 downto 0); -- for late reads/writes
io_read : std_logic;
io_read_early : std_logic;
io_write : std_logic;
late_write : std_logic;
data : std_logic_vector(7 downto 0);
rom_access : std_logic; -- synchronized version of ROML and ROMH combined
sample_io : std_logic; -- timing signal, pulses when IO lines and address should be stable
end record;
type t_slot_resp is record
data : std_logic_vector(7 downto 0);
reg_output : std_logic;
irq : std_logic;
nmi : std_logic;
end record;
constant c_slot_req_init : t_slot_req := (
bus_address => X"0000",
bus_rwn => '1',
bus_write => '0',
io_read_early => '0',
io_address => X"0000",
io_read => '0',
io_write => '0',
late_write => '0',
rom_access => '0',
sample_io => '0',
data => X"00" );
constant c_slot_resp_init : t_slot_resp := (
data => X"00",
reg_output => '0',
irq => '0',
nmi => '0' );
type t_slot_req_array is array(natural range <>) of t_slot_req;
type t_slot_resp_array is array(natural range <>) of t_slot_resp;
function or_reduce(ar: t_slot_resp_array) return t_slot_resp;
end package;
package body slot_bus_pkg is
function or_reduce(ar: t_slot_resp_array) return t_slot_resp is
variable ret : t_slot_resp;
begin
ret := c_slot_resp_init;
for i in ar'range loop
ret.reg_output := ret.reg_output or ar(i).reg_output;
if ar(i).reg_output='1' then
ret.data := ret.data or ar(i).data;
end if;
ret.irq := ret.irq or ar(i).irq;
ret.nmi := ret.nmi or ar(i).nmi;
end loop;
return ret;
end function or_reduce;
end package body;
| gpl-3.0 | 1933c47a717c51abb4feb912fb49d689 | 0.498002 | 3.674009 | false | false | false | false |
markusC64/1541ultimate2 | fpga/nios_c5/nios/nios_inst.vhd | 1 | 7,793 | component nios is
port (
clk50_clk : in std_logic := 'X'; -- clk
io_ack : in std_logic := 'X'; -- ack
io_rdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- rdata
io_read : out std_logic; -- read
io_wdata : out std_logic_vector(7 downto 0); -- wdata
io_write : out std_logic; -- write
io_address : out std_logic_vector(19 downto 0); -- address
io_irq : in std_logic := 'X'; -- irq
mem32_address : in std_logic_vector(25 downto 0) := (others => 'X'); -- address
mem32_direction : in std_logic := 'X'; -- direction
mem32_byte_en : in std_logic_vector(3 downto 0) := (others => 'X'); -- byte_en
mem32_wdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- wdata
mem32_request : in std_logic := 'X'; -- request
mem32_tag : in std_logic_vector(7 downto 0) := (others => 'X'); -- tag
mem32_dack_tag : out std_logic_vector(7 downto 0); -- dack_tag
mem32_rdata : out std_logic_vector(31 downto 0); -- rdata
mem32_rack : out std_logic; -- rack
mem32_rack_tag : out std_logic_vector(7 downto 0); -- rack_tag
memory_mem_a : out std_logic_vector(13 downto 0); -- mem_a
memory_mem_ba : out std_logic_vector(1 downto 0); -- mem_ba
memory_mem_ck : out std_logic_vector(0 downto 0); -- mem_ck
memory_mem_ck_n : out std_logic_vector(0 downto 0); -- mem_ck_n
memory_mem_cke : out std_logic_vector(0 downto 0); -- mem_cke
memory_mem_cs_n : out std_logic_vector(0 downto 0); -- mem_cs_n
memory_mem_dm : out std_logic_vector(0 downto 0); -- mem_dm
memory_mem_ras_n : out std_logic_vector(0 downto 0); -- mem_ras_n
memory_mem_cas_n : out std_logic_vector(0 downto 0); -- mem_cas_n
memory_mem_we_n : out std_logic_vector(0 downto 0); -- mem_we_n
memory_mem_dq : inout std_logic_vector(7 downto 0) := (others => 'X'); -- mem_dq
memory_mem_dqs : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_dqs
memory_mem_dqs_n : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_dqs_n
memory_mem_odt : out std_logic_vector(0 downto 0); -- mem_odt
oct_rzqin : in std_logic := 'X'; -- rzqin
pio_in_port : in std_logic_vector(31 downto 0) := (others => 'X'); -- in_port
pio_out_port : out std_logic_vector(31 downto 0); -- out_port
reset_reset_n : in std_logic := 'X'; -- reset_n
status_local_init_done : out std_logic; -- local_init_done
status_local_cal_success : out std_logic; -- local_cal_success
status_local_cal_fail : out std_logic; -- local_cal_fail
sys_clock_clk : out std_logic; -- clk
sys_reset_reset_n : out std_logic -- reset_n
);
end component nios;
u0 : component nios
port map (
clk50_clk => CONNECTED_TO_clk50_clk, -- clk50.clk
io_ack => CONNECTED_TO_io_ack, -- io.ack
io_rdata => CONNECTED_TO_io_rdata, -- .rdata
io_read => CONNECTED_TO_io_read, -- .read
io_wdata => CONNECTED_TO_io_wdata, -- .wdata
io_write => CONNECTED_TO_io_write, -- .write
io_address => CONNECTED_TO_io_address, -- .address
io_irq => CONNECTED_TO_io_irq, -- .irq
mem32_address => CONNECTED_TO_mem32_address, -- mem32.address
mem32_direction => CONNECTED_TO_mem32_direction, -- .direction
mem32_byte_en => CONNECTED_TO_mem32_byte_en, -- .byte_en
mem32_wdata => CONNECTED_TO_mem32_wdata, -- .wdata
mem32_request => CONNECTED_TO_mem32_request, -- .request
mem32_tag => CONNECTED_TO_mem32_tag, -- .tag
mem32_dack_tag => CONNECTED_TO_mem32_dack_tag, -- .dack_tag
mem32_rdata => CONNECTED_TO_mem32_rdata, -- .rdata
mem32_rack => CONNECTED_TO_mem32_rack, -- .rack
mem32_rack_tag => CONNECTED_TO_mem32_rack_tag, -- .rack_tag
memory_mem_a => CONNECTED_TO_memory_mem_a, -- memory.mem_a
memory_mem_ba => CONNECTED_TO_memory_mem_ba, -- .mem_ba
memory_mem_ck => CONNECTED_TO_memory_mem_ck, -- .mem_ck
memory_mem_ck_n => CONNECTED_TO_memory_mem_ck_n, -- .mem_ck_n
memory_mem_cke => CONNECTED_TO_memory_mem_cke, -- .mem_cke
memory_mem_cs_n => CONNECTED_TO_memory_mem_cs_n, -- .mem_cs_n
memory_mem_dm => CONNECTED_TO_memory_mem_dm, -- .mem_dm
memory_mem_ras_n => CONNECTED_TO_memory_mem_ras_n, -- .mem_ras_n
memory_mem_cas_n => CONNECTED_TO_memory_mem_cas_n, -- .mem_cas_n
memory_mem_we_n => CONNECTED_TO_memory_mem_we_n, -- .mem_we_n
memory_mem_dq => CONNECTED_TO_memory_mem_dq, -- .mem_dq
memory_mem_dqs => CONNECTED_TO_memory_mem_dqs, -- .mem_dqs
memory_mem_dqs_n => CONNECTED_TO_memory_mem_dqs_n, -- .mem_dqs_n
memory_mem_odt => CONNECTED_TO_memory_mem_odt, -- .mem_odt
oct_rzqin => CONNECTED_TO_oct_rzqin, -- oct.rzqin
pio_in_port => CONNECTED_TO_pio_in_port, -- pio.in_port
pio_out_port => CONNECTED_TO_pio_out_port, -- .out_port
reset_reset_n => CONNECTED_TO_reset_reset_n, -- reset.reset_n
status_local_init_done => CONNECTED_TO_status_local_init_done, -- status.local_init_done
status_local_cal_success => CONNECTED_TO_status_local_cal_success, -- .local_cal_success
status_local_cal_fail => CONNECTED_TO_status_local_cal_fail, -- .local_cal_fail
sys_clock_clk => CONNECTED_TO_sys_clock_clk, -- sys_clock.clk
sys_reset_reset_n => CONNECTED_TO_sys_reset_reset_n -- sys_reset.reset_n
);
| gpl-3.0 | 6ebb09912a4a4da4c369020f8294f8ea | 0.42243 | 3.646701 | false | false | false | false |
markusC64/1541ultimate2 | fpga/altera/xilinx_primitives/RAMB16_S9_S18.vhd | 1 | 11,228 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT TECHNOLUTION BV, GOUDA NL
-- | ======= I == I =
-- | I I I I
-- | I === === I === I === === I I I ==== I === I ===
-- | I / \ I I/ I I/ I I I I I I I I I I I/ I
-- | I ===== I I I I I I I I I I I I I I I I
-- | I \ I I I I I I I I I /I \ I I I I I
-- | I === === I I I I === === === I == I === I I
-- | +---------------------------------------------------+
-- +----+ | +++++++++++++++++++++++++++++++++++++++++++++++++|
-- | | ++++++++++++++++++++++++++++++++++++++|
-- +------------+ +++++++++++++++++++++++++|
-- ++++++++++++++|
-- A U T O M A T I O N T E C H N O L O G Y +++++|
--
-------------------------------------------------------------------------------
-- Title : RAMB16_S9_S18
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Altera wrapper
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;
entity RAMB16_S9_S18 is
generic (
INITP_00 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_01 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_02 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_03 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_04 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_05 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_06 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INITP_07 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_00 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_01 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_02 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_03 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_04 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_05 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_06 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_07 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_08 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_09 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_0A : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_0B : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_0C : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_0D : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_0E : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_0F : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_10 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_11 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_12 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_13 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_14 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_15 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_16 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_17 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_18 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_19 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_1A : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_1B : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_1C : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_1D : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_1E : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_1F : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_20 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_21 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_22 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_23 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_24 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_25 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_26 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_27 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_28 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_29 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_2A : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_2B : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_2C : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_2D : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_2E : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_2F : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_30 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_31 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_32 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_33 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_34 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_35 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_36 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_37 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_38 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_39 : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_3A : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_3B : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_3C : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_3D : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_3E : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_3F : bit_vector := X"0000000000000000000000000000000000000000000000000000000000000000";
INIT_A : bit_vector := X"000";
INIT_B : bit_vector := X"000000000";
SIM_COLLISION_CHECK : string := "ALL";
SRVAL_A : bit_vector := X"000";
SRVAL_B : bit_vector := X"000000000";
WRITE_MODE_A : string := "READ_FIRST";
WRITE_MODE_B : string := "READ_FIRST"
);
port (
DOA : out std_logic_vector(7 downto 0);
DOB : out std_logic_vector(15 downto 0);
DOPA : out std_logic_vector(0 downto 0);
DOPB : out std_logic_vector(1 downto 0);
ADDRA : in std_logic_vector(10 downto 0);
ADDRB : in std_logic_vector(9 downto 0);
CLKA : in std_ulogic;
CLKB : in std_ulogic;
DIA : in std_logic_vector(7 downto 0);
DIB : in std_logic_vector(15 downto 0);
DIPA : in std_logic_vector(0 downto 0);
DIPB : in std_logic_vector(1 downto 0);
ENA : in std_ulogic;
ENB : in std_ulogic;
SSRA : in std_ulogic;
SSRB : in std_ulogic;
WEA : in std_ulogic;
WEB : in std_ulogic
);
end entity;
architecture wrapper of RAMB16_S9_S18 is
signal wren_a : std_logic;
signal wren_b : std_logic;
begin
altsyncram_component : altsyncram
GENERIC MAP (
address_reg_b => "CLOCK1",
clock_enable_input_a => "BYPASS",
clock_enable_input_b => "BYPASS",
clock_enable_output_a => "BYPASS",
clock_enable_output_b => "BYPASS",
indata_reg_b => "CLOCK1",
intended_device_family => "Cyclone IV E",
lpm_type => "altsyncram",
numwords_a => 2048,
numwords_b => 1024,
operation_mode => "BIDIR_DUAL_PORT",
outdata_aclr_a => "NONE",
outdata_aclr_b => "NONE",
outdata_reg_a => "UNREGISTERED",
outdata_reg_b => "UNREGISTERED",
power_up_uninitialized => "FALSE",
read_during_write_mode_port_a => "NEW_DATA_NO_NBE_READ",
read_during_write_mode_port_b => "NEW_DATA_NO_NBE_READ",
widthad_a => 11,
widthad_b => 10,
width_a => 8,
width_b => 16,
width_byteena_a => 1,
width_byteena_b => 1,
wrcontrol_wraddress_reg_b => "CLOCK1"
)
PORT MAP (
address_a => ADDRA,
address_b => ADDRB,
clock0 => CLKA,
clock1 => CLKB,
data_a => DIA,
data_b => DIB,
rden_a => ENA,
rden_b => ENB,
wren_a => wren_a,
wren_b => wren_b,
q_a => DOA,
q_b => DOB );
wren_a <= WEA and ENA;
wren_b <= WEB and ENB;
end architecture;
| gpl-3.0 | d496525d623b573510363ca522773182 | 0.664232 | 5.291235 | false | false | false | false |
keyru/hdl-make | tests/counter/testbench/counter_tb/vhdl/counter_tb.vhd | 2 | 1,403 | ----------------------------------------------------------
-- Design : Simple testbench for an 8-bit VHDL counter
-- Author : Javier D. Garcia-Lasheras
----------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity counter_tb is -- entity declaration
end counter_tb;
-----------------------------------------------------------------------
architecture testbench of counter_tb is
component counter
port(
clock: in std_logic;
clear: in std_logic;
count: in std_logic;
Q: out std_logic_vector(7 downto 0)
);
end component;
signal t_clock: std_logic;
signal t_clear: std_logic;
signal t_count: std_logic;
signal t_Q: std_logic_vector(7 downto 0);
begin
U_counter: counter port map (t_clock, t_clear, t_count, t_Q);
process
begin
t_clock <= '0'; -- clock cycle is 10 ns
wait for 5 ns;
t_clock <= '1';
wait for 5 ns;
end process;
process
begin
t_clear <= '1'; -- start counting
t_count <= '1';
wait for 50 ns;
t_clear <= '0'; -- clear output
wait for 1000 ns;
report "Testbench of Adder completed successfully!"
severity note;
wait;
end process;
end testbench;
----------------------------------------------------------------
| gpl-3.0 | 9f4ff20cb9102290cfcff314d15e52a1 | 0.466857 | 3.941011 | false | true | false | false |
markusC64/1541ultimate2 | fpga/devices/vhdl_sim/microwire_eeprom_tb.vhd | 1 | 3,853 | --------------------------------------------------------------------------------
-- Entity: microwire_eeprom_tb
-- Date:2018-08-14
-- Author: gideon
--
-- Description: Testbench for EEPROM
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
use work.io_bus_bfm_pkg.all;
entity microwire_eeprom_tb is
end entity;
architecture test of microwire_eeprom_tb is
signal clock : std_logic := '0';
signal reset : std_logic;
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal sel_in : std_logic := '0';
signal clk_in : std_logic := '0';
signal data_in : std_logic := '0';
signal data_out : std_logic := '0';
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_mut: entity work.microwire_eeprom
port map (
clock => clock,
reset => reset,
io_req => io_req,
io_resp => io_resp,
sel_in => sel_in,
clk_in => clk_in,
data_in => data_in,
data_out => data_out
);
i_bfm: entity work.io_bus_bfm
generic map(
g_name => "io"
)
port map(
clock => clock,
req => io_req,
resp => io_resp
);
p_test: process
procedure command(opcode : std_logic_vector(1 downto 0); address : unsigned;
data : std_logic_vector; extra_clocks : natural := 0) is
begin
clk_in <= '0';
data_in <= '1';
wait for 500 ns;
sel_in <= '1';
wait for 200 ns;
if data_out /= '1' then
wait until data_out = '1';
end if;
wait for 200 ns;
clk_in <= '1';
wait for 500 ns;
clk_in <= '0';
for i in opcode'range loop
data_in <= opcode(i);
wait for 500 ns;
clk_in <= '1';
wait for 500 ns;
clk_in <= '0';
end loop;
for i in address'range loop
data_in <= address(i);
wait for 500 ns;
clk_in <= '1';
wait for 500 ns;
clk_in <= '0';
end loop;
for i in data'range loop
data_in <= data(i);
wait for 500 ns;
clk_in <= '1';
wait for 500 ns;
clk_in <= '0';
end loop;
data_in <= '1';
for i in 1 to extra_clocks loop
wait for 500 ns;
clk_in <= '1';
wait for 500 ns;
clk_in <= '0';
end loop;
sel_in <= '0';
wait for 500 ns;
end procedure;
constant c_no_data : std_logic_vector(-1 downto 0) := (others => '0');
begin
wait until reset = '0';
wait for 1 us;
command("00", "1100000000", c_no_data); -- write enable
command("01", "0000000001", X"1234"); -- write
command("10", "0000000000", c_no_data, 64); -- read
command("00", "0100000000", X"5678"); -- write all
command("00", "1000001011", c_no_data); -- erase all
command("01", "0000010001", X"1234"); -- write
command("11", "0000010001", c_no_data); -- erase one
report "Invalid writes";
command("01", "000000000", X"3456"); -- invalid write, as address is too short
command("01", "00000000000", X"3456"); -- invalid write, as address is too long
command("00", "0000000000", c_no_data); -- write disable
wait;
end process;
end architecture;
| gpl-3.0 | 58558eb4d8e485291059855a21fe7bea | 0.440696 | 3.984488 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cpu_unit/vhdl_sim/mblite_simu_wrapped.vhd | 1 | 9,132 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library mblite;
use mblite.config_Pkg.all;
use mblite.core_Pkg.all;
use mblite.std_Pkg.all;
library work;
use work.tl_string_util_pkg.all;
use work.io_bus_pkg.all;
use work.mem_bus_pkg.all;
library std;
use std.textio.all;
entity mblite_simu_wrapped is
end entity;
architecture test of mblite_simu_wrapped is
signal clock : std_logic := '0';
signal reset : std_logic;
signal mb_reset : std_logic := '1';
signal mem_req : t_mem_req_32 := c_mem_req_32_init;
signal mem_resp : t_mem_resp_32;
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal io_busy : std_logic;
signal irq_i : std_logic := '0';
signal irq_o : std_logic;
signal irqs : std_logic_vector(7 downto 0) := X"00";
signal plaag_interrupt : std_logic := '0';
signal invalidate : std_logic := '0';
signal inv_addr : std_logic_vector(31 downto 0) := X"00003FFC";
type t_mem_array is array(natural range <>) of std_logic_vector(31 downto 0);
shared variable memory : t_mem_array(0 to 4194303) := (1024 => X"00000000", others => X"F0000000"); -- 16MB
signal last_char : std_logic_vector(7 downto 0);
constant g_latency : natural := 1;
signal pipe : t_mem_req_32_array(0 to g_latency-1) := (others => c_mem_req_32_init);
signal isr, yield, leave1, leave2 : std_logic := '0';
signal task : std_logic_vector(7 downto 0) := X"FF";
signal curTCB, save, restore, critical : std_logic_vector(31 downto 0) := (others => 'X');
BEGIN
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
mb_reset <= '1', '0' after 2 us;
--plaag_interrupt <= transport '0', '1' after 25 ms, '0' after 30 ms;
i_core: entity work.mblite_wrapper
generic map (
g_icache => false,
g_dcache => false,
g_tag_i => X"0A",
g_tag_d => X"0B"
)
port map (
clock => clock,
reset => reset,
irq_i => irq_i,
irq_o => irq_o,
mb_reset => mb_reset,
disable_i => '0',
disable_d => '0',
invalidate => invalidate,
inv_addr => inv_addr,
io_req => io_req,
io_resp => io_resp,
io_busy => io_busy,
mem_req => mem_req,
mem_resp => mem_resp
);
process
begin
wait until reset='0';
wait until clock='1';
wait until clock='1';
while true loop
invalidate <= '0';
wait until clock='1';
invalidate <= '0';
wait until clock='1';
wait until clock='1';
end loop;
end process;
-- IO
process(clock)
variable s : line;
variable char : character;
variable byte : std_logic_vector(7 downto 0);
variable irqdiv : natural := 50000;
variable irqdiv2 : natural := 60000;
variable not_ready : natural := 3;
begin
if rising_edge(clock) then
if irqdiv = 0 then
irqs(0) <= '1';
irqdiv := 400000;
else
irqdiv := irqdiv - 1;
end if;
-- if irqdiv2 = 0 then
-- irqs(2) <= '1';
-- irqdiv2 := 97127;
-- else
-- irqdiv2 := irqdiv2 - 1;
-- end if;
io_resp <= c_io_resp_init;
leave1 <= '0';
leave2 <= '0';
if io_req.write = '1' then
io_resp.ack <= '1';
case io_req.address is
when X"00028" => -- enter IRQ
isr <= '1';
when X"00029" => -- enter yield
yield <= '1';
when X"0002A" => -- leave
isr <= '0';
yield <= '0';
if io_req.data(1) = '1' then
leave1 <= '1'; -- with IRQ ON
else
leave2 <= '1'; -- with IRQ OFF
end if;
when X"00000" => -- interrupt
null;
when X"60304" => -- profiler
null;
when X"60305" => -- profiler
task <= io_req.data;
null;
when X"00004" => -- interupt ack
irqs <= irqs and not io_req.data;
when X"00010" => -- UART_DATA
not_ready := 500;
byte := io_req.data;
char := character'val(to_integer(unsigned(byte)));
last_char <= byte;
if byte = X"0D" then
-- Ignore character 13
elsif byte = X"0A" then
-- Writeline on character 10 (newline)
writeline(output, s);
else
-- Write to buffer
write(s, char);
end if;
when others =>
null;
-- report "I/O write to " & hstr(io_req.address) & " dropped";
end case;
end if;
if io_req.read = '1' then
io_resp.ack <= '1';
case io_req.address is
when X"00005" => -- IRQ Flags
io_resp.data <= irqs;
when X"0000C" => -- Capabilities 11D447B9
io_resp.data <= X"11";
when X"0000D" => -- Capabilities 11D447B9
io_resp.data <= X"D4";
when X"0000E" => -- Capabilities 11D447B9
io_resp.data <= X"47";
when X"0000F" => -- Capabilities 11D447B9
io_resp.data <= X"99";
when X"00012" => -- UART_FLAGS
if not_ready > 0 then
io_resp.data <= X"50";
not_ready := not_ready - 1;
else
io_resp.data <= X"40";
end if;
when X"2000A" => -- 1541_A memmap
io_resp.data <= X"3F";
when X"2000B" => -- 1541_A audiomap
io_resp.data <= X"3E";
when others =>
-- report "I/O read to " & hstr(io_req.address) & " dropped";
io_resp.data <= X"00";
end case;
end if;
irqs(7) <= plaag_interrupt;
if reset = '1' then
irqs <= X"00";
end if;
end if;
end process;
-- memory
process(clock)
variable addr : natural;
begin
if rising_edge(clock) then
mem_resp <= c_mem_resp_32_init;
pipe(g_latency-1) <= c_mem_req_32_init;
if mem_req.request = '1' and mem_resp.rack = '0' then
mem_resp.rack <= '1';
mem_resp.rack_tag <= mem_req.tag;
pipe(g_latency-1) <= mem_req;
assert mem_req.address(1 downto 0) = "00" report "Lower address bits are non-zero!" severity warning;
if mem_req.read_writen = '0' then
case to_integer(mem_req.address) is
when 16|20 =>
report "Write to illegal address!"
severity warning;
-- when 16#16d20# =>
-- report "Debug: Writing Current TCB to " & hstr(mem_req.data);
-- curTCB <= mem_req.data;
---- when 16#16954# =>
---- critical <= mem_req.data;
-- when 16#FFC# =>
-- report "Debug: Save context, TCB = " & hstr(mem_req.data);
-- save <= mem_req.data;
-- when 16#FF8# =>
-- report "Debug: Restore context, TCB = " & hstr(mem_req.data);
-- restore <= mem_req.data;
when others =>
end case;
end if;
end if;
pipe(0 to g_latency-2) <= pipe(1 to g_latency-1);
mem_resp.dack_tag <= (others => '0');
mem_resp.data <= (others => '0');
if pipe(0).request='1' then
addr := to_integer(pipe(0).address(21 downto 2));
if pipe(0).read_writen='1' then
mem_resp.dack_tag <= pipe(0).tag;
mem_resp.data <= memory(addr);
else
for i in 0 to 3 loop
if pipe(0).byte_en(i)='1' then
memory(addr)(i*8+7 downto i*8) := pipe(0).data(i*8+7 downto i*8);
end if;
end loop;
end if;
end if;
end if;
end process;
irq_i <= '1' when irqs /= X"00" else '0';
end architecture;
| gpl-3.0 | d1841155528876de1fe0f8fbd62f235a | 0.430245 | 3.890925 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb2/vhdl_source/ulpi_bus.vhd | 1 | 8,708 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity ulpi_bus is
port (
clock : in std_logic;
reset : in std_logic;
ULPI_DATA : inout std_logic_vector(7 downto 0);
ULPI_DIR : in std_logic;
ULPI_NXT : in std_logic;
ULPI_STP : out std_logic;
-- status
status : out std_logic_vector(7 downto 0);
operational : in std_logic := '1';
-- chirp interface
do_chirp : in std_logic := '0';
chirp_data : in std_logic := '0';
-- register interface
reg_read : in std_logic;
reg_write : in std_logic;
reg_address : in std_logic_vector(5 downto 0);
reg_wdata : in std_logic_vector(7 downto 0);
reg_ack : out std_logic;
-- stream interface
tx_data : in std_logic_vector(7 downto 0);
tx_last : in std_logic;
tx_valid : in std_logic;
tx_start : in std_logic;
tx_next : out std_logic;
-- for the tracer
rx_cmd : out std_logic;
rx_ourdata : out std_logic;
rx_data : out std_logic_vector(7 downto 0);
rx_register : out std_logic;
rx_last : out std_logic;
rx_valid : out std_logic;
rx_store : out std_logic );
attribute keep_hierarchy : string;
attribute keep_hierarchy of ulpi_bus : entity is "yes";
end ulpi_bus;
architecture gideon of ulpi_bus is
signal ulpi_data_out : std_logic_vector(7 downto 0);
signal ulpi_data_in : std_logic_vector(7 downto 0);
signal ulpi_stp_d1 : std_logic; -- for signaltap only
signal ulpi_dir_d1 : std_logic;
signal ulpi_dir_d2 : std_logic;
signal ulpi_dir_d3 : std_logic;
signal ulpi_nxt_d1 : std_logic;
signal ulpi_nxt_d2 : std_logic;
signal ulpi_nxt_d3 : std_logic;
signal reg_cmd_d2 : std_logic;
signal reg_cmd_d3 : std_logic;
signal rx_reg_i : std_logic;
signal tx_reg_i : std_logic;
signal rx_status_i : std_logic;
signal ulpi_stop : std_logic := '1';
signal ulpi_last : std_logic;
signal bus_has_our_data : std_logic;
type t_state is ( idle, chirp, reading, writing, writing_data, transmit );
signal state : t_state;
attribute iob : string;
attribute iob of ulpi_data_in : signal is "true";
attribute iob of ulpi_dir_d1 : signal is "true";
attribute iob of ulpi_nxt_d1 : signal is "true";
attribute iob of ulpi_data_out : signal is "true";
attribute iob of ULPI_STP : signal is "true";
begin
-- Marking incoming data based on next/dir pattern
rx_data <= ulpi_data_in;
rx_store <= ulpi_dir_d1 and ulpi_dir_d2 and ulpi_nxt_d1 and operational;
rx_valid <= ulpi_dir_d1 and ulpi_dir_d2;
rx_last <= not ulpi_dir_d1 and ulpi_dir_d2;
rx_status_i <= ulpi_dir_d1 and ulpi_dir_d2 and not ulpi_nxt_d1 and not rx_reg_i;
rx_reg_i <= (ulpi_dir_d1 and ulpi_dir_d2 and not ulpi_dir_d3) and
(not ulpi_nxt_d1 and not ulpi_nxt_d2 and ulpi_nxt_d3) and
reg_cmd_d3;
rx_cmd <= rx_status_i;
rx_ourdata <= not ulpi_dir_d1 and ulpi_nxt_d1; -- next = 1 and dir = 0, same delay as rx_data (1)
rx_register <= rx_reg_i;
reg_ack <= rx_reg_i or tx_reg_i;
p_sample: process(clock, reset)
begin
if rising_edge(clock) then
ulpi_data_in <= ULPI_DATA;
reg_cmd_d2 <= ulpi_data_in(7) and ulpi_data_in(6);
reg_cmd_d3 <= reg_cmd_d2;
ulpi_stp_d1 <= ulpi_stop;
ulpi_dir_d1 <= ULPI_DIR;
ulpi_dir_d2 <= ulpi_dir_d1;
ulpi_dir_d3 <= ulpi_dir_d2;
ulpi_nxt_d1 <= ULPI_NXT;
ulpi_nxt_d2 <= ulpi_nxt_d1;
ulpi_nxt_d3 <= ulpi_nxt_d2;
if rx_status_i='1' then
status <= ulpi_data_in;
end if;
if reset='1' then
status <= (others => '0');
end if;
end if;
end process;
p_tx_state: process(clock, reset)
begin
if rising_edge(clock) then
ulpi_stop <= '0';
tx_reg_i <= '0';
case state is
when idle =>
ulpi_data_out <= X"00";
if reg_read='1' and rx_reg_i='0' then
ulpi_data_out <= "11" & reg_address;
state <= reading;
elsif reg_write='1' and tx_reg_i='0' then
ulpi_data_out <= "10" & reg_address;
state <= writing;
elsif do_chirp='1' then
if ULPI_DIR='0' then
ulpi_last <= '0';
state <= chirp;
end if;
ulpi_data_out <= X"40"; -- PIDless packet
elsif tx_valid = '1' and tx_start = '1' then
if ULPI_DIR='0' then
ulpi_last <= tx_last;
state <= transmit;
end if;
ulpi_data_out <= tx_data;
end if;
when chirp =>
if ULPI_NXT = '1' then
if do_chirp = '0' then
ulpi_data_out <= X"00";
ulpi_stop <= '1';
state <= idle;
else
ulpi_data_out <= (others => chirp_data);
end if;
end if;
when reading =>
if rx_reg_i='1' then
ulpi_data_out <= X"00";
state <= idle;
end if;
if ulpi_dir_d1='1' then
state <= idle; -- terminate current tx
ulpi_data_out <= X"00";
end if;
when writing =>
if ULPI_DIR='1' then
state <= idle; -- terminate current tx
ulpi_data_out <= X"00";
elsif ULPI_NXT='1' then
ulpi_data_out <= reg_wdata;
state <= writing_data;
end if;
when writing_data =>
if ULPI_DIR='1' then
state <= idle; -- terminate current tx
ulpi_data_out <= X"00";
elsif ULPI_NXT='1' then
ulpi_data_out <= X"00";
tx_reg_i <= '1';
ulpi_stop <= '1';
state <= idle;
end if;
when transmit =>
if ULPI_NXT = '1' then
if ulpi_last='1' or tx_valid = '0' then
ulpi_data_out <= X"00";
ulpi_stop <= '1';
state <= idle;
else
ulpi_data_out <= tx_data;
ulpi_last <= tx_last;
end if;
end if;
when others =>
null;
end case;
if reset='1' then
state <= idle;
ulpi_stop <= '1';
ulpi_last <= '0';
end if;
end if;
end process;
p_next: process(state, tx_valid, tx_start, rx_reg_i, tx_reg_i, ULPI_DIR, ULPI_NXT, ulpi_last, reg_read, reg_write, bus_has_our_data)
begin
case state is
when idle =>
tx_next <= not ULPI_DIR and tx_valid and tx_start; -- first byte is transferred to register
if reg_read='1' and rx_reg_i='0' then
tx_next <= '0';
end if;
if reg_write='1' and tx_reg_i='0' then
tx_next <= '0';
end if;
when transmit =>
tx_next <= ULPI_NXT and bus_has_our_data and tx_valid and not ulpi_last; -- phy accepted this data.
when others =>
tx_next <= '0';
end case;
end process;
ULPI_STP <= ulpi_stop;
ULPI_DATA <= ulpi_data_out when bus_has_our_data = '1' else (others => 'Z');
bus_has_our_data <= '1' when ULPI_DIR='0' and ulpi_dir_d1='0' else '0';
end gideon;
| gpl-3.0 | 83f0c823d4307df5bb7398999e8da252 | 0.441203 | 3.776236 | false | false | false | false |
xiadz/oscilloscope | ipcore_dir/trace_memory.vhd | 1 | 5,789 | --------------------------------------------------------------------------------
-- This file is owned and controlled by Xilinx and must be used --
-- solely for design, simulation, implementation and creation of --
-- design files limited to Xilinx devices or technologies. Use --
-- with non-Xilinx devices or technologies is expressly prohibited --
-- and immediately terminates your license. --
-- --
-- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" --
-- SOLELY FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR --
-- XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION --
-- AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION --
-- OR STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS --
-- IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, --
-- AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE --
-- FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY --
-- WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE --
-- IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR --
-- REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF --
-- INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS --
-- FOR A PARTICULAR PURPOSE. --
-- --
-- Xilinx products are not intended for use in life support --
-- appliances, devices, or systems. Use in such applications are --
-- expressly prohibited. --
-- --
-- (c) Copyright 1995-2011 Xilinx, Inc. --
-- All rights reserved. --
--------------------------------------------------------------------------------
-- You must compile the wrapper file trace_memory.vhd when simulating
-- the core, trace_memory. When compiling the wrapper file, be sure to
-- reference the XilinxCoreLib VHDL simulation library. For detailed
-- instructions, please refer to the "CORE Generator Help".
-- The synthesis directives "translate_off/translate_on" specified
-- below are supported by Xilinx, Mentor Graphics and Synplicity
-- synthesis tools. Ensure they are correct for your synthesis tool(s).
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
-- synthesis translate_off
LIBRARY XilinxCoreLib;
-- synthesis translate_on
ENTITY trace_memory IS
PORT (
clka : IN STD_LOGIC;
wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
addra : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
dina : IN STD_LOGIC_VECTOR(8 DOWNTO 0);
clkb : IN STD_LOGIC;
rstb : IN STD_LOGIC;
addrb : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
doutb : OUT STD_LOGIC_VECTOR(8 DOWNTO 0)
);
END trace_memory;
ARCHITECTURE trace_memory_a OF trace_memory IS
-- synthesis translate_off
COMPONENT wrapped_trace_memory
PORT (
clka : IN STD_LOGIC;
wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
addra : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
dina : IN STD_LOGIC_VECTOR(8 DOWNTO 0);
clkb : IN STD_LOGIC;
rstb : IN STD_LOGIC;
addrb : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
doutb : OUT STD_LOGIC_VECTOR(8 DOWNTO 0)
);
END COMPONENT;
-- Configuration specification
FOR ALL : wrapped_trace_memory USE ENTITY XilinxCoreLib.blk_mem_gen_v6_1(behavioral)
GENERIC MAP (
c_addra_width => 13,
c_addrb_width => 13,
c_algorithm => 1,
c_axi_id_width => 4,
c_axi_slave_type => 0,
c_axi_type => 1,
c_byte_size => 9,
c_common_clk => 1,
c_default_data => "0",
c_disable_warn_bhv_coll => 0,
c_disable_warn_bhv_range => 0,
c_family => "spartan3",
c_has_axi_id => 0,
c_has_ena => 0,
c_has_enb => 0,
c_has_injecterr => 0,
c_has_mem_output_regs_a => 0,
c_has_mem_output_regs_b => 0,
c_has_mux_output_regs_a => 0,
c_has_mux_output_regs_b => 0,
c_has_regcea => 0,
c_has_regceb => 0,
c_has_rsta => 0,
c_has_rstb => 1,
c_has_softecc_input_regs_a => 0,
c_has_softecc_output_regs_b => 0,
c_init_file_name => "no_coe_file_loaded",
c_inita_val => "0",
c_initb_val => "0",
c_interface_type => 0,
c_load_init_file => 0,
c_mem_type => 1,
c_mux_pipeline_stages => 0,
c_prim_type => 1,
c_read_depth_a => 5974,
c_read_depth_b => 5974,
c_read_width_a => 9,
c_read_width_b => 9,
c_rst_priority_a => "CE",
c_rst_priority_b => "CE",
c_rst_type => "SYNC",
c_rstram_a => 0,
c_rstram_b => 0,
c_sim_collision_check => "ALL",
c_use_byte_wea => 0,
c_use_byte_web => 0,
c_use_default_data => 1,
c_use_ecc => 0,
c_use_softecc => 0,
c_wea_width => 1,
c_web_width => 1,
c_write_depth_a => 5974,
c_write_depth_b => 5974,
c_write_mode_a => "WRITE_FIRST",
c_write_mode_b => "WRITE_FIRST",
c_write_width_a => 9,
c_write_width_b => 9,
c_xdevicefamily => "spartan3e"
);
-- synthesis translate_on
BEGIN
-- synthesis translate_off
U0 : wrapped_trace_memory
PORT MAP (
clka => clka,
wea => wea,
addra => addra,
dina => dina,
clkb => clkb,
rstb => rstb,
addrb => addrb,
doutb => doutb
);
-- synthesis translate_on
END trace_memory_a;
| mit | cafe8bf81969c85304d65be2d58503b8 | 0.536017 | 3.935418 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb2/altera/avalon_usb.vhd | 1 | 3,875 | --------------------------------------------------------------------------------
-- Entity: avalon_usb
-- Date:2016-11-03
-- Author: Gideon
--
-- Description: AvalonMM wrapper around usb peripheral for use in QSYS
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
use work.mem_bus_pkg.all;
entity avalon_usb is
port (
sys_clock : in std_logic;
sys_reset : in std_logic;
-- 8 bits Avalon bus interface
avs_read : in std_logic;
avs_write : in std_logic;
avs_address : in std_logic_vector(12 downto 0);
avs_writedata : in std_logic_vector(7 downto 0);
avs_ready : out std_logic;
avs_readdata : out std_logic_vector(7 downto 0);
avs_readdatavalid : out std_logic;
avs_irq : out std_logic;
-- Memory master port for DMA
avm_read : out std_logic;
avm_write : out std_logic;
avm_address : out std_logic_vector(25 downto 0);
avm_writedata : out std_logic_vector(31 downto 0);
avm_byteenable : out std_logic_vector(3 downto 0);
avm_ready : in std_logic;
avm_readdata : in std_logic_vector(31 downto 0);
avm_readdatavalid : in std_logic;
-- Conduit with ULPI signals
ulpi_clock : in std_logic;
ulpi_reset : in std_logic;
ulpi_nxt : in std_logic;
ulpi_dir : in std_logic;
ulpi_stp : out std_logic;
ulpi_data : inout std_logic_vector(7 downto 0));
end entity;
architecture arch of avalon_usb is
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal mem_req : t_mem_req_32;
signal mem_resp : t_mem_resp_32;
begin
i_bridge: entity work.avalon_to_io_bridge
port map (
clock => sys_clock,
reset => sys_reset,
avs_read => avs_read,
avs_write => avs_write,
avs_address(19 downto 13) => "0000000",
avs_address(12 downto 0) => avs_address,
avs_writedata => avs_writedata,
avs_ready => avs_ready,
avs_readdata => avs_readdata,
avs_readdatavalid => avs_readdatavalid,
avs_irq => open,
io_read => io_req.read,
io_write => io_req.write,
unsigned(io_address) => io_req.address,
io_wdata => io_req.data,
io_rdata => io_resp.data,
io_ack => io_resp.ack,
io_irq => '0'
);
i_wrapped: entity work.usb_host_nano
generic map(
g_big_endian => false,
g_tag => X"01",
g_simulation => false
)
port map (
clock => ulpi_clock,
reset => ulpi_reset,
ulpi_nxt => ulpi_nxt,
ulpi_dir => ulpi_dir,
ulpi_stp => ulpi_stp,
ulpi_data => ulpi_data,
sys_clock => sys_clock,
sys_reset => sys_reset,
sys_mem_req => mem_req,
sys_mem_resp => mem_resp,
sys_io_req => io_req,
sys_io_resp => io_resp,
sys_irq => avs_irq
);
avm_read <= mem_req.read_writen and mem_req.request;
avm_write <= not mem_req.read_writen and mem_req.request;
avm_address <= std_logic_vector(mem_req.address);
avm_byteenable <= mem_req.byte_en;
avm_writedata <= mem_req.data;
mem_resp.data <= avm_readdata;
mem_resp.dack_tag <= X"01" when avm_readdatavalid='1' else X"00";
mem_resp.rack_tag <= X"01" when avm_ready='1' else X"00";
mem_resp.rack <= avm_ready;
end arch;
| gpl-3.0 | 55f9fb1137e79a951b858a6519b9d147 | 0.498581 | 3.571429 | false | false | false | false |
asicguy/crash | fpga/src/common/debounce.vhd | 2 | 3,388 | -------------------------------------------------------------------------------
-- Copyright 2013-2014 Jonathon Pendlum
--
-- This 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 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/>.
--
--
-- File: debounce.vhd
-- Author: Jonathon Pendlum ([email protected])
-- Description: Debounces input by sampling the input single twice
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
entity debounce is
generic (
CLOCK_FREQ : integer := 100e6; -- Clock frequency (Hz)
SAMPLE_TIME : integer := 10); -- Time between debounce samples (millseconds)
port (
clk : in std_logic; -- Clock
reset : in std_logic; -- Active high reset
input_async : in std_logic; -- Asynchronous input to debounce
input_sync : out std_logic); -- Debounced synchronous input
end entity;
architecture RTL of debounce is
-----------------------------------------------------------------------------
-- Constants Declaration
-----------------------------------------------------------------------------
constant DEBOUNCE_PERIOD : integer := integer((real(SAMPLE_TIME)/(1.0/real(CLOCK_FREQ)))/1.0e3);
-----------------------------------------------------------------------------
-- Signals Declaration
-----------------------------------------------------------------------------
signal debounce_cnt : integer range 0 to DEBOUNCE_PERIOD-1;
signal input_async_meta1 : std_logic;
signal input_async_meta2 : std_logic;
signal input_async_samp1 : std_logic;
signal input_async_samp2 : std_logic;
begin
proc_debounce : process(clk,reset)
begin
if (reset = '1') then
debounce_cnt <= 0;
input_async_meta1 <= '0';
input_async_meta2 <= '0';
input_async_samp1 <= '0';
input_async_samp2 <= '0';
input_sync <= '0';
else
if rising_edge(clk) then
-- Synchronizer
input_async_meta1 <= input_async;
input_async_meta2 <= input_async_meta1;
-- Debounce sampling
if (debounce_cnt = DEBOUNCE_PERIOD-1) then
input_async_samp1 <= input_async_meta2;
input_async_samp2 <= input_async_samp1;
debounce_cnt <= 0;
else
debounce_cnt <= debounce_cnt + 1;
end if;
-- Only update output on stable input
if (input_async_samp1 = '1' AND input_async_samp2 = '1') then
input_sync <= '1';
elsif (input_async_samp1 = '0' AND input_async_samp2 = '0') then
input_sync <= '0';
end if;
end if;
end if;
end process;
end architecture; | gpl-3.0 | c279d1171abe85a6b7ecda2a06fc369b | 0.531287 | 4.235 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/command_interface/vhdl_source/command_protocol.vhd | 1 | 14,452 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.slot_bus_pkg.all;
use work.command_if_pkg.all;
entity command_protocol is
port (
clock : in std_logic;
reset : in std_logic;
-- io interface for local cpu
io_req : in t_io_req; -- we get a 2K range
io_resp : out t_io_resp;
io_irq : out std_logic;
-- C64 side interface
slot_req : in t_slot_req;
slot_resp : out t_slot_resp;
freeze : out std_logic;
write_ff00 : in std_logic := '0';
-- block memory
address : out unsigned(10 downto 0);
rdata : in std_logic_vector(7 downto 0);
wdata : out std_logic_vector(7 downto 0);
en : out std_logic;
we : out std_logic );
end entity;
-- How does the protocol work?
-- The Ultimate software initializes the command and response buffers that the C64 can write to.
-- Each buffer has a start address, an end address, and a current read/write pointer as seen
-- from the C64 side.
-- The C64 can write into the command buffer and set a handshake flag. The 1541U software
-- triggers on the flag, and reads the write pointer, copies the command, and stores the
-- result and status in their respective buffers, and sets the respective handshake flags back
-- to the C64. The buffers on the ultimate side are direct mapped; on the C64 side, each
-- buffer has its own data register. One bidirectional register (on the C64 side) acts as
-- handshake register. Command queueing is not supported.
-- Protocol:
-- There are 4 states:
-- 00: Ultimate is ready and waiting for new command
-- 01: C64 has written data into the Ultimate command buffer, and the Ultimate is processing it
-- 11: Ultimate has processed the command and replied with data/status. This is not the last data.
-- 10: Ultimate has processed the command and replied with data/status. This is the last data.
-- The status register (seen by the C64) holds the following bits:
-- Bit 7: Response data available
-- Bit 6: Status data available
-- Bit 5..4: State
-- Bit 3: Error flag (write 1 to clear)
-- Bit 2: Abort flag set (cleared by Ultimate software)
-- Bit 1: Data accepted bit set (cleared by Ultimate software)
-- Bit 0: New command (set when new command is written, should NOT be used by C64)
architecture gideon of command_protocol is
signal enabled : std_logic;
signal slot_base : unsigned(6 downto 1);
signal do_write : std_logic;
signal trigger : std_logic;
signal freeze_i : std_logic;
signal irq_mask : std_logic_vector(2 downto 0);
signal command_pointer : unsigned(10 downto 0);
signal response_pointer : unsigned(10 downto 0);
signal status_pointer : unsigned(10 downto 0);
signal command_length : unsigned(10 downto 0);
signal response_length : unsigned(10 downto 0);
signal status_length : unsigned(10 downto 0);
-- signal response_valid : std_logic;
-- signal status_valid : std_logic;
signal rdata_resp : std_logic_vector(7 downto 0);
signal rdata_stat : std_logic_vector(7 downto 0);
signal bus_id : std_logic_vector(7 downto 0) := X"00";
signal slot_status : std_logic_vector(7 downto 0);
alias response_valid : std_logic is slot_status(7);
alias status_valid : std_logic is slot_status(6);
alias state : std_logic_vector(1 downto 0) is slot_status(5 downto 4);
alias error_busy : std_logic is slot_status(3);
alias handshake_in : std_logic_vector(2 downto 0) is slot_status(2 downto 0);
begin
-- assert false report integer'image(to_integer(c_cmd_if_command_buffer_end)) severity warning;
-- assert false report integer'image(to_integer(c_cmd_if_response_buffer_end)) severity warning;
-- assert false report integer'image(to_integer(c_cmd_if_status_buffer_end)) severity warning;
--
command_length <= command_pointer - c_cmd_if_command_buffer_addr;
with slot_req.bus_address(2 downto 0) select slot_resp.data <=
slot_status when c_cif_slot_control,
X"C9" when c_cif_slot_command,
rdata_resp when c_cif_slot_response,
rdata_stat when c_cif_slot_status,
bus_id when c_cif_bus_id,
X"FF" when others;
rdata_resp <= rdata when response_valid='1' else X"00";
rdata_stat <= rdata when status_valid='1' else X"00";
slot_resp.reg_output <= enabled when slot_req.bus_address(8 downto 3) = slot_base else '0';
slot_resp.irq <= '0';
slot_resp.nmi <= '0';
-- signals to RAM
en <= enabled;
we <= do_write;
wdata <= slot_req.data;
address <= command_pointer when do_write='1' else
response_pointer when slot_req.bus_address(0)='0' else
status_pointer;
do_write <= '1' when slot_req.io_write='1' and slot_req.io_address(8 downto 0) = (slot_base & c_cif_slot_command) else '0';
p_control: process(clock)
procedure reset_response is
begin
response_pointer <= c_cmd_if_response_buffer_addr;
status_pointer <= c_cmd_if_status_buffer_addr;
end procedure;
begin
if rising_edge(clock) then
if (response_pointer - c_cmd_if_response_buffer_addr) < response_length then
response_valid <= state(1) and not handshake_in(2); -- Only in data state when abort is not set
else
response_valid <= '0';
end if;
if (status_pointer - c_cmd_if_status_buffer_addr) < status_length then
status_valid <= state(1) and not handshake_in(2); -- Only in data state when abort is not set
else
status_valid <= '0';
end if;
if (slot_req.io_address(8 downto 3) = slot_base) and (enabled = '1') then
if slot_req.io_write='1' then
case slot_req.io_address(2 downto 0) is
when c_cif_slot_command =>
if command_pointer /= c_cmd_if_command_buffer_end then
command_pointer <= command_pointer + 1;
end if;
when c_cif_slot_control =>
if slot_req.data(3)='1' then
error_busy <= '0';
end if;
if slot_req.data(0)='1' then
freeze_i <= slot_req.data(7);
trigger <= slot_req.data(6);
if state = "00" then
state <= "01";
handshake_in(0) <= '1';
else
error_busy <= '1';
end if;
end if;
if slot_req.data(1)='1' and state(1) = '1' then -- data accept
handshake_in(1) <= state(0); -- data accepted, only ultimate can clear it, only data more
state(1) <= '0'; -- either goes to idle, or back to wait for software
end if;
if slot_req.data(2)='1' then
handshake_in(2) <= '1'; -- abort, only ultimate can clear it.
end if;
when others =>
null;
end case;
elsif slot_req.io_read='1' then
case slot_req.io_address(2 downto 0) is
when c_cif_slot_response =>
if response_pointer /= c_cmd_if_response_buffer_end then
response_pointer <= response_pointer + 1;
end if;
when c_cif_slot_status =>
if status_pointer /= c_cmd_if_status_buffer_end then
status_pointer <= status_pointer + 1;
end if;
when others =>
null;
end case;
end if;
end if;
if write_ff00 = '1' and trigger = '1' then
freeze_i <= '1';
trigger <= '0';
end if;
io_resp <= c_io_resp_init;
if io_req.write='1' then
io_resp.ack <= '1';
case io_req.address(3 downto 0) is
when c_cif_io_slot_base =>
slot_base <= unsigned(io_req.data(slot_base'range));
when c_cif_io_slot_enable =>
if io_req.data(7) = '0' then
enabled <= io_req.data(0);
else
bus_id(4 downto 0) <= io_req.data(4 downto 0); -- max 31 (valid: 4-30)
end if;
when c_cif_io_handshake_out =>
if io_req.data(0)='1' then -- reset
handshake_in(0) <= '0';
command_pointer <= c_cmd_if_command_buffer_addr;
end if;
if io_req.data(1)='1' then -- data seen
handshake_in(1) <= '0';
end if;
if io_req.data(2)='1' then -- abort bit
handshake_in(2) <= '0';
end if;
if io_req.data(4)='1' then -- validate data
trigger <= '0';
freeze_i <= '0';
state(1) <= '1';
state(0) <= io_req.data(5); -- more bit
reset_response;
end if;
if io_req.data(7)='1' then
freeze_i <= '0';
trigger <= '0';
reset_response;
state <= "00";
end if;
when c_cif_io_status_length =>
status_pointer <= c_cmd_if_status_buffer_addr;
status_length(7 downto 0) <= unsigned(io_req.data); -- FIXME
when c_cif_io_response_len_l =>
response_pointer <= c_cmd_if_response_buffer_addr;
response_length(7 downto 0) <= unsigned(io_req.data);
when c_cif_io_response_len_h =>
response_length(10 downto 8) <= unsigned(io_req.data(2 downto 0));
when c_cif_io_irq_mask =>
irq_mask <= io_req.data(2 downto 0);
when c_cif_io_irq_mask_set =>
irq_mask <= irq_mask or io_req.data(2 downto 0);
when c_cif_io_irq_mask_clear =>
irq_mask <= irq_mask and not io_req.data(2 downto 0);
when others =>
null;
end case;
elsif io_req.read='1' then
io_resp.ack <= '1';
case io_req.address(3 downto 0) is
when c_cif_io_slot_base =>
io_resp.data(slot_base'range) <= std_logic_vector(slot_base);
when c_cif_io_slot_enable =>
io_resp.data(0) <= enabled;
when c_cif_io_handshake_out =>
io_resp.data(7) <= freeze_i;
io_resp.data(6) <= trigger;
io_resp.data(5 downto 4) <= state;
when c_cif_io_handshake_in =>
io_resp.data <= slot_status;
when c_cif_io_command_start =>
io_resp.data <= std_logic_vector(c_cmd_if_command_buffer_addr(10 downto 3));
when c_cif_io_command_end =>
io_resp.data <= std_logic_vector(c_cmd_if_command_buffer_end(10 downto 3));
when c_cif_io_response_start =>
io_resp.data <= std_logic_vector(c_cmd_if_response_buffer_addr(10 downto 3));
when c_cif_io_response_end =>
io_resp.data <= std_logic_vector(c_cmd_if_response_buffer_end(10 downto 3));
when c_cif_io_status_start =>
io_resp.data <= std_logic_vector(c_cmd_if_status_buffer_addr(10 downto 3));
when c_cif_io_status_end =>
io_resp.data <= std_logic_vector(c_cmd_if_status_buffer_end(10 downto 3));
when c_cif_io_status_length =>
io_resp.data <= std_logic_vector(status_pointer(7 downto 0)); -- fixme
when c_cif_io_response_len_l =>
io_resp.data <= std_logic_vector(response_pointer(7 downto 0));
when c_cif_io_response_len_h =>
io_resp.data(2 downto 0) <= std_logic_vector(response_pointer(10 downto 8));
when c_cif_io_command_len_l =>
io_resp.data <= std_logic_vector(command_length(7 downto 0));
when c_cif_io_command_len_h =>
io_resp.data(2 downto 0) <= std_logic_vector(command_length(10 downto 8));
when c_cif_io_irq_mask =>
io_resp.data(2 downto 0) <= irq_mask;
when others =>
null;
end case;
end if;
if reset='1' then
command_pointer <= c_cmd_if_command_buffer_addr;
reset_response;
response_length <= (others => '0');
status_length <= (others => '0');
irq_mask <= "111";
handshake_in <= "000";
state <= "00";
enabled <= '0';
error_busy <= '0';
slot_base <= (others => '0');
freeze_i <= '0';
trigger <= '0';
end if;
end if;
end process;
io_irq <= '1' when (handshake_in and not irq_mask) /= "000" else '0';
freeze <= freeze_i;
end architecture;
| gpl-3.0 | 57db50c130c7725ae3b5432ac1af0f99 | 0.493634 | 3.995576 | false | false | false | false |
xiadz/oscilloscope | src/n_cycles_delayer.vhd | 1 | 1,491 | ----------------------------------------------------------------------------------
-- Author: Osowski Marcin
-- Create Date: 17:31:43 05/22/2011
--
-- Description: This entity delays given signal of width signal_width by n clock cycles.
----------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity n_cycles_delayer is
generic (
n : integer range 2 to 1024;
signal_width : integer range 1 to 1024
);
port (
nrst : in std_logic;
clk : in std_logic;
input : in std_logic_vector (signal_width - 1 downto 0);
output : out std_logic_vector (signal_width - 1 downto 0)
);
end n_cycles_delayer;
architecture behavioral of n_cycles_delayer is
type delay_array_t is array (n - 1 downto 0) of std_logic_vector (signal_width - 1 downto 0);
signal delay_array: delay_array_t ;--:= (others => (others => '0'));
begin
output <= delay_array (n - 1);
process (clk, nrst) is
variable i : integer range 0 to n - 2;
begin
if nrst = '0' then
for i in 0 to n - 1 loop
delay_array (i) <= (others => '0');
end loop;
elsif rising_edge (clk) then
delay_array (0) <= input;
for i in 0 to (n - 2) loop
delay_array (i + 1) <= delay_array (i);
end loop;
end if;
end process;
end architecture behavioral;
| mit | 2a5d8d9e882c028eafafb2c2d5ee3b61 | 0.499665 | 4.02973 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/busses/vhdl_source/io_to_dma_bridge.vhd | 1 | 1,805 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.dma_bus_pkg.all;
entity io_to_dma_bridge is
generic (
g_ignore_stop : boolean := false );
port (
clock : in std_logic;
reset : in std_logic;
c64_stopped : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
dma_req : out t_dma_req;
dma_resp : in t_dma_resp );
end entity;
architecture rtl of io_to_dma_bridge is
signal dma_req_i : t_dma_req := c_dma_req_init;
begin
p_bus: process(clock)
begin
if rising_edge(clock) then
io_resp <= c_io_resp_init;
if dma_resp.rack='1' then
dma_req_i.request <= '0';
if dma_req_i.read_writen='0' then -- was write
io_resp.ack <= '1';
end if;
end if;
if dma_resp.dack='1' then
io_resp.data <= dma_resp.data;
io_resp.ack <= '1';
end if;
if io_req.write='1' or io_req.read = '1' then
dma_req_i.address <= io_req.address(15 downto 0);
dma_req_i.read_writen <= io_req.read;
dma_req_i.data <= io_req.data;
if c64_stopped='1' or g_ignore_stop then
dma_req_i.request <= '1';
else
io_resp.ack <= '1';
end if;
end if;
if reset='1' then
dma_req_i.request <= '0';
end if;
end if;
end process;
dma_req <= dma_req_i;
end architecture;
| gpl-3.0 | ebe9279698b27f832eca40b877aa0c7a | 0.441551 | 3.464491 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb/vhdl_sim/tb_ulpi_interface.vhd | 2 | 2,483 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity tb_ulpi_interface is
end entity;
architecture tb of tb_ulpi_interface is
signal sys_clock : std_logic := '0';
signal sys_reset : std_logic;
signal ULPI_DATA : std_logic_vector(7 downto 0);
signal ULPI_DIR : std_logic;
signal ULPI_NXT : std_logic;
signal ULPI_STP : std_logic;
type t_std_logic_8_vector is array (natural range <>) of std_logic_vector(7 downto 0);
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_mut: entity work.usb1_ulpi_bus
port map (
clock => clock,
reset => reset,
ULPI_DATA => ULPI_DATA,
ULPI_DIR => ULPI_DIR,
ULPI_NXT => ULPI_NXT,
ULPI_STP => ULPI_STP,
-- fifo interface
tx_data => tx_data,
tx_last => tx_last,
tx_valid => tx_valid,
tx_start => tx_start,
tx_next => tx_next,
rx_data => rx_data,
rx_command => rx_command,
rx_last => rx_last,
rx_valid => rx_valid );
i_bfm: entity work.usb1_ulpi_phy_bfm
port map (
clock => clock,
reset => reset,
ULPI_DATA => ULPI_DATA,
ULPI_DIR => ULPI_DIR,
ULPI_NXT => ULPI_NXT,
ULPI_STP => ULPI_STP );
p_test: process
procedure tx_packet(invec : t_std_logic_8_vector; last : boolean) is
begin
wait until clock='1';
tx_start <= '1';
for i in invec'range loop
tx_data <= invec(i);
tx_valid <= '1';
if i = invec'right and last then
tx_last <= '1';
else
tx_last <= '0';
end if;
wait until clock='1';
tx_start <= '0';
while tx_next = '0' loop
wait until clock='1';
end loop;
end loop;
tx_valid <= '0';
end procedure;
begin
wait for 500 ns;
tx_packet((X"40", X"01", X"02", X"03", X"04"), true);
wait for 300 ns;
tx_packet((X"81", X"15"), true);
wait for 300 ns;
tx_packet((0 => X"C2"), false);
wait;
end process;
end tb;
| gpl-3.0 | ad05511c63c59cc0a8dfb43f007aae86 | 0.448248 | 3.733835 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/iec_interface/vhdl_source/iec_processor_io.vhd | 1 | 8,959 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
-- LUT/FF/S3S/BRAM: 260/111/136/1
library work;
use work.io_bus_pkg.all;
library unisim;
use unisim.vcomponents.all;
entity iec_processor_io is
port (
clock : in std_logic;
reset : in std_logic;
tick : in std_logic;
req : in t_io_req;
resp : out t_io_resp;
irq : out std_logic;
clk_o : out std_logic;
clk_i : in std_logic;
data_o : out std_logic;
data_i : in std_logic;
atn_o : out std_logic;
atn_i : in std_logic;
srq_o : out std_logic;
srq_i : in std_logic );
end iec_processor_io;
architecture structural of iec_processor_io is
signal proc_reset : std_logic;
signal enable : std_logic;
-- irq
signal irq_event : std_logic;
signal irq_enable : std_logic;
signal irq_status : std_logic;
-- instruction ram interface
signal instr_addr : unsigned(8 downto 0);
signal instr_en : std_logic;
signal instr_data : std_logic_vector(31 downto 0);
-- software fifo interface
signal up_fifo_get : std_logic;
signal up_fifo_put : std_logic;
signal up_fifo_din : std_logic_vector(8 downto 0);
signal up_fifo_dout : std_logic_vector(8 downto 0);
signal up_fifo_empty : std_logic;
signal up_fifo_full : std_logic;
signal up_fifo_count : integer range 0 to 2048;
signal down_fifo_flush : std_logic;
signal down_fifo_empty : std_logic;
signal down_fifo_full : std_logic;
signal down_fifo_release : std_logic;
signal down_fifo_get : std_logic;
signal down_fifo_put : std_logic;
signal down_fifo_din : std_logic_vector(9 downto 0);
signal down_fifo_dout : std_logic_vector(9 downto 0);
signal down_dav : std_logic;
signal down_space : std_logic;
signal ram_en : std_logic;
signal ram_rdata : std_logic_vector(7 downto 0);
signal ram_sel : std_logic;
signal reg_rdata : std_logic_vector(7 downto 0);
begin
i_proc: entity work.iec_processor
port map (
clock => clock,
reset => proc_reset,
tick => tick,
-- instruction ram interface
instr_addr => instr_addr,
instr_en => instr_en,
instr_data => instr_data(29 downto 0),
-- software fifo interface
up_fifo_put => up_fifo_put,
up_fifo_din => up_fifo_din,
up_fifo_full => up_fifo_full,
down_fifo_empty => down_fifo_empty,
down_fifo_get => down_fifo_get,
down_fifo_dout => down_fifo_dout,
down_fifo_flush => down_fifo_flush,
down_fifo_release => down_fifo_release,
irq_event => irq_event,
clk_o => clk_o,
clk_i => clk_i,
data_o => data_o,
data_i => data_i,
atn_o => atn_o,
atn_i => atn_i,
srq_o => srq_o,
srq_i => srq_i );
i_ram: RAMB16_S9_S36
generic map (
WRITE_MODE_A => "WRITE_FIRST",
WRITE_MODE_B => "WRITE_FIRST" )
port map (
DOA => ram_rdata,
ADDRA => std_logic_vector(req.address(10 downto 0)),
CLKA => clock,
DIA => req.data,
DIPA => "0",
ENA => ram_en,
SSRA => '0',
WEA => req.write,
DOB(31 downto 24) => instr_data(7 downto 0), -- CPU is big endian
DOB(23 downto 16) => instr_data(15 downto 8),
DOB(15 downto 8) => instr_data(23 downto 16),
DOB(7 downto 0) => instr_data(31 downto 24),
ADDRB => std_logic_vector(instr_addr),
CLKB => clock,
DIB => X"00000000",
DIPB => X"0",
ENB => instr_en,
SSRB => '0',
WEB => '0' );
i_up_fifo: entity work.sync_fifo
generic map (
g_depth => 2048,
g_data_width => 9,
g_threshold => 500,
g_storage => "blockram", -- can also be "blockram" or "distributed"
g_fall_through => true )
port map (
clock => clock,
reset => reset,
rd_en => up_fifo_get,
wr_en => up_fifo_put,
din => up_fifo_din,
dout => up_fifo_dout,
flush => proc_reset,
full => up_fifo_full,
almost_full => open,
empty => up_fifo_empty,
count => up_fifo_count );
i_down_fifo: entity work.srl_fifo
generic map (
Width => 10,
Depth => 15, -- 15 is the maximum
Threshold => 13 )
port map (
clock => clock,
reset => proc_reset,
GetElement => down_fifo_get,
PutElement => down_fifo_put,
FlushFifo => down_fifo_flush,
DataIn => down_fifo_din,
DataOut => down_fifo_dout,
SpaceInFifo => down_space,
AlmostFull => open,
DataInFifo => down_dav);
down_fifo_empty <= not down_dav;
down_fifo_full <= not down_space;
process(clock)
-- variable value : unsigned(15 downto 0);
begin
if rising_edge(clock) then
down_fifo_release <= '0';
ram_sel <= '0';
reg_rdata <= (others => '0');
proc_reset <= not enable;
resp.ack <= '0';
-- value := to_unsigned(up_fifo_count, 16);
if req.read='1' then
resp.ack <= '1'; -- data handled outside clocked process if ram
ram_sel <= req.address(11);
case req.address(3 downto 0) is
when X"0" =>
reg_rdata <= X"25"; -- version
when X"1" =>
reg_rdata(0) <= down_fifo_empty;
reg_rdata(1) <= down_fifo_full or down_fifo_flush;
when X"2" =>
reg_rdata(0) <= up_fifo_empty;
reg_rdata(1) <= up_fifo_full;
reg_rdata(7) <= up_fifo_dout(8);
when X"6"|X"8"|X"9"|X"A"|X"B" =>
reg_rdata <= up_fifo_dout(7 downto 0);
when X"7" =>
reg_rdata <= "0000000" & up_fifo_dout(8);
when X"C" =>
reg_rdata <= "0000000" & irq_status;
-- when X"E" =>
-- reg_rdata <= std_logic_vector(value(7 downto 0));
--
-- when X"F" =>
-- reg_rdata <= std_logic_vector(value(15 downto 8));
--
when others => null;
end case;
elsif req.write='1' then
resp.ack <= '1'; -- data handled outside clocked process if ram
if req.address(11)='0' then
case req.address(3 downto 0) is
when X"3" =>
proc_reset <= '1';
enable <= req.data(0);
when X"C" =>
irq_status <= '0';
irq_enable <= req.data(0);
when X"D" =>
down_fifo_release <= '1';
when others =>
null;
end case;
end if;
end if;
if irq_event='1' then
irq_status <= '1';
end if;
irq <= irq_enable and irq_status;
if reset='1' then
proc_reset <= '1';
enable <= '0';
end if;
end if;
end process;
resp.data <= ram_rdata when ram_sel='1' else reg_rdata;
down_fifo_put <= '1' when req.write='1' and req.address(11)='0' and req.address(3 downto 2) = "10" else '0';
up_fifo_get <= '1' when req.read='1' and req.address(11)='0' and ((req.address(3 downto 0) = "0110") or (req.address(3 downto 2) = "10")) else '0';
down_fifo_din <= std_logic_vector(req.address(1 downto 0)) & req.data;
ram_en <= (req.write or req.read) and req.address(11);
end structural;
| gpl-3.0 | 49de4d860cc8bf4d7f39f3944c0903cd | 0.437884 | 3.853333 | false | false | false | false |
asicguy/crash | fpga/src/toplevel/zc702.vhd | 2 | 63,731 | -------------------------------------------------------------------------------
-- Copyright 2013-2014 Jonathon Pendlum
--
-- This 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 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/>.
--
--
-- File: zc706.vhd
-- Author: Jonathon Pendlum ([email protected])
-- Description: Toplevel file for ZC702.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library unisim;
use unisim.vcomponents.all;
entity zc702 is
port (
-- ARM Connections
MIO : inout std_logic_vector(53 downto 0);
PS_SRSTB : in std_logic;
PS_CLK : in std_logic;
PS_PORB : in std_logic;
DDR_Clk : inout std_logic;
DDR_Clk_n : inout std_logic;
DDR_CKE : inout std_logic;
DDR_CS_n : inout std_logic;
DDR_RAS_n : inout std_logic;
DDR_CAS_n : inout std_logic;
DDR_WEB_pin : out std_logic;
DDR_BankAddr : inout std_logic_vector(2 downto 0);
DDR_Addr : inout std_logic_vector(14 downto 0);
DDR_ODT : inout std_logic;
DDR_DRSTB : inout std_logic;
DDR_DQ : inout std_logic_vector(31 downto 0);
DDR_DM : inout std_logic_vector(3 downto 0);
DDR_DQS : inout std_logic_vector(3 downto 0);
DDR_DQS_n : inout std_logic_vector(3 downto 0);
DDR_VRP : inout std_logic;
DDR_VRN : inout std_logic;
-- USRP DDR Interface
RX_DATA_CLK_N : in std_logic;
RX_DATA_CLK_P : in std_logic;
RX_DATA_N : in std_logic_vector(6 downto 0);
RX_DATA_P : in std_logic_vector(6 downto 0);
TX_DATA_N : out std_logic_vector(7 downto 0);
TX_DATA_P : out std_logic_vector(7 downto 0);
SPARE : out std_logic;
UART_TX : out std_logic);
end entity;
architecture RTL of zc702 is
-------------------------------------------------------------------------------
-- Component Declaration
-------------------------------------------------------------------------------
component zc702_ps is
port (
processing_system7_0_MIO : inout std_logic_vector(53 downto 0);
processing_system7_0_PS_SRSTB_pin : in std_logic;
processing_system7_0_PS_CLK_pin : in std_logic;
processing_system7_0_PS_PORB_pin : in std_logic;
processing_system7_0_DDR_Clk : inout std_logic;
processing_system7_0_DDR_Clk_n : inout std_logic;
processing_system7_0_DDR_CKE : inout std_logic;
processing_system7_0_DDR_CS_n : inout std_logic;
processing_system7_0_DDR_RAS_n : inout std_logic;
processing_system7_0_DDR_CAS_n : inout std_logic;
processing_system7_0_DDR_WEB_pin : out std_logic;
processing_system7_0_DDR_BankAddr : inout std_logic_vector(2 downto 0);
processing_system7_0_DDR_Addr : inout std_logic_vector(14 downto 0);
processing_system7_0_DDR_ODT : inout std_logic;
processing_system7_0_DDR_DRSTB : inout std_logic;
processing_system7_0_DDR_DQ : inout std_logic_vector(31 downto 0);
processing_system7_0_DDR_DM : inout std_logic_vector(3 downto 0);
processing_system7_0_DDR_DQS : inout std_logic_vector(3 downto 0);
processing_system7_0_DDR_DQS_n : inout std_logic_vector(3 downto 0);
processing_system7_0_DDR_VRN : inout std_logic;
processing_system7_0_DDR_VRP : inout std_logic;
axi_ext_slave_conn_0_M_AXI_AWADDR_pin : out std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_AWVALID_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_AWREADY_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_WDATA_pin : out std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_WSTRB_pin : out std_logic_vector(3 downto 0);
axi_ext_slave_conn_0_M_AXI_WVALID_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_WREADY_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_BRESP_pin : in std_logic_vector(1 downto 0);
axi_ext_slave_conn_0_M_AXI_BVALID_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_BREADY_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_ARADDR_pin : out std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_ARVALID_pin : out std_logic;
axi_ext_slave_conn_0_M_AXI_ARREADY_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_RDATA_pin : in std_logic_vector(31 downto 0);
axi_ext_slave_conn_0_M_AXI_RRESP_pin : in std_logic_vector(1 downto 0);
axi_ext_slave_conn_0_M_AXI_RVALID_pin : in std_logic;
axi_ext_slave_conn_0_M_AXI_RREADY_pin : out std_logic;
processing_system7_0_IRQ_F2P_pin : in std_logic_vector(15 downto 0);
processing_system7_0_FCLK_CLK0_pin : out std_logic;
processing_system7_0_FCLK_RESET0_N_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_AWADDR_pin : in std_logic_vector(31 downto 0);
axi_ext_master_conn_0_S_AXI_AWLEN_pin : in std_logic_vector(7 downto 0);
axi_ext_master_conn_0_S_AXI_AWSIZE_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_AWBURST_pin : in std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_AWCACHE_pin : in std_logic_vector(3 downto 0);
axi_ext_master_conn_0_S_AXI_AWPROT_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_AWVALID_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_AWREADY_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_WDATA_pin : in std_logic_vector(63 downto 0);
axi_ext_master_conn_0_S_AXI_WSTRB_pin : in std_logic_vector(7 downto 0);
axi_ext_master_conn_0_S_AXI_WLAST_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_WVALID_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_WREADY_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_BRESP_pin : out std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_BVALID_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_BREADY_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_ARADDR_pin : in std_logic_vector(31 downto 0);
axi_ext_master_conn_0_S_AXI_ARLEN_pin : in std_logic_vector(7 downto 0);
axi_ext_master_conn_0_S_AXI_ARSIZE_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_ARBURST_pin : in std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_ARCACHE_pin : in std_logic_vector(3 downto 0);
axi_ext_master_conn_0_S_AXI_ARPROT_pin : in std_logic_vector(2 downto 0);
axi_ext_master_conn_0_S_AXI_ARVALID_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_ARREADY_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_RDATA_pin : out std_logic_vector(63 downto 0);
axi_ext_master_conn_0_S_AXI_RRESP_pin : out std_logic_vector(1 downto 0);
axi_ext_master_conn_0_S_AXI_RLAST_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_RVALID_pin : out std_logic;
axi_ext_master_conn_0_S_AXI_RREADY_pin : in std_logic;
axi_ext_master_conn_0_S_AXI_AWUSER_pin : in std_logic_vector(4 downto 0);
axi_ext_master_conn_0_S_AXI_ARUSER_pin : in std_logic_vector(4 downto 0));
end component;
component ps_pl_interface is
generic (
C_BASEADDR : std_logic_vector(31 downto 0) := x"40000000";
C_HIGHADDR : std_logic_vector(31 downto 0) := x"4001ffff");
port (
-- AXIS Stream Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- AXI-Lite Slave bus for access to control & status registers
S_AXI_AWADDR : in std_logic_vector(31 downto 0);
S_AXI_AWVALID : in std_logic;
S_AXI_AWREADY : out std_logic;
S_AXI_WDATA : in std_logic_vector(31 downto 0);
S_AXI_WSTRB : in std_logic_vector(3 downto 0);
S_AXI_WVALID : in std_logic;
S_AXI_WREADY : out std_logic;
S_AXI_BRESP : out std_logic_vector(1 downto 0);
S_AXI_BVALID : out std_logic;
S_AXI_BREADY : in std_logic;
S_AXI_ARADDR : in std_logic_vector(31 downto 0);
S_AXI_ARVALID : in std_logic;
S_AXI_ARREADY : out std_logic;
S_AXI_RDATA : out std_logic_vector(31 downto 0);
S_AXI_RRESP : out std_logic_vector(1 downto 0);
S_AXI_RVALID : out std_logic;
S_AXI_RREADY : in std_logic;
-- AXI ACP Bus to interface with processor system
M_AXI_AWADDR : out std_logic_vector(31 downto 0);
M_AXI_AWPROT : out std_logic_vector(2 downto 0);
M_AXI_AWVALID : out std_logic;
M_AXI_AWREADY : in std_logic;
M_AXI_WDATA : out std_logic_vector(63 downto 0);
M_AXI_WSTRB : out std_logic_vector(7 downto 0);
M_AXI_WVALID : out std_logic;
M_AXI_WREADY : in std_logic;
M_AXI_BRESP : in std_logic_vector(1 downto 0);
M_AXI_BVALID : in std_logic;
M_AXI_BREADY : out std_logic;
M_AXI_AWLEN : out std_logic_vector(7 downto 0);
M_AXI_AWSIZE : out std_logic_vector(2 downto 0);
M_AXI_AWBURST : out std_logic_vector(1 downto 0);
M_AXI_AWCACHE : out std_logic_vector(3 downto 0);
M_AXI_AWUSER : out std_logic_vector(4 downto 0);
M_AXI_WLAST : out std_logic;
M_AXI_ARADDR : out std_logic_vector(31 downto 0);
M_AXI_ARPROT : out std_logic_vector(2 downto 0);
M_AXI_ARVALID : out std_logic;
M_AXI_ARREADY : in std_logic;
M_AXI_RDATA : in std_logic_vector(63 downto 0);
M_AXI_RRESP : in std_logic_vector(1 downto 0);
M_AXI_RVALID : in std_logic;
M_AXI_RREADY : out std_logic;
M_AXI_RLAST : in std_logic;
M_AXI_ARCACHE : out std_logic_vector(3 downto 0);
M_AXI_ARUSER : out std_logic_vector(4 downto 0);
M_AXI_ARLEN : out std_logic_vector(7 downto 0);
M_AXI_ARBURST : out std_logic_vector(1 downto 0);
M_AXI_ARSIZE : out std_logic_vector(2 downto 0);
-- Interrupt on successfully completed AXI ACP writes
irq : out std_logic;
-- Global reset for all accelerators
rst_glb_n : out std_logic;
-- Accelerator interfaces
-- Note: Master & Slave 0 are not listed as the Datamover componeent
-- uses both.
-- Accelerator 1
-- Accelerator 1
axis_master_1_tvalid : in std_logic;
axis_master_1_tready : out std_logic;
axis_master_1_tdata : in std_logic_vector(63 downto 0);
axis_master_1_tdest : in std_logic_vector(2 downto 0);
axis_master_1_tlast : in std_logic;
axis_master_1_irq : in std_logic;
axis_slave_1_tvalid : out std_logic;
axis_slave_1_tready : in std_logic;
axis_slave_1_tdata : out std_logic_vector(63 downto 0);
axis_slave_1_tid : out std_logic_vector(2 downto 0);
axis_slave_1_tlast : out std_logic;
axis_slave_1_irq : in std_logic;
status_1_addr : out std_logic_vector(7 downto 0);
status_1_data : in std_logic_vector(31 downto 0);
status_1_stb : out std_logic;
ctrl_1_addr : out std_logic_vector(7 downto 0);
ctrl_1_data : out std_logic_vector(31 downto 0);
ctrl_1_stb : out std_logic;
-- Accelerator 2
axis_master_2_tvalid : in std_logic;
axis_master_2_tready : out std_logic;
axis_master_2_tdata : in std_logic_vector(63 downto 0);
axis_master_2_tdest : in std_logic_vector(2 downto 0);
axis_master_2_tlast : in std_logic;
axis_master_2_irq : in std_logic;
axis_slave_2_tvalid : out std_logic;
axis_slave_2_tready : in std_logic;
axis_slave_2_tdata : out std_logic_vector(63 downto 0);
axis_slave_2_tid : out std_logic_vector(2 downto 0);
axis_slave_2_tlast : out std_logic;
axis_slave_2_irq : in std_logic;
status_2_addr : out std_logic_vector(7 downto 0);
status_2_data : in std_logic_vector(31 downto 0);
status_2_stb : out std_logic;
ctrl_2_addr : out std_logic_vector(7 downto 0);
ctrl_2_data : out std_logic_vector(31 downto 0);
ctrl_2_stb : out std_logic;
-- Accelerator 3
axis_master_3_tvalid : in std_logic;
axis_master_3_tready : out std_logic;
axis_master_3_tdata : in std_logic_vector(63 downto 0);
axis_master_3_tdest : in std_logic_vector(2 downto 0);
axis_master_3_tlast : in std_logic;
axis_master_3_irq : in std_logic;
axis_slave_3_tvalid : out std_logic;
axis_slave_3_tready : in std_logic;
axis_slave_3_tdata : out std_logic_vector(63 downto 0);
axis_slave_3_tid : out std_logic_vector(2 downto 0);
axis_slave_3_tlast : out std_logic;
axis_slave_3_irq : in std_logic;
status_3_addr : out std_logic_vector(7 downto 0);
status_3_data : in std_logic_vector(31 downto 0);
status_3_stb : out std_logic;
ctrl_3_addr : out std_logic_vector(7 downto 0);
ctrl_3_data : out std_logic_vector(31 downto 0);
ctrl_3_stb : out std_logic;
-- Accelerator 4
axis_master_4_tvalid : in std_logic;
axis_master_4_tready : out std_logic;
axis_master_4_tdata : in std_logic_vector(63 downto 0);
axis_master_4_tdest : in std_logic_vector(2 downto 0);
axis_master_4_tlast : in std_logic;
axis_master_4_irq : in std_logic;
axis_slave_4_tvalid : out std_logic;
axis_slave_4_tready : in std_logic;
axis_slave_4_tdata : out std_logic_vector(63 downto 0);
axis_slave_4_tid : out std_logic_vector(2 downto 0);
axis_slave_4_tlast : out std_logic;
axis_slave_4_irq : in std_logic;
status_4_addr : out std_logic_vector(7 downto 0);
status_4_data : in std_logic_vector(31 downto 0);
status_4_stb : out std_logic;
ctrl_4_addr : out std_logic_vector(7 downto 0);
ctrl_4_data : out std_logic_vector(31 downto 0);
ctrl_4_stb : out std_logic;
-- Accelerator 5
axis_master_5_tvalid : in std_logic;
axis_master_5_tready : out std_logic;
axis_master_5_tdata : in std_logic_vector(63 downto 0);
axis_master_5_tdest : in std_logic_vector(2 downto 0);
axis_master_5_tlast : in std_logic;
axis_master_5_irq : in std_logic;
axis_slave_5_tvalid : out std_logic;
axis_slave_5_tready : in std_logic;
axis_slave_5_tdata : out std_logic_vector(63 downto 0);
axis_slave_5_tid : out std_logic_vector(2 downto 0);
axis_slave_5_tlast : out std_logic;
axis_slave_5_irq : in std_logic;
status_5_addr : out std_logic_vector(7 downto 0);
status_5_data : in std_logic_vector(31 downto 0);
status_5_stb : out std_logic;
ctrl_5_addr : out std_logic_vector(7 downto 0);
ctrl_5_data : out std_logic_vector(31 downto 0);
ctrl_5_stb : out std_logic;
-- Accelerator 6
axis_master_6_tvalid : in std_logic;
axis_master_6_tready : out std_logic;
axis_master_6_tdata : in std_logic_vector(63 downto 0);
axis_master_6_tdest : in std_logic_vector(2 downto 0);
axis_master_6_tlast : in std_logic;
axis_master_6_irq : in std_logic;
axis_slave_6_tvalid : out std_logic;
axis_slave_6_tready : in std_logic;
axis_slave_6_tdata : out std_logic_vector(63 downto 0);
axis_slave_6_tid : out std_logic_vector(2 downto 0);
axis_slave_6_tlast : out std_logic;
axis_slave_6_irq : in std_logic;
status_6_addr : out std_logic_vector(7 downto 0);
status_6_data : in std_logic_vector(31 downto 0);
status_6_stb : out std_logic;
ctrl_6_addr : out std_logic_vector(7 downto 0);
ctrl_6_data : out std_logic_vector(31 downto 0);
ctrl_6_stb : out std_logic;
-- Accelerator 7
axis_master_7_tvalid : in std_logic;
axis_master_7_tready : out std_logic;
axis_master_7_tdata : in std_logic_vector(63 downto 0);
axis_master_7_tdest : in std_logic_vector(2 downto 0);
axis_master_7_tlast : in std_logic;
axis_master_7_irq : in std_logic;
axis_slave_7_tvalid : out std_logic;
axis_slave_7_tready : in std_logic;
axis_slave_7_tdata : out std_logic_vector(63 downto 0);
axis_slave_7_tid : out std_logic_vector(2 downto 0);
axis_slave_7_tlast : out std_logic;
axis_slave_7_irq : in std_logic;
status_7_addr : out std_logic_vector(7 downto 0);
status_7_data : in std_logic_vector(31 downto 0);
status_7_stb : out std_logic;
ctrl_7_addr : out std_logic_vector(7 downto 0);
ctrl_7_data : out std_logic_vector(31 downto 0);
ctrl_7_stb : out std_logic);
end component;
component usrp_ddr_intf_axis is
generic (
DDR_CLOCK_FREQ : integer := 100e6; -- Clock rate of DDR interface
BAUD : integer := 115200); -- UART baud rate
port (
-- USRP Interface
UART_TX : out std_logic; -- UART
RX_DATA_CLK_N : in std_logic; -- Receive data clock (N)
RX_DATA_CLK_P : in std_logic; -- Receive data clock (P)
RX_DATA_N : in std_logic_vector(6 downto 0); -- Receive data (N)
RX_DATA_P : in std_logic_vector(6 downto 0); -- Receive data (N)
TX_DATA_N : out std_logic_vector(7 downto 0); -- Transmit data (N)
TX_DATA_P : out std_logic_vector(7 downto 0); -- Transmit data (P)
-- Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- Control and Status Registers
status_addr : in std_logic_vector(7 downto 0);
status_data : out std_logic_vector(31 downto 0);
status_stb : in std_logic;
ctrl_addr : in std_logic_vector(7 downto 0);
ctrl_data : in std_logic_vector(31 downto 0);
ctrl_stb : in std_logic;
-- AXIS Stream Slave Interface (DAC / TX Data)
axis_slave_tvalid : in std_logic;
axis_slave_tready : out std_logic;
axis_slave_tdata : in std_logic_vector(63 downto 0);
axis_slave_tid : in std_logic_vector(2 downto 0);
axis_slave_tlast : in std_logic;
axis_slave_irq : out std_logic; -- Not used
-- AXIS Stream Master Interface (ADC / RX Data)
axis_master_tvalid : out std_logic;
axis_master_tready : in std_logic;
axis_master_tdata : out std_logic_vector(63 downto 0);
axis_master_tdest : out std_logic_vector(2 downto 0);
axis_master_tlast : out std_logic;
axis_master_irq : out std_logic; -- Not used
-- Sideband signals
rx_enable_aux : in std_logic;
tx_enable_aux : in std_logic);
end component;
component spectrum_sense is
port (
-- Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- Control and Status Registers
status_addr : in std_logic_vector(7 downto 0);
status_data : out std_logic_vector(31 downto 0);
status_stb : in std_logic;
ctrl_addr : in std_logic_vector(7 downto 0);
ctrl_data : in std_logic_vector(31 downto 0);
ctrl_stb : in std_logic;
-- AXIS Stream Slave Interface (Time Domain / FFT Input)
axis_slave_tvalid : in std_logic;
axis_slave_tready : out std_logic;
axis_slave_tdata : in std_logic_vector(63 downto 0);
axis_slave_tid : in std_logic_vector(2 downto 0);
axis_slave_tlast : in std_logic;
axis_slave_irq : out std_logic; -- Not used
-- AXIS Stream Master Interface (Frequency Domain / FFT Output)
axis_master_tvalid : out std_logic;
axis_master_tready : in std_logic;
axis_master_tdata : out std_logic_vector(63 downto 0);
axis_master_tdest : out std_logic_vector(2 downto 0);
axis_master_tlast : out std_logic;
axis_master_irq : out std_logic; -- Strobes when threshold exceeded
-- Sideband signals
threshold_not_exceeded : out std_logic;
threshold_not_exceeded_stb : out std_logic;
threshold_exceeded : out std_logic;
threshold_exceeded_stb : out std_logic);
end component;
component bpsk_mod is
port (
-- Clock and Reset
clk : in std_logic;
rst_n : in std_logic;
-- Control and Status Registers
status_addr : in std_logic_vector(7 downto 0);
status_data : out std_logic_vector(31 downto 0);
status_stb : in std_logic;
ctrl_addr : in std_logic_vector(7 downto 0);
ctrl_data : in std_logic_vector(31 downto 0);
ctrl_stb : in std_logic;
-- AXIS Stream Slave Interface (Binary Data)
axis_slave_tvalid : in std_logic;
axis_slave_tready : out std_logic;
axis_slave_tdata : in std_logic_vector(63 downto 0);
axis_slave_tid : in std_logic_vector(2 downto 0);
axis_slave_tlast : in std_logic;
axis_slave_irq : out std_logic; -- Not used (TODO: maybe use for near empty input FIFO?)
-- AXIS Stream Master Interface (Modulated complex samples)
axis_master_tvalid : out std_logic;
axis_master_tready : in std_logic;
axis_master_tdata : out std_logic_vector(63 downto 0);
axis_master_tdest : out std_logic_vector(2 downto 0);
axis_master_tlast : out std_logic;
axis_master_irq : out std_logic; -- Not used
-- Sideband signals
trigger_stb : in std_logic);
end component;
-----------------------------------------------------------------------------
-- Signals Declaration
-----------------------------------------------------------------------------
signal clk : std_logic;
signal rst_n : std_logic;
signal S_AXI_AWADDR : std_logic_vector(31 downto 0);
signal S_AXI_AWVALID : std_logic;
signal S_AXI_AWREADY : std_logic;
signal S_AXI_WDATA : std_logic_vector(31 downto 0);
signal S_AXI_WSTRB : std_logic_vector(3 downto 0);
signal S_AXI_WVALID : std_logic;
signal S_AXI_WREADY : std_logic;
signal S_AXI_BRESP : std_logic_vector(1 downto 0);
signal S_AXI_BVALID : std_logic;
signal S_AXI_BREADY : std_logic;
signal S_AXI_ARADDR : std_logic_vector(31 downto 0);
signal S_AXI_ARVALID : std_logic;
signal S_AXI_ARREADY : std_logic;
signal S_AXI_RDATA : std_logic_vector(31 downto 0);
signal S_AXI_RRESP : std_logic_vector(1 downto 0);
signal S_AXI_RVALID : std_logic;
signal S_AXI_RREADY : std_logic;
signal M_AXI_AWADDR : std_logic_vector(31 downto 0);
signal M_AXI_AWPROT : std_logic_vector(2 downto 0);
signal M_AXI_AWVALID : std_logic;
signal M_AXI_AWREADY : std_logic;
signal M_AXI_WDATA : std_logic_vector(63 downto 0);
signal M_AXI_WSTRB : std_logic_vector(7 downto 0);
signal M_AXI_WVALID : std_logic;
signal M_AXI_WREADY : std_logic;
signal M_AXI_BRESP : std_logic_vector(1 downto 0);
signal M_AXI_BVALID : std_logic;
signal M_AXI_BREADY : std_logic;
signal M_AXI_AWLEN : std_logic_vector(7 downto 0);
signal M_AXI_AWSIZE : std_logic_vector(2 downto 0);
signal M_AXI_AWBURST : std_logic_vector(1 downto 0);
signal M_AXI_AWCACHE : std_logic_vector(3 downto 0);
signal M_AXI_AWUSER : std_logic_vector(4 downto 0);
signal M_AXI_WLAST : std_logic;
signal M_AXI_ARADDR : std_logic_vector(31 downto 0);
signal M_AXI_ARPROT : std_logic_vector(2 downto 0);
signal M_AXI_ARVALID : std_logic;
signal M_AXI_ARREADY : std_logic;
signal M_AXI_RDATA : std_logic_vector(63 downto 0);
signal M_AXI_RRESP : std_logic_vector(1 downto 0);
signal M_AXI_RVALID : std_logic;
signal M_AXI_RREADY : std_logic;
signal M_AXI_RLAST : std_logic;
signal M_AXI_ARCACHE : std_logic_vector(3 downto 0);
signal M_AXI_ARUSER : std_logic_vector(4 downto 0);
signal M_AXI_ARLEN : std_logic_vector(7 downto 0);
signal M_AXI_ARBURST : std_logic_vector(1 downto 0);
signal M_AXI_ARSIZE : std_logic_vector(2 downto 0);
signal processing_system7_0_IRQ_F2P_pin : std_logic_vector(15 downto 0);
signal irq : std_logic;
signal rst_glb_n : std_logic;
signal axis_master_1_tvalid : std_logic;
signal axis_master_1_tready : std_logic;
signal axis_master_1_tdata : std_logic_vector(63 downto 0);
signal axis_master_1_tdest : std_logic_vector(2 downto 0);
signal axis_master_1_tlast : std_logic;
signal axis_master_1_irq : std_logic;
signal axis_slave_1_tvalid : std_logic;
signal axis_slave_1_tready : std_logic;
signal axis_slave_1_tdata : std_logic_vector(63 downto 0);
signal axis_slave_1_tid : std_logic_vector(2 downto 0);
signal axis_slave_1_tlast : std_logic;
signal axis_slave_1_irq : std_logic;
signal status_1_addr : std_logic_vector(7 downto 0);
signal status_1_data : std_logic_vector(31 downto 0);
signal status_1_stb : std_logic;
signal ctrl_1_addr : std_logic_vector(7 downto 0);
signal ctrl_1_data : std_logic_vector(31 downto 0);
signal ctrl_1_stb : std_logic;
signal axis_master_2_tvalid : std_logic;
signal axis_master_2_tready : std_logic;
signal axis_master_2_tdata : std_logic_vector(63 downto 0);
signal axis_master_2_tdest : std_logic_vector(2 downto 0);
signal axis_master_2_tlast : std_logic;
signal axis_master_2_irq : std_logic;
signal axis_slave_2_tvalid : std_logic;
signal axis_slave_2_tready : std_logic;
signal axis_slave_2_tdata : std_logic_vector(63 downto 0);
signal axis_slave_2_tid : std_logic_vector(2 downto 0);
signal axis_slave_2_tlast : std_logic;
signal axis_slave_2_irq : std_logic;
signal status_2_addr : std_logic_vector(7 downto 0);
signal status_2_data : std_logic_vector(31 downto 0);
signal status_2_stb : std_logic;
signal ctrl_2_addr : std_logic_vector(7 downto 0);
signal ctrl_2_data : std_logic_vector(31 downto 0);
signal ctrl_2_stb : std_logic;
signal axis_master_3_tvalid : std_logic;
signal axis_master_3_tready : std_logic;
signal axis_master_3_tdata : std_logic_vector(63 downto 0);
signal axis_master_3_tdest : std_logic_vector(2 downto 0);
signal axis_master_3_tlast : std_logic;
signal axis_master_3_irq : std_logic;
signal axis_slave_3_tvalid : std_logic;
signal axis_slave_3_tready : std_logic;
signal axis_slave_3_tdata : std_logic_vector(63 downto 0);
signal axis_slave_3_tid : std_logic_vector(2 downto 0);
signal axis_slave_3_tlast : std_logic;
signal axis_slave_3_irq : std_logic;
signal status_3_addr : std_logic_vector(7 downto 0);
signal status_3_data : std_logic_vector(31 downto 0);
signal status_3_stb : std_logic;
signal ctrl_3_addr : std_logic_vector(7 downto 0);
signal ctrl_3_data : std_logic_vector(31 downto 0);
signal ctrl_3_stb : std_logic;
signal axis_master_4_tvalid : std_logic;
signal axis_master_4_tready : std_logic;
signal axis_master_4_tdata : std_logic_vector(63 downto 0);
signal axis_master_4_tdest : std_logic_vector(2 downto 0);
signal axis_master_4_tlast : std_logic;
signal axis_master_4_irq : std_logic;
signal axis_slave_4_tvalid : std_logic;
signal axis_slave_4_tready : std_logic;
signal axis_slave_4_tdata : std_logic_vector(63 downto 0);
signal axis_slave_4_tid : std_logic_vector(2 downto 0);
signal axis_slave_4_tlast : std_logic;
signal axis_slave_4_irq : std_logic;
signal status_4_addr : std_logic_vector(7 downto 0);
signal status_4_data : std_logic_vector(31 downto 0);
signal status_4_stb : std_logic;
signal ctrl_4_addr : std_logic_vector(7 downto 0);
signal ctrl_4_data : std_logic_vector(31 downto 0);
signal ctrl_4_stb : std_logic;
signal axis_master_5_tvalid : std_logic;
signal axis_master_5_tready : std_logic;
signal axis_master_5_tdata : std_logic_vector(63 downto 0);
signal axis_master_5_tdest : std_logic_vector(2 downto 0);
signal axis_master_5_tlast : std_logic;
signal axis_master_5_irq : std_logic;
signal axis_slave_5_tvalid : std_logic;
signal axis_slave_5_tready : std_logic;
signal axis_slave_5_tdata : std_logic_vector(63 downto 0);
signal axis_slave_5_tid : std_logic_vector(2 downto 0);
signal axis_slave_5_tlast : std_logic;
signal axis_slave_5_irq : std_logic;
signal status_5_addr : std_logic_vector(7 downto 0);
signal status_5_data : std_logic_vector(31 downto 0);
signal status_5_stb : std_logic;
signal ctrl_5_addr : std_logic_vector(7 downto 0);
signal ctrl_5_data : std_logic_vector(31 downto 0);
signal ctrl_5_stb : std_logic;
signal axis_master_6_tvalid : std_logic;
signal axis_master_6_tready : std_logic;
signal axis_master_6_tdata : std_logic_vector(63 downto 0);
signal axis_master_6_tdest : std_logic_vector(2 downto 0);
signal axis_master_6_tlast : std_logic;
signal axis_master_6_irq : std_logic;
signal axis_slave_6_tvalid : std_logic;
signal axis_slave_6_tready : std_logic;
signal axis_slave_6_tdata : std_logic_vector(63 downto 0);
signal axis_slave_6_tid : std_logic_vector(2 downto 0);
signal axis_slave_6_tlast : std_logic;
signal axis_slave_6_irq : std_logic;
signal status_6_addr : std_logic_vector(7 downto 0);
signal status_6_data : std_logic_vector(31 downto 0);
signal status_6_stb : std_logic;
signal ctrl_6_addr : std_logic_vector(7 downto 0);
signal ctrl_6_data : std_logic_vector(31 downto 0);
signal ctrl_6_stb : std_logic;
signal axis_master_7_tvalid : std_logic;
signal axis_master_7_tready : std_logic;
signal axis_master_7_tdata : std_logic_vector(63 downto 0);
signal axis_master_7_tdest : std_logic_vector(2 downto 0);
signal axis_master_7_tlast : std_logic;
signal axis_master_7_irq : std_logic;
signal axis_slave_7_tvalid : std_logic;
signal axis_slave_7_tready : std_logic;
signal axis_slave_7_tdata : std_logic_vector(63 downto 0);
signal axis_slave_7_tid : std_logic_vector(2 downto 0);
signal axis_slave_7_tlast : std_logic;
signal axis_slave_7_irq : std_logic;
signal status_7_addr : std_logic_vector(7 downto 0);
signal status_7_data : std_logic_vector(31 downto 0);
signal status_7_stb : std_logic;
signal ctrl_7_addr : std_logic_vector(7 downto 0);
signal ctrl_7_data : std_logic_vector(31 downto 0);
signal ctrl_7_stb : std_logic;
signal rx_enable_aux : std_logic;
signal tx_enable_aux : std_logic;
signal threshold_not_exceeded : std_logic;
signal threshold_not_exceeded_stb : std_logic;
signal threshold_exceeded : std_logic;
signal threshold_exceeded_stb : std_logic;
signal trigger_stb : std_logic;
begin
inst_zc702_ps : zc702_ps
port map (
processing_system7_0_MIO => MIO,
processing_system7_0_PS_SRSTB_pin => PS_SRSTB,
processing_system7_0_PS_CLK_pin => PS_CLK,
processing_system7_0_PS_PORB_pin => PS_PORB,
processing_system7_0_DDR_Clk => DDR_Clk,
processing_system7_0_DDR_Clk_n => DDR_Clk_n,
processing_system7_0_DDR_CKE => DDR_CKE,
processing_system7_0_DDR_CS_n => DDR_CS_n,
processing_system7_0_DDR_RAS_n => DDR_RAS_n,
processing_system7_0_DDR_CAS_n => DDR_CAS_n,
processing_system7_0_DDR_WEB_pin => DDR_WEB_pin,
processing_system7_0_DDR_BankAddr => DDR_BankAddr,
processing_system7_0_DDR_Addr => DDR_Addr,
processing_system7_0_DDR_ODT => DDR_ODT,
processing_system7_0_DDR_DRSTB => DDR_DRSTB,
processing_system7_0_DDR_DQ => DDR_DQ,
processing_system7_0_DDR_DM => DDR_DM,
processing_system7_0_DDR_DQS => DDR_DQS,
processing_system7_0_DDR_DQS_n => DDR_DQS_n,
processing_system7_0_DDR_VRN => DDR_VRN,
processing_system7_0_DDR_VRP => DDR_VRP,
axi_ext_slave_conn_0_M_AXI_AWADDR_pin => S_AXI_AWADDR,
axi_ext_slave_conn_0_M_AXI_AWVALID_pin => S_AXI_AWVALID,
axi_ext_slave_conn_0_M_AXI_AWREADY_pin => S_AXI_AWREADY,
axi_ext_slave_conn_0_M_AXI_WDATA_pin => S_AXI_WDATA,
axi_ext_slave_conn_0_M_AXI_WSTRB_pin => S_AXI_WSTRB,
axi_ext_slave_conn_0_M_AXI_WVALID_pin => S_AXI_WVALID,
axi_ext_slave_conn_0_M_AXI_WREADY_pin => S_AXI_WREADY,
axi_ext_slave_conn_0_M_AXI_BRESP_pin => S_AXI_BRESP,
axi_ext_slave_conn_0_M_AXI_BVALID_pin => S_AXI_BVALID,
axi_ext_slave_conn_0_M_AXI_BREADY_pin => S_AXI_BREADY,
axi_ext_slave_conn_0_M_AXI_ARADDR_pin => S_AXI_ARADDR,
axi_ext_slave_conn_0_M_AXI_ARVALID_pin => S_AXI_ARVALID,
axi_ext_slave_conn_0_M_AXI_ARREADY_pin => S_AXI_ARREADY,
axi_ext_slave_conn_0_M_AXI_RDATA_pin => S_AXI_RDATA,
axi_ext_slave_conn_0_M_AXI_RRESP_pin => S_AXI_RRESP,
axi_ext_slave_conn_0_M_AXI_RVALID_pin => S_AXI_RVALID,
axi_ext_slave_conn_0_M_AXI_RREADY_pin => S_AXI_RREADY,
processing_system7_0_IRQ_F2P_pin => processing_system7_0_IRQ_F2P_pin,
processing_system7_0_FCLK_CLK0_pin => clk,
processing_system7_0_FCLK_RESET0_N_pin => rst_n,
axi_ext_master_conn_0_S_AXI_AWADDR_pin => M_AXI_AWADDR,
axi_ext_master_conn_0_S_AXI_AWLEN_pin => M_AXI_AWLEN,
axi_ext_master_conn_0_S_AXI_AWSIZE_pin => M_AXI_AWSIZE,
axi_ext_master_conn_0_S_AXI_AWBURST_pin => M_AXI_AWBURST,
axi_ext_master_conn_0_S_AXI_AWCACHE_pin => M_AXI_AWCACHE,
axi_ext_master_conn_0_S_AXI_AWPROT_pin => M_AXI_AWPROT,
axi_ext_master_conn_0_S_AXI_AWVALID_pin => M_AXI_AWVALID,
axi_ext_master_conn_0_S_AXI_AWREADY_pin => M_AXI_AWREADY,
axi_ext_master_conn_0_S_AXI_WDATA_pin => M_AXI_WDATA,
axi_ext_master_conn_0_S_AXI_WSTRB_pin => M_AXI_WSTRB,
axi_ext_master_conn_0_S_AXI_WLAST_pin => M_AXI_WLAST,
axi_ext_master_conn_0_S_AXI_WVALID_pin => M_AXI_WVALID,
axi_ext_master_conn_0_S_AXI_WREADY_pin => M_AXI_WREADY,
axi_ext_master_conn_0_S_AXI_BRESP_pin => M_AXI_BRESP,
axi_ext_master_conn_0_S_AXI_BVALID_pin => M_AXI_BVALID,
axi_ext_master_conn_0_S_AXI_BREADY_pin => M_AXI_BREADY,
axi_ext_master_conn_0_S_AXI_ARADDR_pin => M_AXI_ARADDR,
axi_ext_master_conn_0_S_AXI_ARLEN_pin => M_AXI_ARLEN,
axi_ext_master_conn_0_S_AXI_ARSIZE_pin => M_AXI_ARSIZE,
axi_ext_master_conn_0_S_AXI_ARBURST_pin => M_AXI_ARBURST,
axi_ext_master_conn_0_S_AXI_ARCACHE_pin => M_AXI_ARCACHE,
axi_ext_master_conn_0_S_AXI_ARPROT_pin => M_AXI_ARPROT,
axi_ext_master_conn_0_S_AXI_ARVALID_pin => M_AXI_ARVALID,
axi_ext_master_conn_0_S_AXI_ARREADY_pin => M_AXI_ARREADY,
axi_ext_master_conn_0_S_AXI_RDATA_pin => M_AXI_RDATA,
axi_ext_master_conn_0_S_AXI_RRESP_pin => M_AXI_RRESP,
axi_ext_master_conn_0_S_AXI_RLAST_pin => M_AXI_RLAST,
axi_ext_master_conn_0_S_AXI_RVALID_pin => M_AXI_RVALID,
axi_ext_master_conn_0_S_AXI_RREADY_pin => M_AXI_RREADY,
axi_ext_master_conn_0_S_AXI_AWUSER_pin => M_AXI_AWUSER,
axi_ext_master_conn_0_S_AXI_ARUSER_pin => M_AXI_ARUSER);
processing_system7_0_IRQ_F2P_pin(15) <= irq;
inst_ps_pl_interface : ps_pl_interface
generic map (
C_BASEADDR => x"40000000",
C_HIGHADDR => x"4001ffff")
port map (
clk => clk,
rst_n => rst_n,
S_AXI_AWADDR => S_AXI_AWADDR,
S_AXI_AWVALID => S_AXI_AWVALID,
S_AXI_AWREADY => S_AXI_AWREADY,
S_AXI_WDATA => S_AXI_WDATA,
S_AXI_WSTRB => S_AXI_WSTRB,
S_AXI_WVALID => S_AXI_WVALID,
S_AXI_WREADY => S_AXI_WREADY,
S_AXI_BRESP => S_AXI_BRESP,
S_AXI_BVALID => S_AXI_BVALID,
S_AXI_BREADY => S_AXI_BREADY,
S_AXI_ARADDR => S_AXI_ARADDR,
S_AXI_ARVALID => S_AXI_ARVALID,
S_AXI_ARREADY => S_AXI_ARREADY,
S_AXI_RDATA => S_AXI_RDATA,
S_AXI_RRESP => S_AXI_RRESP,
S_AXI_RVALID => S_AXI_RVALID,
S_AXI_RREADY => S_AXI_RREADY,
M_AXI_AWADDR => M_AXI_AWADDR,
M_AXI_AWPROT => M_AXI_AWPROT,
M_AXI_AWVALID => M_AXI_AWVALID,
M_AXI_AWREADY => M_AXI_AWREADY,
M_AXI_WDATA => M_AXI_WDATA,
M_AXI_WSTRB => M_AXI_WSTRB,
M_AXI_WVALID => M_AXI_WVALID,
M_AXI_WREADY => M_AXI_WREADY,
M_AXI_BRESP => M_AXI_BRESP,
M_AXI_BVALID => M_AXI_BVALID,
M_AXI_BREADY => M_AXI_BREADY,
M_AXI_AWLEN => M_AXI_AWLEN,
M_AXI_AWSIZE => M_AXI_AWSIZE,
M_AXI_AWBURST => M_AXI_AWBURST,
M_AXI_AWCACHE => M_AXI_AWCACHE,
M_AXI_AWUSER => M_AXI_AWUSER,
M_AXI_WLAST => M_AXI_WLAST,
M_AXI_ARADDR => M_AXI_ARADDR,
M_AXI_ARPROT => M_AXI_ARPROT,
M_AXI_ARVALID => M_AXI_ARVALID,
M_AXI_ARREADY => M_AXI_ARREADY,
M_AXI_RDATA => M_AXI_RDATA,
M_AXI_RRESP => M_AXI_RRESP,
M_AXI_RVALID => M_AXI_RVALID,
M_AXI_RREADY => M_AXI_RREADY,
M_AXI_RLAST => M_AXI_RLAST,
M_AXI_ARCACHE => M_AXI_ARCACHE,
M_AXI_ARUSER => M_AXI_ARUSER,
M_AXI_ARLEN => M_AXI_ARLEN,
M_AXI_ARBURST => M_AXI_ARBURST,
M_AXI_ARSIZE => M_AXI_ARSIZE,
irq => irq,
rst_glb_n => rst_glb_n,
-- Note: Master 0 & Slave 0 interfaces are occupied by the
-- datamover component internally.
axis_master_1_tvalid => axis_master_1_tvalid,
axis_master_1_tready => axis_master_1_tready,
axis_master_1_tdata => axis_master_1_tdata,
axis_master_1_tdest => axis_master_1_tdest,
axis_master_1_tlast => axis_master_1_tlast,
axis_master_1_irq => axis_master_1_irq,
axis_slave_1_tvalid => axis_slave_1_tvalid,
axis_slave_1_tready => axis_slave_1_tready,
axis_slave_1_tdata => axis_slave_1_tdata,
axis_slave_1_tid => axis_slave_1_tid,
axis_slave_1_tlast => axis_slave_1_tlast,
axis_slave_1_irq => axis_slave_1_irq,
status_1_addr => status_1_addr,
status_1_data => status_1_data,
status_1_stb => status_1_stb,
ctrl_1_addr => ctrl_1_addr,
ctrl_1_data => ctrl_1_data,
ctrl_1_stb => ctrl_1_stb,
axis_master_2_tvalid => axis_master_2_tvalid,
axis_master_2_tready => axis_master_2_tready,
axis_master_2_tdata => axis_master_2_tdata,
axis_master_2_tdest => axis_master_2_tdest,
axis_master_2_tlast => axis_master_2_tlast,
axis_master_2_irq => axis_master_2_irq,
axis_slave_2_tvalid => axis_slave_2_tvalid,
axis_slave_2_tready => axis_slave_2_tready,
axis_slave_2_tdata => axis_slave_2_tdata,
axis_slave_2_tid => axis_slave_2_tid,
axis_slave_2_tlast => axis_slave_2_tlast,
axis_slave_2_irq => axis_slave_2_irq,
status_2_addr => status_2_addr,
status_2_data => status_2_data,
status_2_stb => status_2_stb,
ctrl_2_addr => ctrl_2_addr,
ctrl_2_data => ctrl_2_data,
ctrl_2_stb => ctrl_2_stb,
axis_master_3_tvalid => axis_master_3_tvalid,
axis_master_3_tready => axis_master_3_tready,
axis_master_3_tdata => axis_master_3_tdata,
axis_master_3_tdest => axis_master_3_tdest,
axis_master_3_tlast => axis_master_3_tlast,
axis_master_3_irq => axis_master_3_irq,
axis_slave_3_tvalid => axis_slave_3_tvalid,
axis_slave_3_tready => axis_slave_3_tready,
axis_slave_3_tdata => axis_slave_3_tdata,
axis_slave_3_tid => axis_slave_3_tid,
axis_slave_3_tlast => axis_slave_3_tlast,
axis_slave_3_irq => axis_slave_3_irq,
status_3_addr => status_3_addr,
status_3_data => status_3_data,
status_3_stb => status_3_stb,
ctrl_3_addr => ctrl_3_addr,
ctrl_3_data => ctrl_3_data,
ctrl_3_stb => ctrl_3_stb,
axis_master_4_tvalid => axis_master_4_tvalid,
axis_master_4_tready => axis_master_4_tready,
axis_master_4_tdata => axis_master_4_tdata,
axis_master_4_tdest => axis_master_4_tdest,
axis_master_4_tlast => axis_master_4_tlast,
axis_master_4_irq => axis_master_4_irq,
axis_slave_4_tvalid => axis_slave_4_tvalid,
axis_slave_4_tready => axis_slave_4_tready,
axis_slave_4_tdata => axis_slave_4_tdata,
axis_slave_4_tid => axis_slave_4_tid,
axis_slave_4_tlast => axis_slave_4_tlast,
axis_slave_4_irq => axis_slave_4_irq,
status_4_addr => status_4_addr,
status_4_data => status_4_data,
status_4_stb => status_4_stb,
ctrl_4_addr => ctrl_4_addr,
ctrl_4_data => ctrl_4_data,
ctrl_4_stb => ctrl_4_stb,
axis_master_5_tvalid => axis_master_5_tvalid,
axis_master_5_tready => axis_master_5_tready,
axis_master_5_tdata => axis_master_5_tdata,
axis_master_5_tdest => axis_master_5_tdest,
axis_master_5_tlast => axis_master_5_tlast,
axis_master_5_irq => axis_master_5_irq,
axis_slave_5_tvalid => axis_slave_5_tvalid,
axis_slave_5_tready => axis_slave_5_tready,
axis_slave_5_tdata => axis_slave_5_tdata,
axis_slave_5_tid => axis_slave_5_tid,
axis_slave_5_tlast => axis_slave_5_tlast,
axis_slave_5_irq => axis_slave_5_irq,
status_5_addr => status_5_addr,
status_5_data => status_5_data,
status_5_stb => status_5_stb,
ctrl_5_addr => ctrl_5_addr,
ctrl_5_data => ctrl_5_data,
ctrl_5_stb => ctrl_5_stb,
axis_master_6_tvalid => axis_master_6_tvalid,
axis_master_6_tready => axis_master_6_tready,
axis_master_6_tdata => axis_master_6_tdata,
axis_master_6_tdest => axis_master_6_tdest,
axis_master_6_tlast => axis_master_6_tlast,
axis_master_6_irq => axis_master_6_irq,
axis_slave_6_tvalid => axis_slave_6_tvalid,
axis_slave_6_tready => axis_slave_6_tready,
axis_slave_6_tdata => axis_slave_6_tdata,
axis_slave_6_tid => axis_slave_6_tid,
axis_slave_6_tlast => axis_slave_6_tlast,
axis_slave_6_irq => axis_slave_6_irq,
status_6_addr => status_6_addr,
status_6_data => status_6_data,
status_6_stb => status_6_stb,
ctrl_6_addr => ctrl_6_addr,
ctrl_6_data => ctrl_6_data,
ctrl_6_stb => ctrl_6_stb,
axis_master_7_tvalid => axis_master_7_tvalid,
axis_master_7_tready => axis_master_7_tready,
axis_master_7_tdata => axis_master_7_tdata,
axis_master_7_tdest => axis_master_7_tdest,
axis_master_7_tlast => axis_master_7_tlast,
axis_master_7_irq => axis_master_7_irq,
axis_slave_7_tvalid => axis_slave_7_tvalid,
axis_slave_7_tready => axis_slave_7_tready,
axis_slave_7_tdata => axis_slave_7_tdata,
axis_slave_7_tid => axis_slave_7_tid,
axis_slave_7_tlast => axis_slave_7_tlast,
axis_slave_7_irq => axis_slave_7_irq,
status_7_addr => status_7_addr,
status_7_data => status_7_data,
status_7_stb => status_7_stb,
ctrl_7_addr => ctrl_7_addr,
ctrl_7_data => ctrl_7_data,
ctrl_7_stb => ctrl_7_stb);
-- Accelerator 1
inst_usrp_ddr_intf_axis : usrp_ddr_intf_axis
generic map (
DDR_CLOCK_FREQ => 100e6,
BAUD => 115200)
port map (
UART_TX => UART_TX,
RX_DATA_CLK_N => RX_DATA_CLK_N,
RX_DATA_CLK_P => RX_DATA_CLK_P,
RX_DATA_N => RX_DATA_N,
RX_DATA_P => RX_DATA_P,
TX_DATA_N => TX_DATA_N,
TX_DATA_P => TX_DATA_P,
clk => clk,
rst_n => rst_glb_n,
status_addr => status_1_addr,
status_data => status_1_data,
status_stb => status_1_stb,
ctrl_addr => ctrl_1_addr,
ctrl_data => ctrl_1_data,
ctrl_stb => ctrl_1_stb,
axis_slave_tvalid => axis_slave_1_tvalid,
axis_slave_tready => axis_slave_1_tready,
axis_slave_tdata => axis_slave_1_tdata,
axis_slave_tid => axis_slave_1_tid,
axis_slave_tlast => axis_slave_1_tlast,
axis_slave_irq => axis_slave_1_irq,
axis_master_tvalid => axis_master_1_tvalid,
axis_master_tready => axis_master_1_tready,
axis_master_tdata => axis_master_1_tdata,
axis_master_tdest => axis_master_1_tdest,
axis_master_tlast => axis_master_1_tlast,
axis_master_irq => axis_master_1_irq,
rx_enable_aux => rx_enable_aux,
tx_enable_aux => tx_enable_aux);
rx_enable_aux <= '0';
tx_enable_aux <= threshold_exceeded OR threshold_not_exceeded;
-- Accelerator 2
inst_spectrum_sense : spectrum_sense
port map (
clk => clk,
rst_n => rst_glb_n,
status_addr => status_2_addr,
status_data => status_2_data,
status_stb => status_2_stb,
ctrl_addr => ctrl_2_addr,
ctrl_data => ctrl_2_data,
ctrl_stb => ctrl_2_stb,
axis_slave_tvalid => axis_slave_2_tvalid,
axis_slave_tready => axis_slave_2_tready,
axis_slave_tdata => axis_slave_2_tdata,
axis_slave_tid => axis_slave_2_tid,
axis_slave_tlast => axis_slave_2_tlast,
axis_slave_irq => axis_slave_2_irq,
axis_master_tvalid => axis_master_2_tvalid,
axis_master_tready => axis_master_2_tready,
axis_master_tdata => axis_master_2_tdata,
axis_master_tdest => axis_master_2_tdest,
axis_master_tlast => axis_master_2_tlast,
axis_master_irq => axis_master_2_irq,
threshold_not_exceeded => threshold_not_exceeded,
threshold_not_exceeded_stb => threshold_not_exceeded_stb,
threshold_exceeded => threshold_exceeded,
threshold_exceeded_stb => threshold_exceeded_stb);
-- Accelerator 3
inst_bpsk_mod : bpsk_mod
port map (
clk => clk,
rst_n => rst_glb_n,
status_addr => status_3_addr,
status_data => status_3_data,
status_stb => status_3_stb,
ctrl_addr => ctrl_3_addr,
ctrl_data => ctrl_3_data,
ctrl_stb => ctrl_3_stb,
axis_slave_tvalid => axis_slave_3_tvalid,
axis_slave_tready => axis_slave_3_tready,
axis_slave_tdata => axis_slave_3_tdata,
axis_slave_tid => axis_slave_3_tid,
axis_slave_tlast => axis_slave_3_tlast,
axis_slave_irq => axis_slave_3_irq,
axis_master_tvalid => axis_master_3_tvalid,
axis_master_tready => axis_master_3_tready,
axis_master_tdata => axis_master_3_tdata,
axis_master_tdest => axis_master_3_tdest,
axis_master_tlast => axis_master_3_tlast,
axis_master_irq => axis_master_3_irq,
trigger_stb => trigger_stb);
-- The output of either threshold trigger is controlled by control registers, so ORing them is
-- not an issue as only one should be active at a time.
trigger_stb <= threshold_exceeded_stb OR threshold_not_exceeded_stb;
-- Unused Accelerators
axis_slave_4_tready <= '0';
axis_slave_4_irq <= '0';
axis_master_4_tvalid <= '0';
axis_master_4_tdata <= x"0000000000000000";
axis_master_4_tdest <= "000";
axis_master_4_tlast <= '0';
axis_master_4_irq <= '0';
status_4_data <= x"00000000";
axis_slave_5_tready <= '0';
axis_slave_5_irq <= '0';
axis_master_5_tvalid <= '0';
axis_master_5_tdata <= x"0000000000000000";
axis_master_5_tdest <= "000";
axis_master_5_tlast <= '0';
axis_master_5_irq <= '0';
status_5_data <= x"00000000";
axis_slave_6_tready <= '0';
axis_slave_6_irq <= '0';
axis_master_6_tvalid <= '0';
axis_master_6_tdata <= x"0000000000000000";
axis_master_6_tdest <= "000";
axis_master_6_tlast <= '0';
axis_master_6_irq <= '0';
status_6_data <= x"00000000";
axis_slave_7_tready <= '0';
axis_slave_7_irq <= '0';
axis_master_7_tvalid <= '0';
axis_master_7_tdata <= x"0000000000000000";
axis_master_7_tdest <= "000";
axis_master_7_tlast <= '0';
axis_master_7_irq <= '0';
status_7_data <= x"00000000";
SPARE <= 'Z';
end architecture; | gpl-3.0 | 768d182e75be3c74cc804850f5614aa0 | 0.465331 | 3.807564 | false | false | false | false |
chiggs/nvc | test/regress/func6.vhd | 5 | 825 | entity func6 is
end entity;
architecture test of func6 is
function flip(x : bit_vector(3 downto 0)) return bit_vector is
variable r : bit_vector(3 downto 0);
begin
r(0) := x(3);
r(1) := x(2);
r(2) := x(1);
r(3) := x(0);
return r;
end function;
function flipu(x : bit_vector) return bit_vector is
begin
return flip(x);
end function;
function flipu2(x : bit_vector) return bit_vector is
begin
return flip(x(3 downto 0));
end function;
begin
process is
variable b : bit_vector(3 downto 0);
begin
assert flip("1010") = "0101";
b := "1100";
assert flip(b) = "0011";
assert flipu(b) = "0011";
assert flipu2(b) = "0011";
wait;
end process;
end architecture;
| gpl-3.0 | ed384027d2ed2f0c28eeae09291f9ede | 0.541818 | 3.451883 | false | false | false | false |
chiggs/nvc | test/regress/issue56.vhd | 5 | 372 | entity issue56 is
generic (
x : integer := 5;
y : bit_vector := "110" );
port (
pi : in integer := 2;
po : out bit );
end entity;
architecture test of issue56 is
begin
process is
begin
assert x = 5;
assert y = "110";
assert pi = 2;
wait;
end process;
po <= '1';
end architecture;
| gpl-3.0 | d80a0edef632d15dc5493724e672453f | 0.489247 | 3.757576 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/video/vhdl_source/char_generator_regs.vhd | 1 | 4,477 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2010, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Character Generator Registers
-------------------------------------------------------------------------------
-- File : char_generator_regs.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Registers for the character generator
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
use work.char_generator_pkg.all;
entity char_generator_regs is
port (
clock : in std_logic;
reset : in std_logic;
io_req : in t_io_req;
io_resp : out t_io_resp;
keyb_row : in std_logic_vector(7 downto 0);
keyb_col : inout std_logic_vector(7 downto 0);
control : out t_chargen_control );
end entity;
architecture gideon of char_generator_regs is
signal control_i : t_chargen_control := c_chargen_control_init;
begin
process(clock)
begin
if rising_edge(clock) then
io_resp <= c_io_resp_init;
if io_req.write='1' then
io_resp.ack <= '1';
case io_req.address(3 downto 0) is
when c_chargen_line_clocks_hi =>
control_i.clocks_per_line(10 downto 8) <= unsigned(io_req.data(2 downto 0));
when c_chargen_line_clocks_lo =>
control_i.clocks_per_line(7 downto 0) <= unsigned(io_req.data);
when c_chargen_char_width =>
control_i.char_width <= unsigned(io_req.data(2 downto 0));
when c_chargen_char_height =>
control_i.char_height <= unsigned(io_req.data(4 downto 0));
control_i.stretch_y <= io_req.data(7);
when c_chargen_chars_per_line =>
control_i.chars_per_line <= unsigned(io_req.data);
when c_chargen_active_lines =>
control_i.active_lines <= unsigned(io_req.data(5 downto 0));
when c_chargen_x_on_hi =>
control_i.x_on(11 downto 8) <= unsigned(io_req.data(3 downto 0));
when c_chargen_x_on_lo =>
control_i.x_on(7 downto 0) <= unsigned(io_req.data);
when c_chargen_y_on_hi =>
control_i.y_on(11 downto 8) <= unsigned(io_req.data(3 downto 0));
when c_chargen_y_on_lo =>
control_i.y_on(7 downto 0) <= unsigned(io_req.data);
when c_chargen_pointer_hi =>
control_i.pointer(14 downto 8) <= unsigned(io_req.data(6 downto 0));
when c_chargen_pointer_lo =>
control_i.pointer(7 downto 0) <= unsigned(io_req.data);
when c_chargen_perform_sync =>
control_i.perform_sync <= io_req.data(0);
when c_chargen_transparency =>
control_i.transparent <= io_req.data(3 downto 0);
control_i.overlay_on <= io_req.data(7);
when c_chargen_keyb_col =>
keyb_col <= io_req.data;
when others =>
null;
end case;
elsif io_req.read='1' then
io_resp.ack <= '1';
case io_req.address(3 downto 0) is
when c_chargen_keyb_row =>
io_resp.data <= keyb_row;
when c_chargen_keyb_col =>
io_resp.data <= keyb_col;
when others =>
null;
end case;
end if;
if reset='1' then
-- control_i <= c_chargen_control_init;
keyb_col <= (others => '1');
end if;
end if;
end process;
control <= control_i;
end gideon;
| gpl-3.0 | b5b194018a480d05b06050192083c85a | 0.427742 | 4.239583 | false | false | false | false |
armandas/Plong | player.vhd | 1 | 4,497 | library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity player is
port(
clk, not_reset: in std_logic;
bump_sound, miss_sound: in std_logic;
speaker: out std_logic
);
end player;
architecture behaviour of player is
signal pitch: std_logic_vector(18 downto 0);
signal duration: std_logic_vector(25 downto 0);
signal volume: std_logic_vector(2 downto 0);
signal enable: std_logic;
signal d_counter, d_counter_next: std_logic_vector(25 downto 0);
signal note, note_next: std_logic_vector(8 downto 0);
signal note_addr, note_addr_next: std_logic_vector(1 downto 0);
signal change_note: std_logic;
-- data source for tunes
signal source, source_next: std_logic;
-- container for current data selected by multiplexer
signal data: std_logic_vector(8 downto 0);
-- data containers for use with ROMs. Add more as needed.
signal data_1, data_2: std_logic_vector(8 downto 0);
type state_type is (off, playing);
signal state, state_next: state_type;
signal start: std_logic;
begin
process(clk, not_reset)
begin
if not_reset = '0' then
state <= off;
source <= '0';
note_addr <= (others => '0');
note <= (others => '0');
d_counter <= (others => '0');
elsif clk'event and clk = '1' then
state <= state_next;
source <= source_next;
note_addr <= note_addr_next;
note <= note_next;
d_counter <= d_counter_next;
end if;
end process;
process(state, start, enable, duration, d_counter, note_addr, change_note)
begin
state_next <= state;
note_addr_next <= note_addr;
case state is
when off =>
note_addr_next <= (others => '0');
if start = '1' then
state_next <= playing;
end if;
when playing =>
if duration = 0 then
state_next <= off;
elsif change_note = '1' then
note_addr_next <= note_addr + 1;
end if;
end case;
end process;
enable <= '1' when state = playing else '0';
change_note <= '1' when d_counter = duration else '0';
d_counter_next <= d_counter + 1 when (enable = '1' and
d_counter < duration) else
(others => '0');
with note(8 downto 6) select
pitch <= "1101110111110010001" when "001", -- 110 Hz
"0110111011111001000" when "010", -- 220 Hz
"0011011101111100100" when "011", -- 440 Hz
"0001101110111110010" when "100", -- 880 Hz
"0000110111011111001" when "101", -- 1760 Hz
"0000011011101111100" when "110", -- 3520 Hz
"0000001101110111110" when "111", -- 7040 Hz
"0000000000000000000" when others;
with note(5 downto 3) select
duration <= "00000010111110101111000010" when "001", -- 1/64
"00000101111101011110000100" when "010", -- 1/32
"00001011111010111100001000" when "011", -- 1/16
"00010111110101111000010000" when "100", -- 1/8
"00101111101011110000100000" when "101", -- 1/4
"01011111010111100001000000" when "110", -- 1/2
"10111110101111000010000000" when "111", -- 1/1
"00000000000000000000000000" when others;
volume <= note(2 downto 0);
start <= '1' when (bump_sound = '1' or miss_sound = '1') else '0';
-- data source
source_next <= '0' when bump_sound = '1' else
'1' when miss_sound = '1' else
source;
data <= data_1 when source = '0' else data_2;
note_next <= data;
bump:
entity work.bump_sound(content)
port map(
addr => note_addr,
data => data_1
);
miss:
entity work.lost_ball_sound(content)
port map(
addr => note_addr,
data => data_2
);
sounds:
entity work.sounds(generator)
port map(
clk => clk, not_reset => not_reset,
enable => enable,
period => pitch,
volume => volume,
speaker => speaker
);
end behaviour; | bsd-2-clause | f96ed7674c5ce2c5d1555cb8d02129ce | 0.52813 | 4.066004 | false | false | false | false |
trondd/mkjpeg | design/BufFifo/SUB_FIFO.vhd | 2 | 3,661 |
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
library WORK;
entity SUB_FIFO is
generic (
DATA_WIDTH : INTEGER := 12;
ADDR_WIDTH : INTEGER := 2
);
port (
rst : in STD_LOGIC;
clk : in STD_LOGIC;
rinc : in STD_LOGIC;
winc : in STD_LOGIC;
fullo : out STD_LOGIC;
emptyo : out STD_LOGIC;
count : out STD_LOGIC_VECTOR (ADDR_WIDTH downto 0);
ramwaddr : out STD_LOGIC_VECTOR (ADDR_WIDTH-1 downto 0);
ramenw : out STD_LOGIC;
ramraddr : out STD_LOGIC_VECTOR (ADDR_WIDTH-1 downto 0);
ramenr : out STD_LOGIC
);
end SUB_FIFO;
architecture RTL of SUB_FIFO is
signal raddr_reg : STD_LOGIC_VECTOR(ADDR_WIDTH-1 downto 0);
signal waddr_reg : STD_LOGIC_VECTOR(ADDR_WIDTH-1 downto 0);
signal count_reg : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0);
signal rd_en_reg : STD_LOGIC;
signal wr_en_reg : STD_LOGIC;
signal empty_reg : STD_LOGIC;
signal full_reg : STD_LOGIC;
constant ZEROS_C : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '0');
constant ONES_C : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1');
begin
ramwaddr <= waddr_reg;
ramenw <= wr_en_reg;
ramraddr <= raddr_reg;
ramenr <= '1';
emptyo <= empty_reg;
fullo <= full_reg;
rd_en_reg <= (rinc and not empty_reg);
wr_en_reg <= (winc and not full_reg);
count <= count_reg;
process(clk)
begin
if clk = '1' and clk'event then
if rst = '1' then
empty_reg <= '1';
else
if count_reg = ZEROS_C or
(count_reg = 1 and rd_en_reg = '1' and wr_en_reg = '0') then
empty_reg <= '1';
else
empty_reg <= '0';
end if;
end if;
end if;
end process;
process(clk)
begin
if clk = '1' and clk'event then
if rst = '1' then
full_reg <= '0';
else
if count_reg = 2**ADDR_WIDTH or
(count_reg = 2**ADDR_WIDTH-1 and wr_en_reg = '1' and rd_en_reg = '0') then
full_reg <= '1';
else
full_reg <= '0';
end if;
end if;
end if;
end process;
process(clk)
begin
if clk = '1' and clk'event then
if rst = '1' then
raddr_reg <= (others => '0');
else
if rd_en_reg = '1' then
raddr_reg <= raddr_reg + '1';
end if;
end if;
end if;
end process;
process(clk)
begin
if clk = '1' and clk'event then
if rst = '1' then
waddr_reg <= (others => '0');
else
if wr_en_reg = '1' then
waddr_reg <= waddr_reg + '1';
end if;
end if;
end if;
end process;
process(clk)
begin
if clk = '1' and clk'event then
if rst = '1' then
count_reg <= (others => '0');
else
if (rd_en_reg = '1' and wr_en_reg = '0') or (rd_en_reg = '0' and wr_en_reg = '1') then
if rd_en_reg = '1' then
count_reg <= count_reg - '1';
else
count_reg <= count_reg + '1';
end if;
end if;
end if;
end if;
end process;
end RTL;
| lgpl-3.0 | e5a95e08914d05767d341f5d8a8fea3b | 0.449331 | 3.571707 | false | false | false | false |
markusC64/1541ultimate2 | fpga/cpu_unit/mblite/hw/core/core_Pkg.vhd | 1 | 18,655 | ----------------------------------------------------------------------------------------------
--
-- Input file : core_Pkg.vhd
-- Design name : core_Pkg
-- Author : Tamar Kranenburg
-- Company : Delft University of Technology
-- : Faculty EEMCS, Department ME&CE
-- : Systems and Circuits group
--
-- Description : Package with components and type definitions for the interface
-- of the components
--
--
----------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library mblite;
use mblite.std_Pkg.all;
use mblite.config_Pkg.all;
package core_Pkg is
constant C_8_ZEROS : std_logic_vector ( 7 downto 0) := (others => '0');
constant C_16_ZEROS : std_logic_vector (15 downto 0) := (others => '0');
constant C_24_ZEROS : std_logic_vector (23 downto 0) := (others => '0');
constant C_32_ZEROS : std_logic_vector (31 downto 0) := (others => '0');
----------------------------------------------------------------------------------------------
-- TYPES USED IN MB-LITE
----------------------------------------------------------------------------------------------
type alu_operation is (ALU_ADD, ALU_OR, ALU_AND, ALU_XOR, ALU_SHIFT, ALU_SEXT8, ALU_SEXT16, ALU_MUL, ALU_BS, ALU_PEQ);
type src_type_a is (ALU_SRC_REGA, ALU_SRC_NOT_REGA, ALU_SRC_PC, ALU_SRC_SPR);
type src_type_b is (ALU_SRC_REGB, ALU_SRC_NOT_REGB, ALU_SRC_IMM, ALU_SRC_NOT_IMM);
type carry_type is (CARRY_ZERO, CARRY_ONE, CARRY_ALU, CARRY_ARITH);
type carry_keep_type is (CARRY_NOT_KEEP, CARRY_KEEP);
type branch_condition is (NOP, BNC, BEQ, BNE, BLT, BLE, BGT, BGE);
type transfer_size is (WORD, HALFWORD, BYTE);
type msr_update is (NOP, LOAD_MSR, MSR_SET, MSR_CLR, MSR_SET_I, MSR_CLR_I);
type ctrl_execution is record
alu_op : alu_operation;
alu_src_a : src_type_a;
alu_src_b : src_type_b;
compare_op : std_logic;
operation : std_logic_vector(1 downto 0);
carry : carry_type;
carry_keep : carry_keep_type;
branch_cond : branch_condition;
delay : std_logic;
msr_op : msr_update;
end record;
type ctrl_memory is record
mem_write : std_logic;
mem_read : std_logic;
transfer_size : transfer_size;
end record;
type ctrl_memory_writeback_type is record
mem_read : std_logic;
transfer_size : transfer_size;
end record;
type forward_type is record
reg_d : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
reg_write : std_logic;
end record;
type imem_in_type is record
dat_i : std_logic_vector(CFG_IMEM_WIDTH - 1 downto 0);
ena_i : std_logic;
end record;
type imem_out_type is record
adr_o : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
ena_o : std_logic;
end record;
type fetch_in_type is record
hazard : std_logic;
branch : std_logic;
branch_target : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
end record;
type fetch_out_type is record
program_counter : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
instruction : std_logic_vector(CFG_IMEM_WIDTH - 1 downto 0);
inst_valid : std_logic;
end record;
type gprf_out_type is record
dat_a_o : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
dat_b_o : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
dat_d_o : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
end record;
type decode_in_type is record
program_counter : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
instruction : std_logic_vector(CFG_IMEM_WIDTH - 1 downto 0);
inst_valid : std_logic;
ctrl_wrb : forward_type;
ctrl_mem_wrb : ctrl_memory_writeback_type;
mem_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
alu_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
interrupt : std_logic;
interrupt_enable: std_logic;
flush_id : std_logic;
end record;
type decode_out_type is record
reg_a : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
reg_b : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
imm : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
program_counter : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
hazard : std_logic;
ctrl_ex : ctrl_execution;
ctrl_mem : ctrl_memory;
ctrl_wrb : forward_type;
fwd_dec_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
fwd_dec : forward_type;
int_ack : std_logic;
end record;
type gprf_in_type is record
adr_a_i : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
adr_b_i : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
adr_d_i : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
dat_w_i : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
adr_w_i : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
wre_i : std_logic;
end record;
type execute_out_type is record
alu_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
dat_d : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
branch : std_logic;
program_counter : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
flush_id : std_logic;
interrupt_enable: std_logic;
ctrl_mem : ctrl_memory;
ctrl_wrb : forward_type;
end record;
type execute_in_type is record
reg_a : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
dat_a : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
reg_b : std_logic_vector(CFG_GPRF_SIZE - 1 downto 0);
dat_b : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
dat_d : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
imm : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
program_counter : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
fwd_dec : forward_type;
fwd_dec_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
fwd_mem : forward_type;
ctrl_ex : ctrl_execution;
ctrl_mem : ctrl_memory;
ctrl_wrb : forward_type;
ctrl_mem_wrb : ctrl_memory_writeback_type;
mem_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
alu_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
end record;
type mem_in_type is record
dat_d : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
alu_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
mem_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
program_counter : std_logic_vector(CFG_IMEM_SIZE - 1 downto 0);
branch : std_logic;
ctrl_mem : ctrl_memory;
ctrl_wrb : forward_type;
end record;
type mem_out_type is record
alu_result : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
ctrl_wrb : forward_type;
ctrl_mem_wrb : ctrl_memory_writeback_type;
end record;
type dmem_in_type is record
dat_i : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
ena_i : std_logic;
end record;
type dmem_out_type is record
dat_o : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
adr_o : std_logic_vector(CFG_DMEM_SIZE - 1 downto 0);
sel_o : std_logic_vector(3 downto 0);
we_o : std_logic;
ena_o : std_logic;
end record;
type dmem_in_array_type is array(natural range <>) of dmem_in_type;
type dmem_out_array_type is array(natural range <>) of dmem_out_type;
-- WB-master inputs from the wb-slaves
type wb_mst_in_type is record
clk_i : std_logic; -- master clock input
rst_i : std_logic; -- synchronous active high reset
dat_i : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0); -- databus input
ack_i : std_logic; -- buscycle acknowledge input
int_i : std_logic; -- interrupt request input
end record;
-- WB-master outputs to the wb-slaves
type wb_mst_out_type is record
adr_o : std_logic_vector(CFG_DMEM_SIZE - 1 downto 0); -- address bits
dat_o : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0); -- databus output
we_o : std_logic; -- write enable output
stb_o : std_logic; -- strobe signals
sel_o : std_logic_vector(3 downto 0); -- select output array
cyc_o : std_logic; -- valid BUS cycle output
end record;
-- WB-slave inputs, from the WB-master
type wb_slv_in_type is record
clk_i : std_logic; -- master clock input
rst_i : std_logic; -- synchronous active high reset
adr_i : std_logic_vector(CFG_DMEM_SIZE - 1 downto 0); -- address bits
dat_i : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0); -- Databus input
we_i : std_logic; -- Write enable input
stb_i : std_logic; -- strobe signals / core select signal
sel_i : std_logic_vector(3 downto 0); -- select output array
cyc_i : std_logic; -- valid BUS cycle input
end record;
-- WB-slave outputs to the WB-master
type wb_slv_out_type is record
dat_o : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0); -- Databus output
ack_o : std_logic; -- Bus cycle acknowledge output
int_o : std_logic; -- interrupt request output
end record;
----------------------------------------------------------------------------------------------
-- COMPONENTS USED IN MB-LITE
----------------------------------------------------------------------------------------------
component core
generic (
G_INTERRUPT : boolean := CFG_INTERRUPT;
G_USE_HW_MUL : boolean := CFG_USE_HW_MUL;
G_USE_BARREL : boolean := CFG_USE_BARREL;
G_DEBUG : boolean := CFG_DEBUG
);
port (
imem_o : out imem_out_type;
dmem_o : out dmem_out_type;
imem_i : in imem_in_type;
dmem_i : in dmem_in_type;
int_i : in std_logic;
int_o : out std_logic;
rst_i : in std_logic;
clk_i : in std_logic
);
end component;
component core_wb
generic (
G_INTERRUPT : boolean := CFG_INTERRUPT;
G_USE_HW_MUL : boolean := CFG_USE_HW_MUL;
G_USE_BARREL : boolean := CFG_USE_BARREL;
G_DEBUG : boolean := CFG_DEBUG
);
port (
imem_o : out imem_out_type;
wb_o : out wb_mst_out_type;
imem_i : in imem_in_type;
wb_i : in wb_mst_in_type
);
end component;
component core_wb_adapter
port (
dmem_i : out dmem_in_type;
wb_o : out wb_mst_out_type;
dmem_o : in dmem_out_type;
wb_i : in wb_mst_in_type
);
end component;
component core_wb_async_adapter
port (
dmem_i : out dmem_in_type;
wb_o : out wb_mst_out_type;
dmem_o : in dmem_out_type;
wb_i : in wb_mst_in_type
);
end component;
component fetch
port (
fetch_o : out fetch_out_type;
imem_o : out imem_out_type;
fetch_i : in fetch_in_type;
imem_i : in imem_in_type;
rst_i : in std_logic;
ena_i : in std_logic;
clk_i : in std_logic
);
end component;
component decode
generic (
G_INTERRUPT : boolean := CFG_INTERRUPT;
G_USE_HW_MUL : boolean := CFG_USE_HW_MUL;
G_USE_BARREL : boolean := CFG_USE_BARREL;
G_DEBUG : boolean := CFG_DEBUG
);
port (
decode_o : out decode_out_type;
gprf_o : out gprf_out_type;
decode_i : in decode_in_type;
ena_i : in std_logic;
rst_i : in std_logic;
clk_i : in std_logic
);
end component;
component gprf
port (
gprf_o : out gprf_out_type;
gprf_i : in gprf_in_type;
ena_i : in std_logic;
clk_i : in std_logic
);
end component;
component execute
generic (
G_USE_HW_MUL : boolean := CFG_USE_HW_MUL;
G_USE_BARREL : boolean := CFG_USE_BARREL
);
port (
exec_o : out execute_out_type;
exec_i : in execute_in_type;
ena_i : in std_logic;
rst_i : in std_logic;
clk_i : in std_logic
);
end component;
component mem
port (
mem_o : out mem_out_type;
dmem_o : out dmem_out_type;
mem_i : in mem_in_type;
ena_i : in std_logic;
rst_i : in std_logic;
clk_i : in std_logic
);
end component;
component core_address_decoder
generic (
G_NUM_SLAVES : positive := CFG_NUM_SLAVES
);
port (
m_dmem_i : out dmem_in_type;
s_dmem_o : out dmem_out_array_type;
m_dmem_o : in dmem_out_type;
s_dmem_i : in dmem_in_array_type;
clk_i : in std_logic
);
end component;
----------------------------------------------------------------------------------------------
-- FUNCTIONS USED IN MB-LITE
----------------------------------------------------------------------------------------------
function select_register_data (reg_dat, wb_dat : std_logic_vector; write : std_logic) return std_logic_vector;
function forward_condition (reg_write : std_logic; reg_a, reg_d : std_logic_vector) return std_logic;
function align_mem_load (data : std_logic_vector; size : transfer_size; address : std_logic_vector) return std_logic_vector;
function align_mem_store (data : std_logic_vector; size : transfer_size) return std_logic_vector;
function decode_mem_store (address : std_logic_vector(1 downto 0); size : transfer_size) return std_logic_vector;
end core_Pkg;
package body core_Pkg is
-- This function select the register value:
-- A) zero
-- B) bypass value read from register file
-- C) value from register file
function select_register_data (reg_dat, wb_dat : std_logic_vector; write : std_logic) return std_logic_vector is
variable tmp : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
begin
if CFG_REG_FWD_WRB = true and write = '1' then
tmp := wb_dat;
else
tmp := reg_dat;
end if;
return tmp;
end select_register_data;
-- This function checks if a forwarding condition is met. The condition is met of register A and D match
-- and the signal needs to be written back to the register file.
function forward_condition (reg_write : std_logic; reg_a, reg_d : std_logic_vector ) return std_logic is
begin
return reg_write and compare(reg_a, reg_d);
end forward_condition;
-- This function aligns the memory load operation (Big endian decoding).
function align_mem_load (data : std_logic_vector; size : transfer_size; address : std_logic_vector ) return std_logic_vector is
begin
case size is
when byte =>
case address(1 downto 0) is
when "00" => return C_24_ZEROS & data(31 downto 24);
when "01" => return C_24_ZEROS & data(23 downto 16);
when "10" => return C_24_ZEROS & data(15 downto 8);
when "11" => return C_24_ZEROS & data( 7 downto 0);
when others => return C_32_ZEROS;
end case;
when halfword =>
case address(1 downto 0) is
when "00" => return C_16_ZEROS & data(31 downto 16);
when "10" => return C_16_ZEROS & data(15 downto 0);
when others => return C_32_ZEROS;
end case;
when others =>
return data;
end case;
end align_mem_load;
-- This function repeats the operand to all positions in a memory store operation.
function align_mem_store (data : std_logic_vector; size : transfer_size) return std_logic_vector is
begin
case size is
when byte => return data( 7 downto 0) & data( 7 downto 0) & data(7 downto 0) & data(7 downto 0);
when halfword => return data(15 downto 0) & data(15 downto 0);
when others => return data;
end case;
end align_mem_store;
-- This function selects the correct bytes for memory writes (Big endian encoding).
function decode_mem_store (address : std_logic_vector(1 downto 0); size : transfer_size) return std_logic_vector is
begin
case size is
when BYTE =>
case address is
when "00" => return "1000";
when "01" => return "0100";
when "10" => return "0010";
when "11" => return "0001";
when others => return "0000";
end case;
when HALFWORD =>
case address is
-- Big endian encoding
when "10" => return "0011";
when "00" => return "1100";
when others => return "0000";
end case;
when others =>
return "1111";
end case;
end decode_mem_store;
end core_Pkg; | gpl-3.0 | 0183730159860a894a72469855354ee6 | 0.510533 | 3.863119 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/sampler/vhdl_source/sampler_pkg.vhd | 1 | 3,629 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package sampler_pkg is
type t_sample_state is (idle, playing, finished, fetch1, fetch2);
type t_sample_mode is (mono8, mono16);
type t_voice_state is record
state : t_sample_state;
position : unsigned(23 downto 0);
divider : unsigned(15 downto 0);
prescale : integer range 0 to 15;
sample_out : signed(15 downto 0);
end record;
constant c_voice_state_init : t_voice_state := (
state => idle,
position => to_unsigned(0, 24),
divider => to_unsigned(0, 16),
prescale => 0,
sample_out => to_signed(0, 16) );
type t_voice_control is record
enable : boolean;
repeat : boolean;
interrupt : boolean;
interleave : boolean;
mode : t_sample_mode;
start_addr : unsigned(25 downto 0);
repeat_a : unsigned(23 downto 0);
repeat_b : unsigned(23 downto 0);
length : unsigned(23 downto 0);
rate : unsigned(15 downto 0);
volume : unsigned(5 downto 0);
pan : unsigned(3 downto 0); -- 0000 = left, 1111 = right
end record;
constant c_voice_control_init : t_voice_control := (
enable => false,
repeat => false,
interrupt => false,
interleave => false,
mode => mono8,
start_addr => to_unsigned(16*1024*1024, 26),
repeat_a => to_unsigned(32768, 24),
repeat_b => to_unsigned(49152, 24),
length => to_unsigned(65536, 24),
rate => to_unsigned(283, 16),
volume => to_unsigned(63, 6),
pan => X"7" );
type t_voice_control_array is array(natural range <>) of t_voice_control;
type t_voice_state_array is array(natural range <>) of t_voice_state;
type t_voice_sample_array is array(natural range <>) of signed(15 downto 0);
type t_sample_byte_array is array(natural range <>) of signed(7 downto 0);
constant c_sample_control : unsigned(4 downto 0) := '0' & X"0";
constant c_sample_volume : unsigned(4 downto 0) := '0' & X"1";
constant c_sample_pan : unsigned(4 downto 0) := '0' & X"2";
constant c_sample_start_addr_h : unsigned(4 downto 0) := '0' & X"4";
constant c_sample_start_addr_mh : unsigned(4 downto 0) := '0' & X"5";
constant c_sample_start_addr_ml : unsigned(4 downto 0) := '0' & X"6";
constant c_sample_start_addr_l : unsigned(4 downto 0) := '0' & X"7";
constant c_sample_length_h : unsigned(4 downto 0) := '0' & X"9";
constant c_sample_length_m : unsigned(4 downto 0) := '0' & X"A";
constant c_sample_length_l : unsigned(4 downto 0) := '0' & X"B";
constant c_sample_rate_h : unsigned(4 downto 0) := '0' & X"E";
constant c_sample_rate_l : unsigned(4 downto 0) := '0' & X"F";
constant c_sample_rep_a_pos_h : unsigned(4 downto 0) := '1' & X"1";
constant c_sample_rep_a_pos_m : unsigned(4 downto 0) := '1' & X"2";
constant c_sample_rep_a_pos_l : unsigned(4 downto 0) := '1' & X"3";
constant c_sample_rep_b_pos_h : unsigned(4 downto 0) := '1' & X"5";
constant c_sample_rep_b_pos_m : unsigned(4 downto 0) := '1' & X"6";
constant c_sample_rep_b_pos_l : unsigned(4 downto 0) := '1' & X"7";
constant c_sample_clear_irq : unsigned(4 downto 0) := '1' & X"F";
end package;
| gpl-3.0 | 2002b15fa7873308250a9cb02e7d8db4 | 0.539267 | 3.317185 | false | false | false | false |
nussbrot/AdvPT | wb_test/src/vhdl/wb_traffic_supervision.vhd | 2 | 2,345 | -------------------------------------------------------------------------------
-- COPYRIGHT (c) SOLECTRIX GmbH, Germany, 2017 All rights reserved
--
-- The copyright to the document(s) herein is the property of SOLECTRIX GmbH
-- The document(s) may be used AND/OR copied only with the written permission
-- from SOLECTRIX GmbH or in accordance with the terms/conditions stipulated
-- in the agreement/contract under which the document(s) have been supplied
-------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY wb_traffic_supervision IS
GENERIC (
g_priority : INTEGER;
g_tot_priority : INTEGER);
PORT (
clk : IN STD_LOGIC;
rst_n : IN STD_LOGIC := '1';
i_bg : IN STD_LOGIC; -- bus grant
i_ce : IN STD_LOGIC; -- clock enable
o_traffic_limit : OUT STD_LOGIC);
END ENTITY wb_traffic_supervision;
ARCHITECTURE rtl OF wb_traffic_supervision IS
SIGNAL s_shreg : STD_LOGIC_VECTOR(g_tot_priority - 1 DOWNTO 0)
:= (OTHERS => '0');
SIGNAL s_cntr : INTEGER RANGE 0 TO g_tot_priority;
BEGIN -- rtl
-- purpose: holds information of usage of latest cycles
-- type : sequential, no reset, rising clock edge
sh_reg : PROCESS (clk)
BEGIN -- process shreg
IF (clk'EVENT AND clk = '1') THEN
IF (i_ce = '1') THEN
s_shreg <= s_shreg(g_tot_priority - 2 DOWNTO 0) & i_bg;
END IF;
END IF;
END PROCESS sh_reg;
-- purpose: keeps track of used cycles
-- type : sequential, rising edge, mixed type reset
counter : PROCESS (clk, rst_n)
BEGIN -- process counter
IF (rst_n = '0') THEN
s_cntr <= 0;
o_traffic_limit <= '0';
ELSIF (clk'EVENT AND clk = '1') THEN
IF (i_ce = '1') THEN
IF ((i_bg = '1') AND (s_shreg(g_tot_priority - 1) /= '1')) THEN
s_cntr <= s_cntr + 1;
if (s_cntr = g_priority - 1) THEN
o_traffic_limit <= '1';
END IF;
ELSIF ((i_bg = '0') AND (s_shreg(g_tot_priority - 1) = '1')) THEN
s_cntr <= s_cntr - 1;
IF (s_cntr = g_priority) THEN
o_traffic_limit <= '0';
END IF;
END IF;
END IF;
END IF;
END PROCESS counter;
END ARCHITECTURE rtl;
| mit | 6d20d4854ceade3513e1a37f8ae6803c | 0.537313 | 3.602151 | false | false | false | false |
xiadz/oscilloscope | src/display.vhd | 1 | 9,187 | ----------------------------------------------------------------------------------
-- Author: Osowski Marcin
-- Create Date: 15:58:36 05/22/2011
----------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.types.all;
entity oscilloscope_display is
port (
nrst : in std_logic;
clk108 : in std_logic;
is_reading_active : in std_logic;
trigger_event : in TRIGGER_EVENT_T;
red_enable : in std_logic;
green_enable : in std_logic;
blue_enable : in std_logic;
continue_after_reading : in std_logic;
time_resolution : in integer range 0 to 15;
currently_read_screen_segment : in natural range 0 to 13;
currently_read_screen_column : in natural range 0 to 1279;
addrb : out std_logic_vector (12 downto 0);
doutb : in std_logic_vector (8 downto 0);
vout : out std_logic_vector (7 downto 0);
vsync : out std_logic;
hsync : out std_logic
);
end oscilloscope_display;
architecture behavioral of oscilloscope_display is
signal vga_cntl_line_change : std_logic;
signal vga_cntl_page_change : std_logic;
signal vga_cntl_column : integer range 0 to 1279;
signal vga_cntl_column_change : std_logic;
signal vga_cntl_vblank : std_logic;
signal vga_cntl_hsync : std_logic;
signal vga_cntl_vsync : std_logic;
signal scr_pos_segment : integer range 0 to 15;
signal scr_pos_segment_change : std_logic;
signal scr_pos_subsegment : integer range 0 to 3;
signal scr_pos_subsegment_change : std_logic;
signal scr_pos_line : integer range 0 to 15;
signal scr_pos_out_line_change : std_logic;
signal scr_pos_out_column : integer range 0 to 1279;
signal scr_pos_out_column_mod_8 : integer range 0 to 7;
signal scr_pos_out_column_div_8 : integer range 0 to 159;
signal scr_pos_column_change : std_logic;
signal scr_pos_out_page_change : std_logic;
signal scr_pos_active_pixgen_source : PIXGEN_SOURCE_T;
signal scr_pos_out_column_mod_8_delayed : integer range 0 to 7;
signal scr_pos_line_delayed : integer range 0 to 15;
signal scr_pos_active_pixgen_source_delayed_1 : PIXGEN_SOURCE_T;
signal scr_pos_active_pixgen_source_delayed_2 : PIXGEN_SOURCE_T;
signal time_base_char : short_character;
signal settings_char : short_character;
signal char_rom_mux_char_pixel : std_logic;
signal trace_vout : std_logic_vector (7 downto 0);
signal time_base_vout : std_logic_vector (7 downto 0);
signal settings_vout : std_logic_vector (7 downto 0);
begin
vga_controller_1280_1024: entity work.vga_controller_1280_1024
port map (
nrst => nrst,
clk108 => clk108,
hsync => vga_cntl_hsync,
vsync => vga_cntl_vsync,
vblank => vga_cntl_vblank,
line_change => vga_cntl_line_change,
page_change => vga_cntl_page_change,
column => vga_cntl_column,
column_change => vga_cntl_column_change
);
screen_position_gen: entity work.screen_position_gen
port map (
nrst => nrst,
clk108 => clk108,
vblank => vga_cntl_vblank,
in_line_change => vga_cntl_line_change,
in_page_change => vga_cntl_page_change,
in_column => vga_cntl_column,
in_column_change => vga_cntl_column_change,
segment => scr_pos_segment,
segment_change => scr_pos_segment_change,
subsegment => scr_pos_subsegment,
subsegment_change => scr_pos_subsegment_change,
line => scr_pos_line,
out_line_change => scr_pos_out_line_change,
out_column => scr_pos_out_column,
out_column_mod_8 => scr_pos_out_column_mod_8,
out_column_div_8 => scr_pos_out_column_div_8,
out_column_change => scr_pos_column_change,
out_page_change => scr_pos_out_page_change,
active_pixgen_source => scr_pos_active_pixgen_source
);
trace_pixgen: entity work.trace_pixgen
port map (
nrst => nrst,
clk108 => clk108,
segment => scr_pos_segment,
segment_change => scr_pos_segment_change,
subsegment => scr_pos_subsegment,
subsegment_change => scr_pos_subsegment_change,
line => scr_pos_line,
line_change => scr_pos_out_line_change,
column => scr_pos_out_column,
column_change => scr_pos_column_change,
page_change => scr_pos_out_page_change,
active_pixgen_source => scr_pos_active_pixgen_source,
currently_read_screen_segment => currently_read_screen_segment,
currently_read_screen_column => currently_read_screen_column,
time_resolution => time_resolution,
is_reading_active => is_reading_active,
doutb => doutb,
addrb => addrb,
vout => trace_vout
);
scr_pos_out_column_mod_8_delayed <= scr_pos_out_column_mod_8 when rising_edge (clk108);
scr_pos_line_delayed <= scr_pos_line when rising_edge (clk108);
scr_pos_active_pixgen_source_delayed_1 <= scr_pos_active_pixgen_source when rising_edge (clk108);
scr_pos_active_pixgen_source_delayed_2 <= scr_pos_active_pixgen_source_delayed_1 when rising_edge (clk108);
char_rom_mux: entity work.char_rom_mux
port map (
nrst => nrst,
clk108 => clk108,
active_pixgen_source => scr_pos_active_pixgen_source_delayed_1,
char_pos_x => scr_pos_out_column_mod_8_delayed,
char_pos_y => scr_pos_line_delayed,
time_base_char => time_base_char,
settings_char => settings_char,
char_pixel => char_rom_mux_char_pixel
);
time_base_pixgen: entity work.time_base_pixgen
port map (
nrst => nrst,
clk108 => clk108,
segment => scr_pos_segment,
segment_change => scr_pos_segment_change,
subsegment => scr_pos_subsegment,
subsegment_change => scr_pos_subsegment_change,
line => scr_pos_line,
line_change => scr_pos_out_line_change,
column => scr_pos_out_column,
column_change => scr_pos_column_change,
page_change => scr_pos_out_page_change,
active_pixgen_source => scr_pos_active_pixgen_source,
char => time_base_char,
char_pixel => char_rom_mux_char_pixel,
vout => time_base_vout
);
settings_pixgen: entity work.settings_pixgen
port map (
nrst => nrst,
clk108 => clk108,
segment => scr_pos_segment,
segment_change => scr_pos_segment_change,
subsegment => scr_pos_subsegment,
subsegment_change => scr_pos_subsegment_change,
line => scr_pos_line,
line_change => scr_pos_out_line_change,
column => scr_pos_out_column,
column_div_8 => scr_pos_out_column_div_8,
column_mod_8 => scr_pos_out_column_mod_8,
column_change => scr_pos_column_change,
page_change => scr_pos_out_page_change,
active_pixgen_source => scr_pos_active_pixgen_source,
is_reading_active => is_reading_active,
trigger_event => trigger_event,
red_enable => red_enable,
green_enable => green_enable,
blue_enable => blue_enable,
continue_after_reading => continue_after_reading,
time_resolution => time_resolution,
char => settings_char,
char_pixel => char_rom_mux_char_pixel,
vout => settings_vout
);
pixgen_mux: entity work.pixgen_mux
port map (
nrst => nrst,
clk108 => clk108,
trace_vout => trace_vout,
time_base_vout => time_base_vout,
settings_vout => settings_vout,
active_pixgen_source => scr_pos_active_pixgen_source_delayed_2,
vout => vout
);
vga_sync_signals_4_delay: entity work.n_cycles_delayer
generic map (
n => 4,
signal_width => 2
)
port map (
nrst => nrst,
clk => clk108,
input(0) => vga_cntl_hsync,
input(1) => vga_cntl_vsync,
output(0) => hsync,
output(1) => vsync
);
end behavioral;
| mit | f54db41c14cb130b731d40f6eed31a18 | 0.536192 | 3.914359 | false | false | false | false |
ringof/radiofist_audio | testbench/tb_adc_fir_lowpass.vhd | 1 | 1,907 | -- Copyright (c) 2015 by David Goncalves <[email protected]>
-- See licence.txt for details
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
ENTITY tb_adc_fir_lowpass IS
END tb_adc_fir_lowpass;
ARCHITECTURE behavior OF tb_adc_fir_lowpass IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT fir_filter
PORT(
sclr : IN std_logic;
clk : IN std_logic;
nd : IN std_logic;
rfd : OUT std_logic;
rdy : OUT std_logic;
data_valid : OUT std_logic;
din : IN std_logic_vector(24 downto 0);
dout : OUT std_logic_vector(40 downto 0)
);
END COMPONENT;
--Inputs
signal sclr : std_logic := '0';
signal clk : std_logic := '0';
signal nd : std_logic := '0';
signal din : std_logic_vector(24 downto 0) := (others => '0');
--Outputs
signal rfd : std_logic;
signal rdy : std_logic;
signal data_valid : std_logic;
signal dout : std_logic_vector(40 downto 0);
-- Clock period definitions
constant clk_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: fir_filter PORT MAP (
sclr => sclr,
clk => clk,
nd => nd,
rfd => rfd,
rdy => rdy,
data_valid => data_valid,
din => din,
dout => dout
);
-- Clock process definitions
clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
sclr <= '1';
nd <= '1';
wait for clk_period*10;
sclr <= '0';
-- insert stimulus here
wait for clk_period*10;
din <= (others => '0');
wait for clk_period*10;
din <= (others => '1');
wait;
end process;
END;
| mit | 05e96ca6db9e198e8dcac2090a9156cd | 0.563713 | 3.442238 | false | false | false | false |
markusC64/1541ultimate2 | fpga/altera/srl_fifo.vhd | 1 | 3,351 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2004, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Small Synchronous Fifo Using SRL16
-------------------------------------------------------------------------------
-- File : srl_fifo.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Altera wrapper to make the "SRL" fifo available to Altera tools.. Obviously
-- it does not use any SRL, but just BRAM!
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
LIBRARY altera_mf;
USE altera_mf.all;
entity srl_fifo is
generic (Width : integer := 32;
Depth : integer := 15; -- 15 is the maximum
Threshold : integer := 13);
port (
clock : in std_logic;
reset : in std_logic;
GetElement : in std_logic;
PutElement : in std_logic;
FlushFifo : in std_logic;
DataIn : in std_logic_vector(Width-1 downto 0);
DataOut : out std_logic_vector(Width-1 downto 0);
SpaceInFifo : out std_logic;
AlmostFull : out std_logic;
DataInFifo : out std_logic);
end srl_fifo;
architecture Altera of srl_fifo is
COMPONENT scfifo
GENERIC (
add_ram_output_register : STRING;
almost_full_value : NATURAL;
intended_device_family : STRING;
lpm_numwords : NATURAL;
lpm_showahead : STRING;
lpm_type : STRING;
lpm_width : NATURAL;
lpm_widthu : NATURAL;
overflow_checking : STRING;
underflow_checking : STRING;
use_eab : STRING
);
PORT (
clock : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (Width-1 DOWNTO 0);
rdreq : IN STD_LOGIC ;
sclr : IN STD_LOGIC ;
wrreq : IN STD_LOGIC ;
almost_full : OUT STD_LOGIC ;
empty : OUT STD_LOGIC ;
full : OUT STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (Width-1 DOWNTO 0);
usedw : OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
);
END COMPONENT;
signal full : std_logic;
signal empty : std_logic;
signal sclr : std_logic;
BEGIN
scfifo_component : scfifo
GENERIC MAP (
add_ram_output_register => "ON",
almost_full_value => Threshold,
intended_device_family => "Cyclone IV E",
lpm_numwords => Depth,
lpm_showahead => "ON",
lpm_type => "scfifo",
lpm_width => Width,
lpm_widthu => 4,
overflow_checking => "ON",
underflow_checking => "ON",
use_eab => "ON"
)
PORT MAP (
clock => clock,
data => DataIn,
rdreq => GetElement,
sclr => sclr,
wrreq => PutElement,
almost_full => AlmostFull,
empty => empty,
full => full,
q => DataOut,
usedw => open );
SpaceInFifo <= not full;
DataInFifo <= not empty;
sclr <= reset or FlushFifo;
end Altera;
| gpl-3.0 | 373b685088a0c18b90cd656c334ff93e | 0.462548 | 4.403417 | false | false | false | false |
chiggs/nvc | test/regress/wait3.vhd | 5 | 426 | entity wait3 is
end entity;
architecture test of wait3 is
signal x, y : bit;
begin
proc_a: process is
begin
wait for 1 ns;
x <= '1';
wait for 1 ns;
assert y = '1';
wait;
end process;
proc_b: process is
begin
wait on x;
assert x = '1';
assert now = 1 ns;
y <= '1';
wait;
end process;
end architecture;
| gpl-3.0 | 6a01fb6fd4e91114aa0afedef2943c3d | 0.476526 | 3.736842 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/sync_fifo/vhdl_sim/sync_fifo_tb.vhd | 1 | 3,961 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : sync_fifo_tb
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Quick test bench for sync fifo
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity sync_fifo_tb is
end entity;
architecture test of sync_fifo_tb is
signal clock : std_logic := '0';
signal reset : std_logic;
signal rd_en : std_logic;
signal rd_en_d : std_logic;
signal wr_en : std_logic;
signal din : std_logic_vector(7 downto 0);
signal dout : std_logic_vector(7 downto 0);
signal flush : std_logic;
signal full : std_logic;
signal almost_full : std_logic;
signal empty : std_logic;
signal valid : std_logic;
signal count : integer range 0 to 15;
begin
clock <= not clock after 10 ns;
reset <= '1', '0' after 100 ns;
i_fifo: entity work.sync_fifo
generic map (
g_depth => 15,
g_data_width => 8,
g_threshold => 12,
g_fall_through => false
)
port map (
clock => clock,
reset => reset,
rd_en => rd_en,
wr_en => wr_en,
din => din,
dout => dout,
flush => flush,
full => full,
almost_full => almost_full,
empty => empty,
valid => valid,
count => count
);
process
begin
din <= X"00";
flush <= '0';
wr_en <= '0';
wait until reset = '0';
for i in 1 to 20 loop
wait until clock = '1';
wait until clock = '1';
while full = '1' loop
wait until clock = '1';
end loop;
wr_en <= '1';
din <= std_logic_vector(to_unsigned(i, 8));
wait until clock = '1';
wr_en <= '0';
end loop;
wait until clock = '1';
for i in 21 to 50 loop
while full = '1' loop
wait until clock = '1';
end loop;
wr_en <= '1';
din <= std_logic_vector(to_unsigned(i, 8));
wait until clock = '1';
wr_en <= '0';
end loop;
wait until empty = '1';
for i in 51 to 60 loop
wait until clock = '1';
wait until clock = '1';
wr_en <= '1';
din <= std_logic_vector(to_unsigned(i, 8));
wait until clock = '1';
wr_en <= '0';
end loop;
wait;
end process;
process
begin
rd_en <= '0';
wait until reset = '0';
wait until full = '1';
wait until clock = '1';
wait until clock = '1';
for i in 1 to 5 loop
wait until clock = '1';
wait until clock = '1';
wait until clock = '1';
rd_en <= '1';
wait until clock = '1';
rd_en <= '0';
end loop;
rd_en <= '1';
wait;
end process;
process(clock)
variable expect : natural := 0;
begin
if rising_edge(clock) then
rd_en_d <= rd_en;
elsif falling_edge(clock) then
if rd_en_d = '1' and valid = '1' then
expect := expect + 1;
assert dout = std_logic_vector(to_unsigned(expect, 8)) report "Unexpected data" severity error;
end if;
end if;
end process;
end architecture;
| gpl-3.0 | ed955d0b0b0fcccba550aa6b56d36c6b | 0.415804 | 4.240899 | false | false | false | false |
chiggs/nvc | test/regress/issue111.vhd | 5 | 1,265 | entity t1 is
port(
A,B,C : in bit;
D : out bit
);
end t1;
architecture rtl of t1 is
begin
D<='1' when A='1' and B='1' and C='1' else '0';
end rtl;
entity test is
port(
A,B,C : in bit_vector(7 downto 0);
D : out bit_vector(7 downto 0)
);
end test;
architecture rtl of test is
begin
ADD_GEN: for I in 0 to 7 generate
L: if I=0 generate--failure is here
U0: entity work.t1
port map(A(I),B(I),'0',D(I));
end generate L;
U: if I>0 generate
UX: entity work.t1
port map(A(I),B(I),C(I-1),D(I));
end generate U;
end generate ADD_GEN;
end rtl;
entity issue111 is
end entity;
architecture test of issue111 is
signal A, B, C : bit_vector(7 downto 0);
signal D : bit_vector(7 downto 0);
begin
uut: entity work.test
port map (
A => A,
B => B,
C => C,
D => D );
process is
begin
wait for 1 ns;
assert D = X"00";
A <= X"ff";
wait for 1 ns;
assert D = X"00";
B <= X"0f";
C <= X"0c";
wait for 1 ns;
assert D = X"08";
wait;
end process;
end architecture;
| gpl-3.0 | c00061eba8f6afe1ff72128c6abb44af | 0.479051 | 3.235294 | false | true | false | false |
markusC64/1541ultimate2 | fpga/ip/nano_cpu/vhdl_source/nano_alu.vhd | 2 | 2,524 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.nano_cpu_pkg.all;
entity nano_alu is
port (
clock : in std_logic;
reset : in std_logic;
value_in : in unsigned(15 downto 0);
ext_in : in unsigned(15 downto 0);
alu_oper : in std_logic_vector(15 downto 13);
update_accu : in std_logic;
update_flag : in std_logic;
accu : out unsigned(15 downto 0);
z : out boolean;
n : out boolean;
c : out boolean );
end entity;
architecture gideon of nano_alu is
signal accu_i : unsigned(15 downto 0) := (others => '0');
signal alu_out : unsigned(15 downto 0);
signal alu_z : boolean;
signal alu_n : boolean;
signal carry : std_logic;
signal c_flag : std_logic;
signal add_oper2: unsigned(15 downto 0);
signal add_res : unsigned(17 downto 0);
signal upd_carry: boolean;
begin
with alu_oper select carry <=
'0' when c_alu_add,
'1' when c_alu_sub,
c_flag when c_alu_addc,
'0' when others;
with alu_oper select upd_carry <=
true when c_alu_add,
true when c_alu_sub,
true when c_alu_addc,
false when others;
add_oper2 <= value_in when alu_oper(13)='0' else not value_in;
add_res <= ('0' & accu_i & '1') + ('0' & add_oper2 & carry);
with alu_oper select alu_out <=
value_in when c_alu_load,
value_in or accu_i when c_alu_or,
value_in and accu_i when c_alu_and,
value_in xor accu_i when c_alu_xor,
add_res(16 downto 1) when c_alu_add,
add_res(16 downto 1) when c_alu_sub,
add_res(16 downto 1) when c_alu_addc,
ext_in when others;
alu_z <= (alu_out = 0);
alu_n <= (alu_out(15)='1');
process(clock)
begin
if rising_edge(clock) then
if update_accu='1' then
accu_i <= alu_out;
end if;
if update_flag='1' then
z <= alu_z;
n <= alu_n;
if upd_carry then
c_flag <= add_res(17);
end if;
end if;
if reset='1' then
c_flag <= '0';
end if;
end if;
end process;
accu <= accu_i;
c <= (c_flag = '1');
end architecture;
| gpl-3.0 | 791513ba3ac0a88f578229cb4700b834 | 0.488114 | 3.429348 | false | false | false | false |
chiggs/nvc | test/regress/agg4.vhd | 5 | 829 | entity agg4 is
end entity;
architecture test of agg4 is
type int_array is array (integer range <>) of integer;
procedure fill(a : out int_array; x : in integer) is
alias aa : int_array(1 to a'length) is a;
begin
aa := (1 to a'length => x);
end procedure;
procedure fill2(a : out int_array; y : in integer) is
begin
assert a'length = 1;
a := (a'left => y);
end procedure;
begin
process is
variable v : int_array(1 to 3);
variable w : int_array(5 to 5);
begin
v := (1 to 3 => 7);
assert v = (7, 7, 7);
v := (1 => 6, 2 to 3 => 5);
assert v = (6, 5, 5);
fill(v, 8);
assert v = (8, 8, 8);
fill2(w, 6);
assert w = (5 => 6);
wait;
end process;
end architecture;
| gpl-3.0 | 56f9b6383f05e71b77fa7a543891e4dd | 0.496984 | 3.316 | false | false | false | false |
markusC64/1541ultimate2 | fpga/ip/video/vhdl_source/char_generator_pkg.vhd | 1 | 4,665 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2010, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Character Generator
-------------------------------------------------------------------------------
-- File : char_generator_pkg.vhd
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Definitions for the video character generator
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package char_generator_pkg is
type t_chargen_control is record
clocks_per_line : unsigned(11 downto 0);
char_width : unsigned(2 downto 0);
char_height : unsigned(4 downto 0);
chars_per_line : unsigned(7 downto 0);
active_lines : unsigned(5 downto 0);
x_on : unsigned(11 downto 0);
y_on : unsigned(11 downto 0);
pointer : unsigned(14 downto 0);
perform_sync : std_logic;
overlay_on : std_logic;
stretch_y : std_logic;
transparent : std_logic_vector(3 downto 0);
end record;
constant c_chargen_control_init : t_chargen_control := (
clocks_per_line => to_unsigned(672, 12),
char_width => to_unsigned(0, 3),
char_height => to_unsigned(9, 5),
chars_per_line => to_unsigned(60, 8),
active_lines => to_unsigned(30, 6),
x_on => to_unsigned(15, 12),
y_on => to_unsigned(6, 12),
pointer => to_unsigned(0, 15),
perform_sync => '0',
overlay_on => '0',
stretch_y => '0',
transparent => X"5" );
-- 640x225 (80x25 => 8x9 chars, in 45 C64 chars width)
constant c_chargen_control_init_orig : t_chargen_control := (
clocks_per_line => to_unsigned(896, 12),
char_width => to_unsigned(0, 3),
char_height => to_unsigned(8, 5),
chars_per_line => to_unsigned(80, 8),
active_lines => to_unsigned(25, 6),
x_on => to_unsigned(190, 12),
y_on => to_unsigned(46, 12),
pointer => to_unsigned(0, 15),
overlay_on => '0',
stretch_y => '0',
perform_sync => '0',
transparent => X"5" );
-- 480x200 (80x25 => 6x8 chars, in 45 C64 chars width)
constant c_chargen_control_init_480 : t_chargen_control := (
clocks_per_line => to_unsigned(672, 12),
char_width => to_unsigned(6, 3),
char_height => to_unsigned(8, 5),
chars_per_line => to_unsigned(80, 8),
active_lines => to_unsigned(25, 6),
x_on => to_unsigned(142, 12),
y_on => to_unsigned(48, 12),
pointer => to_unsigned(0, 15),
overlay_on => '0',
stretch_y => '0',
perform_sync => '0',
transparent => X"5" );
constant c_chargen_line_clocks_hi : unsigned(3 downto 0) := X"0";
constant c_chargen_line_clocks_lo : unsigned(3 downto 0) := X"1";
constant c_chargen_char_width : unsigned(3 downto 0) := X"2";
constant c_chargen_char_height : unsigned(3 downto 0) := X"3";
constant c_chargen_chars_per_line : unsigned(3 downto 0) := X"4";
constant c_chargen_active_lines : unsigned(3 downto 0) := X"5";
constant c_chargen_x_on_hi : unsigned(3 downto 0) := X"6";
constant c_chargen_x_on_lo : unsigned(3 downto 0) := X"7";
constant c_chargen_y_on_hi : unsigned(3 downto 0) := X"8";
constant c_chargen_y_on_lo : unsigned(3 downto 0) := X"9";
constant c_chargen_pointer_hi : unsigned(3 downto 0) := X"A";
constant c_chargen_pointer_lo : unsigned(3 downto 0) := X"B";
constant c_chargen_perform_sync : unsigned(3 downto 0) := X"C";
constant c_chargen_transparency : unsigned(3 downto 0) := X"D";
constant c_chargen_keyb_row : unsigned(3 downto 0) := X"E";
constant c_chargen_keyb_col : unsigned(3 downto 0) := X"F";
end package;
| gpl-3.0 | a48b1dd30d9c3d706ffeba0de9f15f48 | 0.457878 | 3.826907 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb/vhdl_source/usb1_bus_reset.vhd | 2 | 13,036 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.usb1_pkg.all;
entity usb1_bus_reset is
generic (
g_simulation : boolean := false );
port (
clock : in std_logic;
reset : in std_logic;
reset_done : out std_logic;
sof_enable : out std_logic;
scan_enable : out std_logic;
speed : out std_logic_vector(1 downto 0);
abort : out std_logic;
-- status
status : in std_logic_vector(7 downto 0);
usb_busy : out std_logic;
-- command response interface
cmd_empty : in std_logic;
cmd_data : in std_logic_vector(7 downto 0);
cmd_get : out std_logic;
resp_full : in std_logic;
resp_put : out std_logic;
resp_data : out std_logic_vector(8 downto 0);
-- register interface
reg_read : out std_logic;
reg_write : out std_logic;
reg_rdata : in std_logic_vector(7 downto 0);
reg_wdata : out std_logic_vector(7 downto 0);
reg_address : out std_logic_vector(5 downto 0);
reg_ack : in std_logic;
send_packet : out std_logic;
user_data : out std_logic_vector(7 downto 0);
user_last : out std_logic;
user_valid : out std_logic );
end usb1_bus_reset;
architecture functional of usb1_bus_reset is
type t_state is (idle, start_reset, set_se0, listen_chirp,
wait_chirp_end, setup_chirp, hub_chirp_k, hub_chirp_j,
reset_end, reset_finished,
user_reg_read, user_reg_write, user_write_2, send_resp );
type t_int_bool_array is array(boolean) of integer;
constant c_reset_times : t_int_bool_array := (false => 60000*15, true => 2097); -- 4194303
constant c_latest_chirp : t_int_bool_array := (false => 80000, true => 400); -- not used anymore, as we don't wait for the device chirp to end
constant c_stop_chirp : t_int_bool_array := (false => 20000, true => 100);
constant c_chirp_jk : t_int_bool_array := (false => 3000, true => 20);
constant c_filter_times : t_int_bool_array := (false => 255, true => 10);
signal state : t_state;
signal speed_i : std_logic_vector(1 downto 0);
signal low_speed : std_logic;
signal disable_hs : std_logic;
signal t0_expired : std_logic;
signal t2_expired : std_logic := '0';
signal timer_0 : integer range 0 to 4194303; -- ~ 70 ms
signal timer_1 : integer range 0 to 8191; -- ~ 136 us
signal timer_2 : integer range 0 to 31 := 31; -- 500 ns
signal stop_chirp : std_logic;
signal reset_done_i : std_logic;
signal latest_chirp_start : std_logic;
signal cmd_valid : std_logic;
signal cmd_get_i : std_logic;
signal debug : std_logic;
-- attribute fsm_encoding : string;
-- attribute fsm_encoding of state : signal is "sequential";
begin
speed <= speed_i;
reset_done <= reset_done_i;
cmd_get <= cmd_get_i;
cmd_get_i <= '1' when cmd_empty='0' and cmd_valid='0' and (state=idle or state=user_reg_write)
else '0';
p_reset: process(clock)
begin
if rising_edge(clock) then
if timer_0 = 0 then
t0_expired <= '1';
else
timer_0 <= timer_0 - 1;
end if;
if timer_0 = c_stop_chirp(g_simulation) then
stop_chirp <= '1';
end if;
if timer_0 = c_latest_chirp(g_simulation) then
latest_chirp_start <= '1';
end if;
if timer_2 = 0 then
t2_expired <= '1';
else
timer_2 <= timer_2 - 1;
end if;
cmd_valid <= cmd_get_i;
resp_put <= '0';
abort <= '0';
case state is
when idle =>
reg_address <= cmd_data(5 downto 0);
if cmd_valid = '1' then
case cmd_data(7 downto 6) is
when "00" =>
debug <= '0';
case cmd_data(3 downto 0) is
when c_cmd_get_status =>
resp_data <= "0" & status;
state <= send_resp;
when c_cmd_get_done =>
resp_data <= X"00" & reset_done_i;
state <= send_resp;
when c_cmd_get_speed =>
resp_data <= "0000000" & speed_i;
state <= send_resp;
when c_cmd_do_reset_hs =>
disable_hs <= '0';
state <= start_reset;
when c_cmd_do_reset_fs =>
disable_hs <= '1';
state <= start_reset;
when c_cmd_disable_host =>
reset_done_i <= '0';
when c_cmd_abort =>
abort <= '1';
when c_cmd_sof_enable =>
sof_enable <= '1';
when c_cmd_sof_disable =>
sof_enable <= '0';
when c_cmd_set_busy =>
usb_busy <= '1';
when c_cmd_clear_busy =>
usb_busy <= '0';
when c_cmd_disable_scan =>
scan_enable <= '0';
when c_cmd_enable_scan =>
scan_enable <= '1';
when c_cmd_set_debug =>
debug <= '1';
when others =>
if debug='1' then
resp_data <= '0' & X"AB";
else
resp_data <= '0' & X"AA";
end if;
state <= send_resp;
end case;
when "11" =>
state <= user_reg_write;
when "10" =>
reg_read <= '1';
state <= user_reg_read;
when others =>
null;
end case;
end if;
when user_reg_read =>
if reg_ack = '1' then
reg_read <= '0';
resp_data <= "1" & reg_rdata;
state <= send_resp;
end if;
when user_reg_write =>
if cmd_valid = '1' then
reg_wdata <= cmd_data;
reg_write <= '1';
state <= user_write_2;
end if;
when user_write_2 =>
if reg_ack = '1' then
reg_write <= '0';
state <= idle;
end if;
when send_resp =>
if resp_full = '0' then
resp_put <= '1';
state <= idle;
end if;
when start_reset =>
timer_0 <= c_reset_times(g_simulation);
latest_chirp_start <= '0';
t0_expired <= '0';
stop_chirp <= '0';
reset_done_i <= '0';
low_speed <= '0';
if status(5 downto 2) /= "0011" then
speed_i <= "11"; -- not powered or rx active
state <= idle;
else
if status(1)='1' then
low_speed <= '1';
speed_i <= "00"; -- Low speed
else
speed_i <= "01"; -- assume FS
end if;
state <= set_se0;
end if;
when set_se0 =>
reg_address <= std_logic_vector(to_unsigned(4, reg_address'length));
reg_write <= '1';
reg_wdata <= X"50";
timer_1 <= c_filter_times(g_simulation); -- reset timer 1 (4.25 �s)
if reg_ack = '1' then
reg_write <= '0';
if low_speed='1' or disable_hs='1' then
state <= reset_end;
else
state <= listen_chirp;
end if;
end if;
when listen_chirp =>
if t0_expired='1' then
state <= reset_end; -- no chirp detected
elsif status(1)='0' then
timer_1 <= c_filter_times(g_simulation); -- reset timer
elsif timer_1 = 0 then -- chirp detected
speed_i <= "10"; -- HS!
state <= setup_chirp; -- Let's be RUDE and just send our chirp back -- wait_chirp_end;
timer_1 <= 2 * c_chirp_jk(g_simulation);
else
timer_1 <= timer_1 - 1;
end if;
when wait_chirp_end =>
if t0_expired='1' then
speed_i <= "11"; -- error
state <= reset_end;
elsif status(1)='0' then
if timer_1 = 0 then
if latest_chirp_start = '1' then
speed_i <= "11";
state <= reset_end;
else
state <= setup_chirp;
end if;
else
timer_1 <= timer_1 - 1;
end if;
else
timer_1 <= 2 * c_chirp_jk(g_simulation); -- reset timer
end if;
when setup_chirp =>
timer_1 <= c_chirp_jk(g_simulation);
send_packet <= '1';
state <= hub_chirp_k;
when hub_chirp_k =>
user_data <= X"00";
user_valid <= '1';
user_last <= '0';
send_packet <= '0';
if timer_1 = 0 then
if stop_chirp = '1' then
state <= reset_end;
user_last <= '1'; -- data is still 0
else
user_data <= X"FF";
state <= hub_chirp_j;
timer_1 <= c_chirp_jk(g_simulation);
end if;
else
timer_1 <= timer_1 - 1;
end if;
when hub_chirp_j =>
if timer_1 = 0 then
timer_1 <= c_chirp_jk(g_simulation);
user_data <= X"00";
state <= hub_chirp_k;
else
timer_1 <= timer_1 - 1;
end if;
when reset_end =>
user_valid <= '0';
user_last <= '0';
if t0_expired = '1' then
reg_address <= std_logic_vector(to_unsigned(4, reg_address'length));
reg_write <= '1';
reg_wdata <= map_speed(speed_i) or X"20"; -- reset bit set
state <= reset_finished;
end if;
when reset_finished =>
if reg_ack='1' then
reg_write <= '0';
reset_done_i <= '1';
state <= idle;
end if;
when others =>
null;
end case;
if reset = '1' then
disable_hs <= '0';
speed_i <= "11"; -- error or uninitialized
state <= idle;
reset_done_i <= '0';
sof_enable <= '0';
scan_enable <= '1';
user_data <= X"00";
user_last <= '0';
user_valid <= '0';
send_packet <= '0';
reg_read <= '0';
reg_write <= '0';
reg_wdata <= X"00";
reg_address <= (others => '0');
resp_data <= (others => '0');
timer_2 <= 31;
t2_expired <= '0';
low_speed <= '0';
stop_chirp <= '0';
latest_chirp_start <= '0';
usb_busy <= '0';
debug <= '0';
end if;
end if;
end process;
end functional;
| gpl-3.0 | 696dce201d810eb32645c97cfc2951e0 | 0.38016 | 4.325921 | false | false | false | false |
markusC64/1541ultimate2 | fpga/altera/testbench/mem_io_synth.vhd | 1 | 4,323 | --------------------------------------------------------------------------------
-- Entity: mem_io_synth
-- Date:2016-07-17
-- Author: Gideon
--
-- Description: Testbench for altera io for ddr
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity mem_io_synth is
port (
ref_clock : in std_logic := '0';
ref_reset : in std_logic;
sys_clock : out std_logic;
sys_reset : out std_logic;
write_data : out std_logic_vector(15 downto 0);
read_data : out std_logic_vector(15 downto 0);
do_read : out std_logic;
rdata_valid : out std_logic;
mode : in std_logic_vector(1 downto 0) := "00";
measurement : out std_logic_vector(11 downto 0);
SDRAM_CLK : inout std_logic := 'Z';
SDRAM_CLKn : inout std_logic := 'Z';
SDRAM_A : out std_logic_vector(7 downto 0);
SDRAM_DQ : inout std_logic_vector(3 downto 0);
SDRAM_DQS : inout std_logic );
end entity;
architecture arch of mem_io_synth is
signal sys_clock_i : std_logic;
signal sys_reset_i : std_logic;
signal phasecounterselect : std_logic_vector(2 downto 0) := (others => '0');
signal phasestep : std_logic := '0';
signal phaseupdown : std_logic := '0';
signal phasedone : std_logic := '0';
signal addr_first : std_logic_vector(7 downto 0) := X"00";
signal addr_second : std_logic_vector(7 downto 0) := X"00";
signal wdata : std_logic_vector(15 downto 0) := X"0000";
signal wdata_oe : std_logic;
signal counter : unsigned(4 downto 0) := (others => '0');
begin
i_mut: entity work.mem_io
port map (
ref_clock => ref_clock,
ref_reset => ref_reset,
sys_clock => sys_clock_i,
sys_reset => sys_reset_i,
phasecounterselect => phasecounterselect,
phasestep => phasestep,
phaseupdown => phaseupdown,
phasedone => phasedone,
mode => mode,
measurement => measurement,
addr_first => addr_first,
addr_second => addr_second,
wdata => wdata,
wdata_oe => wdata_oe,
rdata => read_data,
mem_clk_p => SDRAM_CLK,
mem_clk_n => SDRAM_CLKn,
mem_addr => SDRAM_A,
mem_dq => SDRAM_DQ,
mem_dqs => SDRAM_DQS
);
process(sys_clock_i, phasedone)
begin
if rising_edge(sys_clock_i) then
counter <= counter + 1;
wdata_oe <= '0';
addr_first <= (others => '1');
addr_second <= (others => '1');
do_read <= '0';
rdata_valid <= '0';
case counter is
when "01101" =>
addr_first(7) <= '0';
addr_first(5) <= '0'; -- write
when "01110" =>
wdata <= wdata(0) & wdata(15 downto 1);
wdata_oe <= '1';
when "01111" =>
addr_first(7) <= '0';
addr_first(6) <= '0'; -- row
when "10000" =>
addr_first(7) <= '0';
addr_first(4) <= '0'; -- read
do_read <= '1';
when "10100" =>
rdata_valid <= '1';
when "10111" =>
phasecounterselect <= "101"; -- read clock
phasestep <= '1';
when "01100" =>
phasecounterselect <= "110"; -- measure
phasestep <= '1';
when others =>
null;
end case;
if sys_reset_i = '1' then
phasestep <= '0';
wdata <= X"B769";
end if;
end if;
if phasedone = '0' then
phasestep <= '0';
end if;
end process;
sys_clock <= sys_clock_i;
sys_reset <= sys_reset_i;
write_data <= wdata;
end arch;
| gpl-3.0 | 35449977f8dc3434f94ff4a36ac36d71 | 0.430719 | 4.086011 | false | false | false | false |
markusC64/1541ultimate2 | fpga/nios/nios/synthesis/nios.vhd | 1 | 71,734 | -- nios.vhd
-- Generated using ACDS version 15.1 185
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity nios is
port (
altmemddr_0_auxfull_clk : out std_logic; -- altmemddr_0_auxfull.clk
altmemddr_0_auxhalf_clk : out std_logic; -- altmemddr_0_auxhalf.clk
clk50_clk : in std_logic := '0'; -- clk50.clk
io_ack : in std_logic := '0'; -- io.ack
io_rdata : in std_logic_vector(7 downto 0) := (others => '0'); -- .rdata
io_read : out std_logic; -- .read
io_wdata : out std_logic_vector(7 downto 0); -- .wdata
io_write : out std_logic; -- .write
io_address : out std_logic_vector(19 downto 0); -- .address
io_irq : in std_logic := '0'; -- .irq
mem32_address : in std_logic_vector(25 downto 0) := (others => '0'); -- mem32.address
mem32_direction : in std_logic := '0'; -- .direction
mem32_byte_en : in std_logic_vector(3 downto 0) := (others => '0'); -- .byte_en
mem32_wdata : in std_logic_vector(31 downto 0) := (others => '0'); -- .wdata
mem32_request : in std_logic := '0'; -- .request
mem32_tag : in std_logic_vector(7 downto 0) := (others => '0'); -- .tag
mem32_dack_tag : out std_logic_vector(7 downto 0); -- .dack_tag
mem32_rdata : out std_logic_vector(31 downto 0); -- .rdata
mem32_rack : out std_logic; -- .rack
mem32_rack_tag : out std_logic_vector(7 downto 0); -- .rack_tag
mem_external_local_refresh_ack : out std_logic; -- mem_external.local_refresh_ack
mem_external_local_init_done : out std_logic; -- .local_init_done
mem_external_reset_phy_clk_n : out std_logic; -- .reset_phy_clk_n
memory_mem_odt : out std_logic_vector(0 downto 0); -- memory.mem_odt
memory_mem_clk : inout std_logic_vector(0 downto 0) := (others => '0'); -- .mem_clk
memory_mem_clk_n : inout std_logic_vector(0 downto 0) := (others => '0'); -- .mem_clk_n
memory_mem_cs_n : out std_logic_vector(0 downto 0); -- .mem_cs_n
memory_mem_cke : out std_logic_vector(0 downto 0); -- .mem_cke
memory_mem_addr : out std_logic_vector(13 downto 0); -- .mem_addr
memory_mem_ba : out std_logic_vector(1 downto 0); -- .mem_ba
memory_mem_ras_n : out std_logic; -- .mem_ras_n
memory_mem_cas_n : out std_logic; -- .mem_cas_n
memory_mem_we_n : out std_logic; -- .mem_we_n
memory_mem_dq : inout std_logic_vector(7 downto 0) := (others => '0'); -- .mem_dq
memory_mem_dqs : inout std_logic_vector(0 downto 0) := (others => '0'); -- .mem_dqs
memory_mem_dm : out std_logic_vector(0 downto 0); -- .mem_dm
pio_in_port : in std_logic_vector(31 downto 0) := (others => '0'); -- pio.in_port
pio_out_port : out std_logic_vector(31 downto 0); -- .out_port
reset_reset_n : in std_logic := '0'; -- reset.reset_n
sys_clock_clk : out std_logic; -- sys_clock.clk
sys_reset_reset_n : out std_logic -- sys_reset.reset_n
);
end entity nios;
architecture rtl of nios is
component nios_altmemddr_0 is
port (
local_address : in std_logic_vector(23 downto 0) := (others => 'X'); -- address
local_write_req : in std_logic := 'X'; -- write
local_read_req : in std_logic := 'X'; -- read
local_burstbegin : in std_logic := 'X'; -- beginbursttransfer
local_ready : out std_logic; -- waitrequest_n
local_rdata : out std_logic_vector(31 downto 0); -- readdata
local_rdata_valid : out std_logic; -- readdatavalid
local_wdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
local_be : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
local_size : in std_logic_vector(2 downto 0) := (others => 'X'); -- burstcount
local_refresh_ack : out std_logic; -- export
local_init_done : out std_logic; -- export
reset_phy_clk_n : out std_logic; -- export
mem_odt : out std_logic_vector(0 downto 0); -- mem_odt
mem_clk : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_clk
mem_clk_n : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_clk_n
mem_cs_n : out std_logic_vector(0 downto 0); -- mem_cs_n
mem_cke : out std_logic_vector(0 downto 0); -- mem_cke
mem_addr : out std_logic_vector(13 downto 0); -- mem_addr
mem_ba : out std_logic_vector(1 downto 0); -- mem_ba
mem_ras_n : out std_logic; -- mem_ras_n
mem_cas_n : out std_logic; -- mem_cas_n
mem_we_n : out std_logic; -- mem_we_n
mem_dq : inout std_logic_vector(7 downto 0) := (others => 'X'); -- mem_dq
mem_dqs : inout std_logic_vector(0 downto 0) := (others => 'X'); -- mem_dqs
mem_dm : out std_logic_vector(0 downto 0); -- mem_dm
pll_ref_clk : in std_logic := 'X'; -- clk
soft_reset_n : in std_logic := 'X'; -- reset_n
global_reset_n : in std_logic := 'X'; -- reset_n
reset_request_n : out std_logic; -- reset_n
phy_clk : out std_logic; -- clk
aux_full_rate_clk : out std_logic; -- clk
aux_half_rate_clk : out std_logic -- clk
);
end component nios_altmemddr_0;
component avalon_to_io_bridge is
port (
reset : in std_logic := 'X'; -- reset
avs_read : in std_logic := 'X'; -- read
avs_write : in std_logic := 'X'; -- write
avs_address : in std_logic_vector(19 downto 0) := (others => 'X'); -- address
avs_writedata : in std_logic_vector(7 downto 0) := (others => 'X'); -- writedata
avs_ready : out std_logic; -- waitrequest_n
avs_readdata : out std_logic_vector(7 downto 0); -- readdata
avs_readdatavalid : out std_logic; -- readdatavalid
clock : in std_logic := 'X'; -- clk
io_ack : in std_logic := 'X'; -- ack
io_rdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- rdata
io_read : out std_logic; -- read
io_wdata : out std_logic_vector(7 downto 0); -- wdata
io_write : out std_logic; -- write
io_address : out std_logic_vector(19 downto 0); -- address
io_irq : in std_logic := 'X'; -- irq
avs_irq : out std_logic -- irq
);
end component avalon_to_io_bridge;
component mem32_to_avalon_bridge is
port (
reset : in std_logic := 'X'; -- reset
clock : in std_logic := 'X'; -- clk
memreq_address : in std_logic_vector(25 downto 0) := (others => 'X'); -- address
memreq_read_writen : in std_logic := 'X'; -- direction
memreq_byte_en : in std_logic_vector(3 downto 0) := (others => 'X'); -- byte_en
memreq_data : in std_logic_vector(31 downto 0) := (others => 'X'); -- wdata
memreq_request : in std_logic := 'X'; -- request
memreq_tag : in std_logic_vector(7 downto 0) := (others => 'X'); -- tag
memresp_dack_tag : out std_logic_vector(7 downto 0); -- dack_tag
memresp_data : out std_logic_vector(31 downto 0); -- rdata
memresp_rack : out std_logic; -- rack
memresp_rack_tag : out std_logic_vector(7 downto 0); -- rack_tag
avm_read : out std_logic; -- read
avm_write : out std_logic; -- write
avm_address : out std_logic_vector(25 downto 0); -- address
avm_writedata : out std_logic_vector(31 downto 0); -- writedata
avm_byte_enable : out std_logic_vector(3 downto 0); -- byteenable
avm_ready : in std_logic := 'X'; -- waitrequest_n
avm_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
avm_readdatavalid : in std_logic := 'X' -- readdatavalid
);
end component mem32_to_avalon_bridge;
component nios_nios2_gen2_0 is
port (
clk : in std_logic := 'X'; -- clk
reset_n : in std_logic := 'X'; -- reset_n
reset_req : in std_logic := 'X'; -- reset_req
d_address : out std_logic_vector(28 downto 0); -- address
d_byteenable : out std_logic_vector(3 downto 0); -- byteenable
d_read : out std_logic; -- read
d_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
d_waitrequest : in std_logic := 'X'; -- waitrequest
d_write : out std_logic; -- write
d_writedata : out std_logic_vector(31 downto 0); -- writedata
debug_mem_slave_debugaccess_to_roms : out std_logic; -- debugaccess
i_address : out std_logic_vector(28 downto 0); -- address
i_read : out std_logic; -- read
i_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
i_waitrequest : in std_logic := 'X'; -- waitrequest
irq : in std_logic_vector(31 downto 0) := (others => 'X'); -- irq
debug_reset_request : out std_logic; -- reset
debug_mem_slave_address : in std_logic_vector(8 downto 0) := (others => 'X'); -- address
debug_mem_slave_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
debug_mem_slave_debugaccess : in std_logic := 'X'; -- debugaccess
debug_mem_slave_read : in std_logic := 'X'; -- read
debug_mem_slave_readdata : out std_logic_vector(31 downto 0); -- readdata
debug_mem_slave_waitrequest : out std_logic; -- waitrequest
debug_mem_slave_write : in std_logic := 'X'; -- write
debug_mem_slave_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
dummy_ci_port : out std_logic -- readra
);
end component nios_nios2_gen2_0;
component nios_pio_0 is
port (
clk : in std_logic := 'X'; -- clk
reset_n : in std_logic := 'X'; -- reset_n
address : in std_logic_vector(2 downto 0) := (others => 'X'); -- address
write_n : in std_logic := 'X'; -- write_n
writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
chipselect : in std_logic := 'X'; -- chipselect
readdata : out std_logic_vector(31 downto 0); -- readdata
in_port : in std_logic_vector(31 downto 0) := (others => 'X'); -- export
out_port : out std_logic_vector(31 downto 0); -- export
irq : out std_logic -- irq
);
end component nios_pio_0;
component nios_mm_interconnect_0 is
port (
altmemddr_0_sysclk_clk : in std_logic := 'X'; -- clk
mem32_to_avalon_0_reset_reset_bridge_in_reset_reset : in std_logic := 'X'; -- reset
nios2_gen2_0_reset_reset_bridge_in_reset_reset : in std_logic := 'X'; -- reset
mem32_to_avalon_0_avalon_master_address : in std_logic_vector(25 downto 0) := (others => 'X'); -- address
mem32_to_avalon_0_avalon_master_waitrequest : out std_logic; -- waitrequest
mem32_to_avalon_0_avalon_master_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
mem32_to_avalon_0_avalon_master_read : in std_logic := 'X'; -- read
mem32_to_avalon_0_avalon_master_readdata : out std_logic_vector(31 downto 0); -- readdata
mem32_to_avalon_0_avalon_master_readdatavalid : out std_logic; -- readdatavalid
mem32_to_avalon_0_avalon_master_write : in std_logic := 'X'; -- write
mem32_to_avalon_0_avalon_master_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
nios2_gen2_0_data_master_address : in std_logic_vector(28 downto 0) := (others => 'X'); -- address
nios2_gen2_0_data_master_waitrequest : out std_logic; -- waitrequest
nios2_gen2_0_data_master_byteenable : in std_logic_vector(3 downto 0) := (others => 'X'); -- byteenable
nios2_gen2_0_data_master_read : in std_logic := 'X'; -- read
nios2_gen2_0_data_master_readdata : out std_logic_vector(31 downto 0); -- readdata
nios2_gen2_0_data_master_write : in std_logic := 'X'; -- write
nios2_gen2_0_data_master_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
nios2_gen2_0_data_master_debugaccess : in std_logic := 'X'; -- debugaccess
nios2_gen2_0_instruction_master_address : in std_logic_vector(28 downto 0) := (others => 'X'); -- address
nios2_gen2_0_instruction_master_waitrequest : out std_logic; -- waitrequest
nios2_gen2_0_instruction_master_read : in std_logic := 'X'; -- read
nios2_gen2_0_instruction_master_readdata : out std_logic_vector(31 downto 0); -- readdata
altmemddr_0_s1_address : out std_logic_vector(23 downto 0); -- address
altmemddr_0_s1_write : out std_logic; -- write
altmemddr_0_s1_read : out std_logic; -- read
altmemddr_0_s1_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
altmemddr_0_s1_writedata : out std_logic_vector(31 downto 0); -- writedata
altmemddr_0_s1_beginbursttransfer : out std_logic; -- beginbursttransfer
altmemddr_0_s1_burstcount : out std_logic_vector(2 downto 0); -- burstcount
altmemddr_0_s1_byteenable : out std_logic_vector(3 downto 0); -- byteenable
altmemddr_0_s1_readdatavalid : in std_logic := 'X'; -- readdatavalid
altmemddr_0_s1_waitrequest : in std_logic := 'X'; -- waitrequest
io_bridge_0_avalon_slave_0_address : out std_logic_vector(19 downto 0); -- address
io_bridge_0_avalon_slave_0_write : out std_logic; -- write
io_bridge_0_avalon_slave_0_read : out std_logic; -- read
io_bridge_0_avalon_slave_0_readdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- readdata
io_bridge_0_avalon_slave_0_writedata : out std_logic_vector(7 downto 0); -- writedata
io_bridge_0_avalon_slave_0_readdatavalid : in std_logic := 'X'; -- readdatavalid
io_bridge_0_avalon_slave_0_waitrequest : in std_logic := 'X'; -- waitrequest
nios2_gen2_0_debug_mem_slave_address : out std_logic_vector(8 downto 0); -- address
nios2_gen2_0_debug_mem_slave_write : out std_logic; -- write
nios2_gen2_0_debug_mem_slave_read : out std_logic; -- read
nios2_gen2_0_debug_mem_slave_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
nios2_gen2_0_debug_mem_slave_writedata : out std_logic_vector(31 downto 0); -- writedata
nios2_gen2_0_debug_mem_slave_byteenable : out std_logic_vector(3 downto 0); -- byteenable
nios2_gen2_0_debug_mem_slave_waitrequest : in std_logic := 'X'; -- waitrequest
nios2_gen2_0_debug_mem_slave_debugaccess : out std_logic; -- debugaccess
pio_0_s1_address : out std_logic_vector(2 downto 0); -- address
pio_0_s1_write : out std_logic; -- write
pio_0_s1_readdata : in std_logic_vector(31 downto 0) := (others => 'X'); -- readdata
pio_0_s1_writedata : out std_logic_vector(31 downto 0); -- writedata
pio_0_s1_chipselect : out std_logic -- chipselect
);
end component nios_mm_interconnect_0;
component nios_irq_mapper is
port (
clk : in std_logic := 'X'; -- clk
reset : in std_logic := 'X'; -- reset
receiver0_irq : in std_logic := 'X'; -- irq
receiver1_irq : in std_logic := 'X'; -- irq
sender_irq : out std_logic_vector(31 downto 0) -- irq
);
end component nios_irq_mapper;
component nios_rst_controller is
generic (
NUM_RESET_INPUTS : integer := 6;
OUTPUT_RESET_SYNC_EDGES : string := "deassert";
SYNC_DEPTH : integer := 2;
RESET_REQUEST_PRESENT : integer := 0;
RESET_REQ_WAIT_TIME : integer := 1;
MIN_RST_ASSERTION_TIME : integer := 3;
RESET_REQ_EARLY_DSRT_TIME : integer := 1;
USE_RESET_REQUEST_IN0 : integer := 0;
USE_RESET_REQUEST_IN1 : integer := 0;
USE_RESET_REQUEST_IN2 : integer := 0;
USE_RESET_REQUEST_IN3 : integer := 0;
USE_RESET_REQUEST_IN4 : integer := 0;
USE_RESET_REQUEST_IN5 : integer := 0;
USE_RESET_REQUEST_IN6 : integer := 0;
USE_RESET_REQUEST_IN7 : integer := 0;
USE_RESET_REQUEST_IN8 : integer := 0;
USE_RESET_REQUEST_IN9 : integer := 0;
USE_RESET_REQUEST_IN10 : integer := 0;
USE_RESET_REQUEST_IN11 : integer := 0;
USE_RESET_REQUEST_IN12 : integer := 0;
USE_RESET_REQUEST_IN13 : integer := 0;
USE_RESET_REQUEST_IN14 : integer := 0;
USE_RESET_REQUEST_IN15 : integer := 0;
ADAPT_RESET_REQUEST : integer := 0
);
port (
reset_in0 : in std_logic := 'X'; -- reset
reset_in1 : in std_logic := 'X'; -- reset
clk : in std_logic := 'X'; -- clk
reset_out : out std_logic; -- reset
reset_req : out std_logic; -- reset_req
reset_req_in0 : in std_logic := 'X'; -- reset_req
reset_req_in1 : in std_logic := 'X'; -- reset_req
reset_in2 : in std_logic := 'X'; -- reset
reset_req_in2 : in std_logic := 'X'; -- reset_req
reset_in3 : in std_logic := 'X'; -- reset
reset_req_in3 : in std_logic := 'X'; -- reset_req
reset_in4 : in std_logic := 'X'; -- reset
reset_req_in4 : in std_logic := 'X'; -- reset_req
reset_in5 : in std_logic := 'X'; -- reset
reset_req_in5 : in std_logic := 'X'; -- reset_req
reset_in6 : in std_logic := 'X'; -- reset
reset_req_in6 : in std_logic := 'X'; -- reset_req
reset_in7 : in std_logic := 'X'; -- reset
reset_req_in7 : in std_logic := 'X'; -- reset_req
reset_in8 : in std_logic := 'X'; -- reset
reset_req_in8 : in std_logic := 'X'; -- reset_req
reset_in9 : in std_logic := 'X'; -- reset
reset_req_in9 : in std_logic := 'X'; -- reset_req
reset_in10 : in std_logic := 'X'; -- reset
reset_req_in10 : in std_logic := 'X'; -- reset_req
reset_in11 : in std_logic := 'X'; -- reset
reset_req_in11 : in std_logic := 'X'; -- reset_req
reset_in12 : in std_logic := 'X'; -- reset
reset_req_in12 : in std_logic := 'X'; -- reset_req
reset_in13 : in std_logic := 'X'; -- reset
reset_req_in13 : in std_logic := 'X'; -- reset_req
reset_in14 : in std_logic := 'X'; -- reset
reset_req_in14 : in std_logic := 'X'; -- reset_req
reset_in15 : in std_logic := 'X'; -- reset
reset_req_in15 : in std_logic := 'X' -- reset_req
);
end component nios_rst_controller;
component nios_rst_controller_001 is
generic (
NUM_RESET_INPUTS : integer := 6;
OUTPUT_RESET_SYNC_EDGES : string := "deassert";
SYNC_DEPTH : integer := 2;
RESET_REQUEST_PRESENT : integer := 0;
RESET_REQ_WAIT_TIME : integer := 1;
MIN_RST_ASSERTION_TIME : integer := 3;
RESET_REQ_EARLY_DSRT_TIME : integer := 1;
USE_RESET_REQUEST_IN0 : integer := 0;
USE_RESET_REQUEST_IN1 : integer := 0;
USE_RESET_REQUEST_IN2 : integer := 0;
USE_RESET_REQUEST_IN3 : integer := 0;
USE_RESET_REQUEST_IN4 : integer := 0;
USE_RESET_REQUEST_IN5 : integer := 0;
USE_RESET_REQUEST_IN6 : integer := 0;
USE_RESET_REQUEST_IN7 : integer := 0;
USE_RESET_REQUEST_IN8 : integer := 0;
USE_RESET_REQUEST_IN9 : integer := 0;
USE_RESET_REQUEST_IN10 : integer := 0;
USE_RESET_REQUEST_IN11 : integer := 0;
USE_RESET_REQUEST_IN12 : integer := 0;
USE_RESET_REQUEST_IN13 : integer := 0;
USE_RESET_REQUEST_IN14 : integer := 0;
USE_RESET_REQUEST_IN15 : integer := 0;
ADAPT_RESET_REQUEST : integer := 0
);
port (
reset_in0 : in std_logic := 'X'; -- reset
clk : in std_logic := 'X'; -- clk
reset_out : out std_logic; -- reset
reset_req : out std_logic; -- reset_req
reset_req_in0 : in std_logic := 'X'; -- reset_req
reset_in1 : in std_logic := 'X'; -- reset
reset_req_in1 : in std_logic := 'X'; -- reset_req
reset_in2 : in std_logic := 'X'; -- reset
reset_req_in2 : in std_logic := 'X'; -- reset_req
reset_in3 : in std_logic := 'X'; -- reset
reset_req_in3 : in std_logic := 'X'; -- reset_req
reset_in4 : in std_logic := 'X'; -- reset
reset_req_in4 : in std_logic := 'X'; -- reset_req
reset_in5 : in std_logic := 'X'; -- reset
reset_req_in5 : in std_logic := 'X'; -- reset_req
reset_in6 : in std_logic := 'X'; -- reset
reset_req_in6 : in std_logic := 'X'; -- reset_req
reset_in7 : in std_logic := 'X'; -- reset
reset_req_in7 : in std_logic := 'X'; -- reset_req
reset_in8 : in std_logic := 'X'; -- reset
reset_req_in8 : in std_logic := 'X'; -- reset_req
reset_in9 : in std_logic := 'X'; -- reset
reset_req_in9 : in std_logic := 'X'; -- reset_req
reset_in10 : in std_logic := 'X'; -- reset
reset_req_in10 : in std_logic := 'X'; -- reset_req
reset_in11 : in std_logic := 'X'; -- reset
reset_req_in11 : in std_logic := 'X'; -- reset_req
reset_in12 : in std_logic := 'X'; -- reset
reset_req_in12 : in std_logic := 'X'; -- reset_req
reset_in13 : in std_logic := 'X'; -- reset
reset_req_in13 : in std_logic := 'X'; -- reset_req
reset_in14 : in std_logic := 'X'; -- reset
reset_req_in14 : in std_logic := 'X'; -- reset_req
reset_in15 : in std_logic := 'X'; -- reset
reset_req_in15 : in std_logic := 'X' -- reset_req
);
end component nios_rst_controller_001;
signal altmemddr_0_sysclk_clk : std_logic; -- altmemddr_0:phy_clk -> [sys_clock_clk, io_bridge_0:clock, irq_mapper:clk, mem32_to_avalon_0:clock, mm_interconnect_0:altmemddr_0_sysclk_clk, nios2_gen2_0:clk, pio_0:clk, rst_controller:clk, rst_controller_001:clk]
signal mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest : std_logic; -- mm_interconnect_0:mem32_to_avalon_0_avalon_master_waitrequest -> mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest:in
signal mem32_to_avalon_0_avalon_master_readdata : std_logic_vector(31 downto 0); -- mm_interconnect_0:mem32_to_avalon_0_avalon_master_readdata -> mem32_to_avalon_0:avm_readdata
signal mem32_to_avalon_0_avalon_master_read : std_logic; -- mem32_to_avalon_0:avm_read -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_read
signal mem32_to_avalon_0_avalon_master_address : std_logic_vector(25 downto 0); -- mem32_to_avalon_0:avm_address -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_address
signal mem32_to_avalon_0_avalon_master_byteenable : std_logic_vector(3 downto 0); -- mem32_to_avalon_0:avm_byte_enable -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_byteenable
signal mem32_to_avalon_0_avalon_master_readdatavalid : std_logic; -- mm_interconnect_0:mem32_to_avalon_0_avalon_master_readdatavalid -> mem32_to_avalon_0:avm_readdatavalid
signal mem32_to_avalon_0_avalon_master_write : std_logic; -- mem32_to_avalon_0:avm_write -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_write
signal mem32_to_avalon_0_avalon_master_writedata : std_logic_vector(31 downto 0); -- mem32_to_avalon_0:avm_writedata -> mm_interconnect_0:mem32_to_avalon_0_avalon_master_writedata
signal nios2_gen2_0_data_master_readdata : std_logic_vector(31 downto 0); -- mm_interconnect_0:nios2_gen2_0_data_master_readdata -> nios2_gen2_0:d_readdata
signal nios2_gen2_0_data_master_waitrequest : std_logic; -- mm_interconnect_0:nios2_gen2_0_data_master_waitrequest -> nios2_gen2_0:d_waitrequest
signal nios2_gen2_0_data_master_debugaccess : std_logic; -- nios2_gen2_0:debug_mem_slave_debugaccess_to_roms -> mm_interconnect_0:nios2_gen2_0_data_master_debugaccess
signal nios2_gen2_0_data_master_address : std_logic_vector(28 downto 0); -- nios2_gen2_0:d_address -> mm_interconnect_0:nios2_gen2_0_data_master_address
signal nios2_gen2_0_data_master_byteenable : std_logic_vector(3 downto 0); -- nios2_gen2_0:d_byteenable -> mm_interconnect_0:nios2_gen2_0_data_master_byteenable
signal nios2_gen2_0_data_master_read : std_logic; -- nios2_gen2_0:d_read -> mm_interconnect_0:nios2_gen2_0_data_master_read
signal nios2_gen2_0_data_master_write : std_logic; -- nios2_gen2_0:d_write -> mm_interconnect_0:nios2_gen2_0_data_master_write
signal nios2_gen2_0_data_master_writedata : std_logic_vector(31 downto 0); -- nios2_gen2_0:d_writedata -> mm_interconnect_0:nios2_gen2_0_data_master_writedata
signal nios2_gen2_0_instruction_master_readdata : std_logic_vector(31 downto 0); -- mm_interconnect_0:nios2_gen2_0_instruction_master_readdata -> nios2_gen2_0:i_readdata
signal nios2_gen2_0_instruction_master_waitrequest : std_logic; -- mm_interconnect_0:nios2_gen2_0_instruction_master_waitrequest -> nios2_gen2_0:i_waitrequest
signal nios2_gen2_0_instruction_master_address : std_logic_vector(28 downto 0); -- nios2_gen2_0:i_address -> mm_interconnect_0:nios2_gen2_0_instruction_master_address
signal nios2_gen2_0_instruction_master_read : std_logic; -- nios2_gen2_0:i_read -> mm_interconnect_0:nios2_gen2_0_instruction_master_read
signal mm_interconnect_0_altmemddr_0_s1_beginbursttransfer : std_logic; -- mm_interconnect_0:altmemddr_0_s1_beginbursttransfer -> altmemddr_0:local_burstbegin
signal mm_interconnect_0_altmemddr_0_s1_readdata : std_logic_vector(31 downto 0); -- altmemddr_0:local_rdata -> mm_interconnect_0:altmemddr_0_s1_readdata
signal altmemddr_0_s1_waitrequest : std_logic; -- altmemddr_0:local_ready -> altmemddr_0_s1_waitrequest:in
signal mm_interconnect_0_altmemddr_0_s1_address : std_logic_vector(23 downto 0); -- mm_interconnect_0:altmemddr_0_s1_address -> altmemddr_0:local_address
signal mm_interconnect_0_altmemddr_0_s1_read : std_logic; -- mm_interconnect_0:altmemddr_0_s1_read -> altmemddr_0:local_read_req
signal mm_interconnect_0_altmemddr_0_s1_byteenable : std_logic_vector(3 downto 0); -- mm_interconnect_0:altmemddr_0_s1_byteenable -> altmemddr_0:local_be
signal mm_interconnect_0_altmemddr_0_s1_readdatavalid : std_logic; -- altmemddr_0:local_rdata_valid -> mm_interconnect_0:altmemddr_0_s1_readdatavalid
signal mm_interconnect_0_altmemddr_0_s1_write : std_logic; -- mm_interconnect_0:altmemddr_0_s1_write -> altmemddr_0:local_write_req
signal mm_interconnect_0_altmemddr_0_s1_writedata : std_logic_vector(31 downto 0); -- mm_interconnect_0:altmemddr_0_s1_writedata -> altmemddr_0:local_wdata
signal mm_interconnect_0_altmemddr_0_s1_burstcount : std_logic_vector(2 downto 0); -- mm_interconnect_0:altmemddr_0_s1_burstcount -> altmemddr_0:local_size
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_readdata : std_logic_vector(31 downto 0); -- nios2_gen2_0:debug_mem_slave_readdata -> mm_interconnect_0:nios2_gen2_0_debug_mem_slave_readdata
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_waitrequest : std_logic; -- nios2_gen2_0:debug_mem_slave_waitrequest -> mm_interconnect_0:nios2_gen2_0_debug_mem_slave_waitrequest
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_debugaccess : std_logic; -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_debugaccess -> nios2_gen2_0:debug_mem_slave_debugaccess
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_address : std_logic_vector(8 downto 0); -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_address -> nios2_gen2_0:debug_mem_slave_address
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_read : std_logic; -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_read -> nios2_gen2_0:debug_mem_slave_read
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_byteenable : std_logic_vector(3 downto 0); -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_byteenable -> nios2_gen2_0:debug_mem_slave_byteenable
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_write : std_logic; -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_write -> nios2_gen2_0:debug_mem_slave_write
signal mm_interconnect_0_nios2_gen2_0_debug_mem_slave_writedata : std_logic_vector(31 downto 0); -- mm_interconnect_0:nios2_gen2_0_debug_mem_slave_writedata -> nios2_gen2_0:debug_mem_slave_writedata
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_readdata : std_logic_vector(7 downto 0); -- io_bridge_0:avs_readdata -> mm_interconnect_0:io_bridge_0_avalon_slave_0_readdata
signal io_bridge_0_avalon_slave_0_waitrequest : std_logic; -- io_bridge_0:avs_ready -> io_bridge_0_avalon_slave_0_waitrequest:in
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_address : std_logic_vector(19 downto 0); -- mm_interconnect_0:io_bridge_0_avalon_slave_0_address -> io_bridge_0:avs_address
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_read : std_logic; -- mm_interconnect_0:io_bridge_0_avalon_slave_0_read -> io_bridge_0:avs_read
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_readdatavalid : std_logic; -- io_bridge_0:avs_readdatavalid -> mm_interconnect_0:io_bridge_0_avalon_slave_0_readdatavalid
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_write : std_logic; -- mm_interconnect_0:io_bridge_0_avalon_slave_0_write -> io_bridge_0:avs_write
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_writedata : std_logic_vector(7 downto 0); -- mm_interconnect_0:io_bridge_0_avalon_slave_0_writedata -> io_bridge_0:avs_writedata
signal mm_interconnect_0_pio_0_s1_chipselect : std_logic; -- mm_interconnect_0:pio_0_s1_chipselect -> pio_0:chipselect
signal mm_interconnect_0_pio_0_s1_readdata : std_logic_vector(31 downto 0); -- pio_0:readdata -> mm_interconnect_0:pio_0_s1_readdata
signal mm_interconnect_0_pio_0_s1_address : std_logic_vector(2 downto 0); -- mm_interconnect_0:pio_0_s1_address -> pio_0:address
signal mm_interconnect_0_pio_0_s1_write : std_logic; -- mm_interconnect_0:pio_0_s1_write -> mm_interconnect_0_pio_0_s1_write:in
signal mm_interconnect_0_pio_0_s1_writedata : std_logic_vector(31 downto 0); -- mm_interconnect_0:pio_0_s1_writedata -> pio_0:writedata
signal irq_mapper_receiver0_irq : std_logic; -- io_bridge_0:avs_irq -> irq_mapper:receiver0_irq
signal irq_mapper_receiver1_irq : std_logic; -- pio_0:irq -> irq_mapper:receiver1_irq
signal nios2_gen2_0_irq_irq : std_logic_vector(31 downto 0); -- irq_mapper:sender_irq -> nios2_gen2_0:irq
signal rst_controller_reset_out_reset : std_logic; -- rst_controller:reset_out -> [io_bridge_0:reset, mem32_to_avalon_0:reset, mm_interconnect_0:mem32_to_avalon_0_reset_reset_bridge_in_reset_reset, rst_controller_reset_out_reset:in]
signal nios2_gen2_0_debug_reset_request_reset : std_logic; -- nios2_gen2_0:debug_reset_request -> rst_controller:reset_in0
signal altmemddr_0_reset_request_n_reset : std_logic; -- altmemddr_0:reset_request_n -> altmemddr_0_reset_request_n_reset:in
signal rst_controller_001_reset_out_reset : std_logic; -- rst_controller_001:reset_out -> [irq_mapper:reset, mm_interconnect_0:nios2_gen2_0_reset_reset_bridge_in_reset_reset, rst_controller_001_reset_out_reset:in]
signal rst_controller_001_reset_out_reset_req : std_logic; -- rst_controller_001:reset_req -> [nios2_gen2_0:reset_req, rst_translator:reset_req_in]
signal mem32_to_avalon_0_avalon_master_inv : std_logic; -- mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest:inv -> mem32_to_avalon_0:avm_ready
signal mm_interconnect_0_altmemddr_0_s1_inv : std_logic; -- altmemddr_0_s1_waitrequest:inv -> mm_interconnect_0:altmemddr_0_s1_waitrequest
signal mm_interconnect_0_io_bridge_0_avalon_slave_0_inv : std_logic; -- io_bridge_0_avalon_slave_0_waitrequest:inv -> mm_interconnect_0:io_bridge_0_avalon_slave_0_waitrequest
signal mm_interconnect_0_pio_0_s1_write_ports_inv : std_logic; -- mm_interconnect_0_pio_0_s1_write:inv -> pio_0:write_n
signal rst_controller_reset_out_reset_ports_inv : std_logic; -- rst_controller_reset_out_reset:inv -> [sys_reset_reset_n, pio_0:reset_n]
signal altmemddr_0_reset_request_n_reset_ports_inv : std_logic; -- altmemddr_0_reset_request_n_reset:inv -> [rst_controller:reset_in1, rst_controller_001:reset_in0]
signal rst_controller_001_reset_out_reset_ports_inv : std_logic; -- rst_controller_001_reset_out_reset:inv -> nios2_gen2_0:reset_n
begin
altmemddr_0 : component nios_altmemddr_0
port map (
local_address => mm_interconnect_0_altmemddr_0_s1_address, -- s1.address
local_write_req => mm_interconnect_0_altmemddr_0_s1_write, -- .write
local_read_req => mm_interconnect_0_altmemddr_0_s1_read, -- .read
local_burstbegin => mm_interconnect_0_altmemddr_0_s1_beginbursttransfer, -- .beginbursttransfer
local_ready => altmemddr_0_s1_waitrequest, -- .waitrequest_n
local_rdata => mm_interconnect_0_altmemddr_0_s1_readdata, -- .readdata
local_rdata_valid => mm_interconnect_0_altmemddr_0_s1_readdatavalid, -- .readdatavalid
local_wdata => mm_interconnect_0_altmemddr_0_s1_writedata, -- .writedata
local_be => mm_interconnect_0_altmemddr_0_s1_byteenable, -- .byteenable
local_size => mm_interconnect_0_altmemddr_0_s1_burstcount, -- .burstcount
local_refresh_ack => mem_external_local_refresh_ack, -- external_connection.export
local_init_done => mem_external_local_init_done, -- .export
reset_phy_clk_n => mem_external_reset_phy_clk_n, -- .export
mem_odt => memory_mem_odt, -- memory.mem_odt
mem_clk => memory_mem_clk, -- .mem_clk
mem_clk_n => memory_mem_clk_n, -- .mem_clk_n
mem_cs_n => memory_mem_cs_n, -- .mem_cs_n
mem_cke => memory_mem_cke, -- .mem_cke
mem_addr => memory_mem_addr, -- .mem_addr
mem_ba => memory_mem_ba, -- .mem_ba
mem_ras_n => memory_mem_ras_n, -- .mem_ras_n
mem_cas_n => memory_mem_cas_n, -- .mem_cas_n
mem_we_n => memory_mem_we_n, -- .mem_we_n
mem_dq => memory_mem_dq, -- .mem_dq
mem_dqs => memory_mem_dqs, -- .mem_dqs
mem_dm => memory_mem_dm, -- .mem_dm
pll_ref_clk => clk50_clk, -- refclk.clk
soft_reset_n => reset_reset_n, -- soft_reset_n.reset_n
global_reset_n => reset_reset_n, -- global_reset_n.reset_n
reset_request_n => altmemddr_0_reset_request_n_reset, -- reset_request_n.reset_n
phy_clk => altmemddr_0_sysclk_clk, -- sysclk.clk
aux_full_rate_clk => altmemddr_0_auxfull_clk, -- auxfull.clk
aux_half_rate_clk => altmemddr_0_auxhalf_clk -- auxhalf.clk
);
io_bridge_0 : component avalon_to_io_bridge
port map (
reset => rst_controller_reset_out_reset, -- reset.reset
avs_read => mm_interconnect_0_io_bridge_0_avalon_slave_0_read, -- avalon_slave_0.read
avs_write => mm_interconnect_0_io_bridge_0_avalon_slave_0_write, -- .write
avs_address => mm_interconnect_0_io_bridge_0_avalon_slave_0_address, -- .address
avs_writedata => mm_interconnect_0_io_bridge_0_avalon_slave_0_writedata, -- .writedata
avs_ready => io_bridge_0_avalon_slave_0_waitrequest, -- .waitrequest_n
avs_readdata => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdata, -- .readdata
avs_readdatavalid => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdatavalid, -- .readdatavalid
clock => altmemddr_0_sysclk_clk, -- clock.clk
io_ack => io_ack, -- io.ack
io_rdata => io_rdata, -- .rdata
io_read => io_read, -- .read
io_wdata => io_wdata, -- .wdata
io_write => io_write, -- .write
io_address => io_address, -- .address
io_irq => io_irq, -- .irq
avs_irq => irq_mapper_receiver0_irq -- irq.irq
);
mem32_to_avalon_0 : component mem32_to_avalon_bridge
port map (
reset => rst_controller_reset_out_reset, -- reset.reset
clock => altmemddr_0_sysclk_clk, -- clock.clk
memreq_address => mem32_address, -- mem32_slave.address
memreq_read_writen => mem32_direction, -- .direction
memreq_byte_en => mem32_byte_en, -- .byte_en
memreq_data => mem32_wdata, -- .wdata
memreq_request => mem32_request, -- .request
memreq_tag => mem32_tag, -- .tag
memresp_dack_tag => mem32_dack_tag, -- .dack_tag
memresp_data => mem32_rdata, -- .rdata
memresp_rack => mem32_rack, -- .rack
memresp_rack_tag => mem32_rack_tag, -- .rack_tag
avm_read => mem32_to_avalon_0_avalon_master_read, -- avalon_master.read
avm_write => mem32_to_avalon_0_avalon_master_write, -- .write
avm_address => mem32_to_avalon_0_avalon_master_address, -- .address
avm_writedata => mem32_to_avalon_0_avalon_master_writedata, -- .writedata
avm_byte_enable => mem32_to_avalon_0_avalon_master_byteenable, -- .byteenable
avm_ready => mem32_to_avalon_0_avalon_master_inv, -- .waitrequest_n
avm_readdata => mem32_to_avalon_0_avalon_master_readdata, -- .readdata
avm_readdatavalid => mem32_to_avalon_0_avalon_master_readdatavalid -- .readdatavalid
);
nios2_gen2_0 : component nios_nios2_gen2_0
port map (
clk => altmemddr_0_sysclk_clk, -- clk.clk
reset_n => rst_controller_001_reset_out_reset_ports_inv, -- reset.reset_n
reset_req => rst_controller_001_reset_out_reset_req, -- .reset_req
d_address => nios2_gen2_0_data_master_address, -- data_master.address
d_byteenable => nios2_gen2_0_data_master_byteenable, -- .byteenable
d_read => nios2_gen2_0_data_master_read, -- .read
d_readdata => nios2_gen2_0_data_master_readdata, -- .readdata
d_waitrequest => nios2_gen2_0_data_master_waitrequest, -- .waitrequest
d_write => nios2_gen2_0_data_master_write, -- .write
d_writedata => nios2_gen2_0_data_master_writedata, -- .writedata
debug_mem_slave_debugaccess_to_roms => nios2_gen2_0_data_master_debugaccess, -- .debugaccess
i_address => nios2_gen2_0_instruction_master_address, -- instruction_master.address
i_read => nios2_gen2_0_instruction_master_read, -- .read
i_readdata => nios2_gen2_0_instruction_master_readdata, -- .readdata
i_waitrequest => nios2_gen2_0_instruction_master_waitrequest, -- .waitrequest
irq => nios2_gen2_0_irq_irq, -- irq.irq
debug_reset_request => nios2_gen2_0_debug_reset_request_reset, -- debug_reset_request.reset
debug_mem_slave_address => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_address, -- debug_mem_slave.address
debug_mem_slave_byteenable => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_byteenable, -- .byteenable
debug_mem_slave_debugaccess => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_debugaccess, -- .debugaccess
debug_mem_slave_read => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_read, -- .read
debug_mem_slave_readdata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_readdata, -- .readdata
debug_mem_slave_waitrequest => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_waitrequest, -- .waitrequest
debug_mem_slave_write => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_write, -- .write
debug_mem_slave_writedata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_writedata, -- .writedata
dummy_ci_port => open -- custom_instruction_master.readra
);
pio_0 : component nios_pio_0
port map (
clk => altmemddr_0_sysclk_clk, -- clk.clk
reset_n => rst_controller_reset_out_reset_ports_inv, -- reset.reset_n
address => mm_interconnect_0_pio_0_s1_address, -- s1.address
write_n => mm_interconnect_0_pio_0_s1_write_ports_inv, -- .write_n
writedata => mm_interconnect_0_pio_0_s1_writedata, -- .writedata
chipselect => mm_interconnect_0_pio_0_s1_chipselect, -- .chipselect
readdata => mm_interconnect_0_pio_0_s1_readdata, -- .readdata
in_port => pio_in_port, -- external_connection.export
out_port => pio_out_port, -- .export
irq => irq_mapper_receiver1_irq -- irq.irq
);
mm_interconnect_0 : component nios_mm_interconnect_0
port map (
altmemddr_0_sysclk_clk => altmemddr_0_sysclk_clk, -- altmemddr_0_sysclk.clk
mem32_to_avalon_0_reset_reset_bridge_in_reset_reset => rst_controller_reset_out_reset, -- mem32_to_avalon_0_reset_reset_bridge_in_reset.reset
nios2_gen2_0_reset_reset_bridge_in_reset_reset => rst_controller_001_reset_out_reset, -- nios2_gen2_0_reset_reset_bridge_in_reset.reset
mem32_to_avalon_0_avalon_master_address => mem32_to_avalon_0_avalon_master_address, -- mem32_to_avalon_0_avalon_master.address
mem32_to_avalon_0_avalon_master_waitrequest => mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest, -- .waitrequest
mem32_to_avalon_0_avalon_master_byteenable => mem32_to_avalon_0_avalon_master_byteenable, -- .byteenable
mem32_to_avalon_0_avalon_master_read => mem32_to_avalon_0_avalon_master_read, -- .read
mem32_to_avalon_0_avalon_master_readdata => mem32_to_avalon_0_avalon_master_readdata, -- .readdata
mem32_to_avalon_0_avalon_master_readdatavalid => mem32_to_avalon_0_avalon_master_readdatavalid, -- .readdatavalid
mem32_to_avalon_0_avalon_master_write => mem32_to_avalon_0_avalon_master_write, -- .write
mem32_to_avalon_0_avalon_master_writedata => mem32_to_avalon_0_avalon_master_writedata, -- .writedata
nios2_gen2_0_data_master_address => nios2_gen2_0_data_master_address, -- nios2_gen2_0_data_master.address
nios2_gen2_0_data_master_waitrequest => nios2_gen2_0_data_master_waitrequest, -- .waitrequest
nios2_gen2_0_data_master_byteenable => nios2_gen2_0_data_master_byteenable, -- .byteenable
nios2_gen2_0_data_master_read => nios2_gen2_0_data_master_read, -- .read
nios2_gen2_0_data_master_readdata => nios2_gen2_0_data_master_readdata, -- .readdata
nios2_gen2_0_data_master_write => nios2_gen2_0_data_master_write, -- .write
nios2_gen2_0_data_master_writedata => nios2_gen2_0_data_master_writedata, -- .writedata
nios2_gen2_0_data_master_debugaccess => nios2_gen2_0_data_master_debugaccess, -- .debugaccess
nios2_gen2_0_instruction_master_address => nios2_gen2_0_instruction_master_address, -- nios2_gen2_0_instruction_master.address
nios2_gen2_0_instruction_master_waitrequest => nios2_gen2_0_instruction_master_waitrequest, -- .waitrequest
nios2_gen2_0_instruction_master_read => nios2_gen2_0_instruction_master_read, -- .read
nios2_gen2_0_instruction_master_readdata => nios2_gen2_0_instruction_master_readdata, -- .readdata
altmemddr_0_s1_address => mm_interconnect_0_altmemddr_0_s1_address, -- altmemddr_0_s1.address
altmemddr_0_s1_write => mm_interconnect_0_altmemddr_0_s1_write, -- .write
altmemddr_0_s1_read => mm_interconnect_0_altmemddr_0_s1_read, -- .read
altmemddr_0_s1_readdata => mm_interconnect_0_altmemddr_0_s1_readdata, -- .readdata
altmemddr_0_s1_writedata => mm_interconnect_0_altmemddr_0_s1_writedata, -- .writedata
altmemddr_0_s1_beginbursttransfer => mm_interconnect_0_altmemddr_0_s1_beginbursttransfer, -- .beginbursttransfer
altmemddr_0_s1_burstcount => mm_interconnect_0_altmemddr_0_s1_burstcount, -- .burstcount
altmemddr_0_s1_byteenable => mm_interconnect_0_altmemddr_0_s1_byteenable, -- .byteenable
altmemddr_0_s1_readdatavalid => mm_interconnect_0_altmemddr_0_s1_readdatavalid, -- .readdatavalid
altmemddr_0_s1_waitrequest => mm_interconnect_0_altmemddr_0_s1_inv, -- .waitrequest
io_bridge_0_avalon_slave_0_address => mm_interconnect_0_io_bridge_0_avalon_slave_0_address, -- io_bridge_0_avalon_slave_0.address
io_bridge_0_avalon_slave_0_write => mm_interconnect_0_io_bridge_0_avalon_slave_0_write, -- .write
io_bridge_0_avalon_slave_0_read => mm_interconnect_0_io_bridge_0_avalon_slave_0_read, -- .read
io_bridge_0_avalon_slave_0_readdata => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdata, -- .readdata
io_bridge_0_avalon_slave_0_writedata => mm_interconnect_0_io_bridge_0_avalon_slave_0_writedata, -- .writedata
io_bridge_0_avalon_slave_0_readdatavalid => mm_interconnect_0_io_bridge_0_avalon_slave_0_readdatavalid, -- .readdatavalid
io_bridge_0_avalon_slave_0_waitrequest => mm_interconnect_0_io_bridge_0_avalon_slave_0_inv, -- .waitrequest
nios2_gen2_0_debug_mem_slave_address => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_address, -- nios2_gen2_0_debug_mem_slave.address
nios2_gen2_0_debug_mem_slave_write => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_write, -- .write
nios2_gen2_0_debug_mem_slave_read => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_read, -- .read
nios2_gen2_0_debug_mem_slave_readdata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_readdata, -- .readdata
nios2_gen2_0_debug_mem_slave_writedata => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_writedata, -- .writedata
nios2_gen2_0_debug_mem_slave_byteenable => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_byteenable, -- .byteenable
nios2_gen2_0_debug_mem_slave_waitrequest => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_waitrequest, -- .waitrequest
nios2_gen2_0_debug_mem_slave_debugaccess => mm_interconnect_0_nios2_gen2_0_debug_mem_slave_debugaccess, -- .debugaccess
pio_0_s1_address => mm_interconnect_0_pio_0_s1_address, -- pio_0_s1.address
pio_0_s1_write => mm_interconnect_0_pio_0_s1_write, -- .write
pio_0_s1_readdata => mm_interconnect_0_pio_0_s1_readdata, -- .readdata
pio_0_s1_writedata => mm_interconnect_0_pio_0_s1_writedata, -- .writedata
pio_0_s1_chipselect => mm_interconnect_0_pio_0_s1_chipselect -- .chipselect
);
irq_mapper : component nios_irq_mapper
port map (
clk => altmemddr_0_sysclk_clk, -- clk.clk
reset => rst_controller_001_reset_out_reset, -- clk_reset.reset
receiver0_irq => irq_mapper_receiver0_irq, -- receiver0.irq
receiver1_irq => irq_mapper_receiver1_irq, -- receiver1.irq
sender_irq => nios2_gen2_0_irq_irq -- sender.irq
);
rst_controller : component nios_rst_controller
generic map (
NUM_RESET_INPUTS => 2,
OUTPUT_RESET_SYNC_EDGES => "deassert",
SYNC_DEPTH => 2,
RESET_REQUEST_PRESENT => 0,
RESET_REQ_WAIT_TIME => 1,
MIN_RST_ASSERTION_TIME => 3,
RESET_REQ_EARLY_DSRT_TIME => 1,
USE_RESET_REQUEST_IN0 => 0,
USE_RESET_REQUEST_IN1 => 0,
USE_RESET_REQUEST_IN2 => 0,
USE_RESET_REQUEST_IN3 => 0,
USE_RESET_REQUEST_IN4 => 0,
USE_RESET_REQUEST_IN5 => 0,
USE_RESET_REQUEST_IN6 => 0,
USE_RESET_REQUEST_IN7 => 0,
USE_RESET_REQUEST_IN8 => 0,
USE_RESET_REQUEST_IN9 => 0,
USE_RESET_REQUEST_IN10 => 0,
USE_RESET_REQUEST_IN11 => 0,
USE_RESET_REQUEST_IN12 => 0,
USE_RESET_REQUEST_IN13 => 0,
USE_RESET_REQUEST_IN14 => 0,
USE_RESET_REQUEST_IN15 => 0,
ADAPT_RESET_REQUEST => 0
)
port map (
reset_in0 => nios2_gen2_0_debug_reset_request_reset, -- reset_in0.reset
reset_in1 => altmemddr_0_reset_request_n_reset_ports_inv, -- reset_in1.reset
clk => altmemddr_0_sysclk_clk, -- clk.clk
reset_out => rst_controller_reset_out_reset, -- reset_out.reset
reset_req => open, -- (terminated)
reset_req_in0 => '0', -- (terminated)
reset_req_in1 => '0', -- (terminated)
reset_in2 => '0', -- (terminated)
reset_req_in2 => '0', -- (terminated)
reset_in3 => '0', -- (terminated)
reset_req_in3 => '0', -- (terminated)
reset_in4 => '0', -- (terminated)
reset_req_in4 => '0', -- (terminated)
reset_in5 => '0', -- (terminated)
reset_req_in5 => '0', -- (terminated)
reset_in6 => '0', -- (terminated)
reset_req_in6 => '0', -- (terminated)
reset_in7 => '0', -- (terminated)
reset_req_in7 => '0', -- (terminated)
reset_in8 => '0', -- (terminated)
reset_req_in8 => '0', -- (terminated)
reset_in9 => '0', -- (terminated)
reset_req_in9 => '0', -- (terminated)
reset_in10 => '0', -- (terminated)
reset_req_in10 => '0', -- (terminated)
reset_in11 => '0', -- (terminated)
reset_req_in11 => '0', -- (terminated)
reset_in12 => '0', -- (terminated)
reset_req_in12 => '0', -- (terminated)
reset_in13 => '0', -- (terminated)
reset_req_in13 => '0', -- (terminated)
reset_in14 => '0', -- (terminated)
reset_req_in14 => '0', -- (terminated)
reset_in15 => '0', -- (terminated)
reset_req_in15 => '0' -- (terminated)
);
rst_controller_001 : component nios_rst_controller_001
generic map (
NUM_RESET_INPUTS => 1,
OUTPUT_RESET_SYNC_EDGES => "deassert",
SYNC_DEPTH => 2,
RESET_REQUEST_PRESENT => 1,
RESET_REQ_WAIT_TIME => 1,
MIN_RST_ASSERTION_TIME => 3,
RESET_REQ_EARLY_DSRT_TIME => 1,
USE_RESET_REQUEST_IN0 => 0,
USE_RESET_REQUEST_IN1 => 0,
USE_RESET_REQUEST_IN2 => 0,
USE_RESET_REQUEST_IN3 => 0,
USE_RESET_REQUEST_IN4 => 0,
USE_RESET_REQUEST_IN5 => 0,
USE_RESET_REQUEST_IN6 => 0,
USE_RESET_REQUEST_IN7 => 0,
USE_RESET_REQUEST_IN8 => 0,
USE_RESET_REQUEST_IN9 => 0,
USE_RESET_REQUEST_IN10 => 0,
USE_RESET_REQUEST_IN11 => 0,
USE_RESET_REQUEST_IN12 => 0,
USE_RESET_REQUEST_IN13 => 0,
USE_RESET_REQUEST_IN14 => 0,
USE_RESET_REQUEST_IN15 => 0,
ADAPT_RESET_REQUEST => 0
)
port map (
reset_in0 => altmemddr_0_reset_request_n_reset_ports_inv, -- reset_in0.reset
clk => altmemddr_0_sysclk_clk, -- clk.clk
reset_out => rst_controller_001_reset_out_reset, -- reset_out.reset
reset_req => rst_controller_001_reset_out_reset_req, -- .reset_req
reset_req_in0 => '0', -- (terminated)
reset_in1 => '0', -- (terminated)
reset_req_in1 => '0', -- (terminated)
reset_in2 => '0', -- (terminated)
reset_req_in2 => '0', -- (terminated)
reset_in3 => '0', -- (terminated)
reset_req_in3 => '0', -- (terminated)
reset_in4 => '0', -- (terminated)
reset_req_in4 => '0', -- (terminated)
reset_in5 => '0', -- (terminated)
reset_req_in5 => '0', -- (terminated)
reset_in6 => '0', -- (terminated)
reset_req_in6 => '0', -- (terminated)
reset_in7 => '0', -- (terminated)
reset_req_in7 => '0', -- (terminated)
reset_in8 => '0', -- (terminated)
reset_req_in8 => '0', -- (terminated)
reset_in9 => '0', -- (terminated)
reset_req_in9 => '0', -- (terminated)
reset_in10 => '0', -- (terminated)
reset_req_in10 => '0', -- (terminated)
reset_in11 => '0', -- (terminated)
reset_req_in11 => '0', -- (terminated)
reset_in12 => '0', -- (terminated)
reset_req_in12 => '0', -- (terminated)
reset_in13 => '0', -- (terminated)
reset_req_in13 => '0', -- (terminated)
reset_in14 => '0', -- (terminated)
reset_req_in14 => '0', -- (terminated)
reset_in15 => '0', -- (terminated)
reset_req_in15 => '0' -- (terminated)
);
mem32_to_avalon_0_avalon_master_inv <= not mm_interconnect_0_mem32_to_avalon_0_avalon_master_waitrequest;
mm_interconnect_0_altmemddr_0_s1_inv <= not altmemddr_0_s1_waitrequest;
mm_interconnect_0_io_bridge_0_avalon_slave_0_inv <= not io_bridge_0_avalon_slave_0_waitrequest;
mm_interconnect_0_pio_0_s1_write_ports_inv <= not mm_interconnect_0_pio_0_s1_write;
rst_controller_reset_out_reset_ports_inv <= not rst_controller_reset_out_reset;
altmemddr_0_reset_request_n_reset_ports_inv <= not altmemddr_0_reset_request_n_reset;
rst_controller_001_reset_out_reset_ports_inv <= not rst_controller_001_reset_out_reset;
sys_clock_clk <= altmemddr_0_sysclk_clk;
sys_reset_reset_n <= rst_controller_reset_out_reset_ports_inv;
end architecture rtl; -- of nios
| gpl-3.0 | 58b8a4e05eb2b1d9678c5a05b9d6a125 | 0.45698 | 3.759644 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/usb2/vhdl_source/usb_host_nano.vhd | 1 | 9,936 | --------------------------------------------------------------------------------
-- Gideon's Logic Architectures - Copyright 2014
-- Entity: usb_host_controller
-- Date:2015-02-12
-- Author: Gideon
-- Description: Top level of second generation USB controller with memory
-- interface.
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
use work.usb_pkg.all;
use work.usb_cmd_pkg.all;
use work.mem_bus_pkg.all;
use work.endianness_pkg.all;
library unisim;
use unisim.vcomponents.all;
entity usb_host_nano is
generic (
g_big_endian : boolean;
g_incl_debug : boolean := false;
g_tag : std_logic_vector(7 downto 0) := X"05";
g_simulation : boolean := false );
port (
clock : in std_logic;
reset : in std_logic;
ulpi_nxt : in std_logic;
ulpi_dir : in std_logic;
ulpi_stp : out std_logic;
ulpi_data : inout std_logic_vector(7 downto 0);
debug_data : out std_logic_vector(31 downto 0);
debug_valid : out std_logic;
error_pulse : out std_logic;
--
sys_clock : in std_logic;
sys_reset : in std_logic;
sys_mem_req : out t_mem_req_32;
sys_mem_resp: in t_mem_resp_32;
sys_io_req : in t_io_req;
sys_io_resp : out t_io_resp;
sys_irq : out std_logic );
end entity;
architecture arch of usb_host_nano is
signal nano_addr : unsigned(7 downto 0);
signal nano_write : std_logic;
signal nano_read : std_logic;
signal nano_wdata : std_logic_vector(15 downto 0);
signal nano_rdata : std_logic_vector(15 downto 0);
signal nano_rdata_cmd : std_logic_vector(15 downto 0);
signal nano_stall : std_logic := '0';
signal reg_read : std_logic := '0';
signal reg_write : std_logic := '0';
signal reg_ack : std_logic;
signal reg_address : std_logic_vector(5 downto 0);
signal reg_wdata : std_logic_vector(7 downto 0);
signal reg_rdata : std_logic_vector(7 downto 0);
-- cmd interface
signal cmd_addr : std_logic_vector(3 downto 0);
signal cmd_valid : std_logic;
signal cmd_write : std_logic;
signal cmd_wdata : std_logic_vector(15 downto 0);
signal cmd_ack : std_logic;
signal cmd_ready : std_logic;
signal status : std_logic_vector(7 downto 0);
signal speed : std_logic_vector(1 downto 0) := "10";
signal do_chirp : std_logic;
signal chirp_data : std_logic;
signal sof_enable : std_logic;
signal mem_ctrl_ready : std_logic;
signal buf_address : unsigned(10 downto 0);
signal buf_en : std_logic;
signal buf_we : std_logic;
signal buf_rdata : std_logic_vector(7 downto 0);
signal buf_wdata : std_logic_vector(7 downto 0);
signal sys_buf_addr : std_logic_vector(10 downto 2);
signal sys_buf_en : std_logic;
signal sys_buf_we : std_logic_vector(3 downto 0);
signal sys_buf_wdata : std_logic_vector(31 downto 0);
signal sys_buf_rdata : std_logic_vector(31 downto 0);
signal sys_buf_rdata_le: std_logic_vector(31 downto 0);
signal usb_tx_req : t_usb_tx_req;
signal usb_tx_resp : t_usb_tx_resp;
signal usb_rx : t_usb_rx;
signal usb_cmd_req : t_usb_cmd_req;
signal usb_cmd_resp : t_usb_cmd_resp;
signal frame_count : unsigned(15 downto 0);
signal sof_tick : std_logic;
signal interrupt : std_logic;
begin
i_intf: entity work.usb_host_interface
generic map (
g_simulation => g_simulation )
port map (
clock => clock,
reset => reset,
usb_rx => usb_rx,
usb_tx_req => usb_tx_req,
usb_tx_resp => usb_tx_resp,
reg_read => reg_read,
reg_write => reg_write,
reg_address => reg_address,
reg_wdata => reg_wdata,
reg_rdata => reg_rdata,
reg_ack => reg_ack,
do_chirp => do_chirp,
chirp_data => chirp_data,
status => status,
speed => speed,
ulpi_nxt => ulpi_nxt,
ulpi_stp => ulpi_stp,
ulpi_dir => ulpi_dir,
ulpi_data => ulpi_data );
i_seq: entity work.host_sequencer
port map (
clock => clock,
reset => reset,
buf_address => buf_address,
buf_en => buf_en,
buf_we => buf_we,
buf_rdata => buf_rdata,
buf_wdata => buf_wdata,
sof_enable => sof_enable,
sof_tick => sof_tick,
speed => speed,
frame_count => frame_count,
error_pulse => error_pulse,
usb_cmd_req => usb_cmd_req,
usb_cmd_resp => usb_cmd_resp,
usb_rx => usb_rx,
usb_tx_req => usb_tx_req,
usb_tx_resp => usb_tx_resp );
i_buf_ram: RAMB16BWE_S36_S9
port map (
CLKB => clock,
SSRB => reset,
ENB => buf_en,
WEB => buf_we,
ADDRB => std_logic_vector(buf_address),
DIB => buf_wdata,
DIPB => "0",
DOB => buf_rdata,
CLKA => sys_clock,
SSRA => sys_reset,
ENA => sys_buf_en,
WEA => sys_buf_we,
ADDRA => sys_buf_addr,
DIA => sys_buf_wdata,
DIPA => "0000",
DOA => sys_buf_rdata_le );
sys_buf_rdata <= byte_swap(sys_buf_rdata_le, g_big_endian);
i_bridge_to_mem_ctrl: entity work.bridge_to_mem_ctrl
port map (
ulpi_clock => clock,
ulpi_reset => reset,
nano_addr => nano_addr,
nano_write => nano_write,
nano_wdata => nano_wdata,
sys_clock => sys_clock,
sys_reset => sys_reset,
-- cmd interface
cmd_addr => cmd_addr,
cmd_valid => cmd_valid,
cmd_write => cmd_write,
cmd_wdata => cmd_wdata,
cmd_ack => cmd_ack );
i_memctrl: entity work.usb_memory_ctrl
generic map (
g_big_endian => g_big_endian,
g_tag => g_tag )
port map (
clock => sys_clock,
reset => sys_reset,
-- cmd interface
cmd_addr => cmd_addr,
cmd_valid => cmd_valid,
cmd_write => cmd_write,
cmd_wdata => cmd_wdata,
cmd_ack => cmd_ack,
cmd_ready => cmd_ready,
-- BRAM interface
ram_addr => sys_buf_addr,
ram_en => sys_buf_en,
ram_we => sys_buf_we,
ram_wdata => sys_buf_wdata,
ram_rdata => sys_buf_rdata,
-- memory interface
mem_req => sys_mem_req,
mem_resp => sys_mem_resp );
i_sync: entity work.level_synchronizer
port map (
clock => clock,
reset => reset,
input => cmd_ready,
input_c => mem_ctrl_ready );
i_nano_io: entity work.nano_minimal_io
generic map (
g_support_suspend => false )
port map (
clock => clock,
reset => reset,
io_addr => nano_addr,
io_write => nano_write,
io_read => nano_read,
io_wdata => nano_wdata,
io_rdata => nano_rdata,
stall => nano_stall,
reg_read => reg_read,
reg_write => reg_write,
reg_ack => reg_ack,
reg_address => reg_address,
reg_wdata => reg_wdata,
reg_rdata => reg_rdata,
cmd_response => nano_rdata_cmd,
status => status,
mem_ctrl_ready => mem_ctrl_ready,
frame_count => frame_count,
do_chirp => do_chirp,
chirp_data => chirp_data,
connected => open,
operational => open,
suspended => open,
sof_enable => sof_enable,
sof_tick => sof_tick,
speed => speed,
interrupt_out => interrupt );
i_sync2: entity work.pulse_synchronizer
port map (
clock_in => clock,
pulse_in => interrupt,
clock_out => sys_clock,
pulse_out => sys_irq );
i_cmd_io: entity work.usb_cmd_nano
port map (
clock => clock,
reset => reset,
io_addr => nano_addr,
io_write => nano_write,
io_wdata => nano_wdata,
io_rdata => nano_rdata_cmd,
cmd_req => usb_cmd_req,
cmd_resp => usb_cmd_resp );
i_debug: entity work.usb_debug
generic map (
g_enabled => g_incl_debug )
port map (
clock => clock,
reset => reset,
cmd_req => usb_cmd_req,
cmd_resp => usb_cmd_resp,
debug_data => debug_data,
debug_valid => debug_valid
);
i_nano: entity work.nano
generic map (
g_big_endian => g_big_endian )
port map (
clock => clock,
reset => reset,
io_addr => nano_addr,
io_write => nano_write,
io_read => nano_read,
io_wdata => nano_wdata,
io_rdata => nano_rdata,
stall => nano_stall,
sys_clock => sys_clock,
sys_reset => sys_reset,
sys_io_req => sys_io_req,
sys_io_resp => sys_io_resp );
end arch;
| gpl-3.0 | ae5a5e257a15179bc9dd829262c3797f | 0.483092 | 3.568966 | false | false | false | false |
markusC64/1541ultimate2 | fpga/6502n/vhdl_source/shifter.vhd | 1 | 2,336 |
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity shifter is
port (
operation : in std_logic_vector(2 downto 0);
bypass : in std_logic := '0';
c_in : in std_logic;
n_in : in std_logic;
z_in : in std_logic;
data_in : in std_logic_vector(7 downto 0);
c_out : out std_logic;
n_out : out std_logic;
z_out : out std_logic;
data_out : out std_logic_vector(7 downto 0) := X"00");
end shifter;
architecture gideon of shifter is
signal data_out_i : std_logic_vector(7 downto 0) := X"00";
signal zero : std_logic := '0';
constant c_asl : std_logic_vector(2 downto 0) := "000";
constant c_rol : std_logic_vector(2 downto 0) := "001";
constant c_lsr : std_logic_vector(2 downto 0) := "010";
constant c_ror : std_logic_vector(2 downto 0) := "011";
constant c_sta : std_logic_vector(2 downto 0) := "100";
constant c_lda : std_logic_vector(2 downto 0) := "101";
constant c_dec : std_logic_vector(2 downto 0) := "110";
constant c_inc : std_logic_vector(2 downto 0) := "111";
begin
-- ASL $nn ROL $nn LSR $nn ROR $nn STX $nn LDX $nn DEC $nn INC $nn
with operation select data_out_i <=
data_in(6 downto 0) & '0' when c_asl,
data_in(6 downto 0) & c_in when c_rol,
'0' & data_in(7 downto 1) when c_lsr,
c_in & data_in(7 downto 1) when c_ror,
std_logic_vector(unsigned(data_in) - 1) when c_dec,
std_logic_vector(unsigned(data_in) + 1) when c_inc,
data_in when others;
zero <= '1' when data_out_i = X"00" else '0';
with operation select c_out <=
data_in(7) when c_asl | c_rol,
data_in(0) when c_lsr | c_ror,
c_in when others;
with operation select z_out <=
zero when c_asl | c_rol | c_lsr | c_ror | c_lda | c_dec | c_inc,
z_in when others;
with operation select n_out <=
data_out_i(7) when c_asl | c_rol | c_lsr | c_ror | c_lda | c_dec | c_inc,
n_in when others;
data_out <= data_out_i when bypass = '0' else data_in;
end gideon;
| gpl-3.0 | b2539cd13382960d9a73cd21533df0e6 | 0.52012 | 3.045632 | false | false | false | false |
markusC64/1541ultimate2 | fpga/fpga_top/ultimate_fpga/vhdl_source/u2p_cia_lockstep.vhd | 1 | 30,306 | -------------------------------------------------------------------------------
-- Title : u2p_nios
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: Toplevel based on the "solo" nios; without Altera DDR2 ctrl.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.io_bus_pkg.all;
use work.mem_bus_pkg.all;
use work.my_math_pkg.all;
entity u2p_cia_lockstep is
port (
dummy : out std_logic;
-- slot side
SLOT_PHI2 : in std_logic;
SLOT_DOTCLK : in std_logic;
SLOT_RSTn : inout std_logic;
SLOT_BUFFER_ENn : out std_logic;
SLOT_ADDR : inout std_logic_vector(15 downto 0);
SLOT_DATA : inout std_logic_vector(7 downto 0);
SLOT_RWn : inout std_logic;
SLOT_BA : in std_logic;
SLOT_DMAn : out std_logic;
SLOT_EXROMn : inout std_logic;
SLOT_GAMEn : inout std_logic;
SLOT_ROMHn : in std_logic;
SLOT_ROMLn : in std_logic;
SLOT_IO1n : in std_logic;
SLOT_IO2n : in std_logic;
SLOT_IRQn : inout std_logic;
SLOT_NMIn : inout std_logic;
SLOT_VCC : in std_logic;
-- memory
SDRAM_A : out std_logic_vector(13 downto 0); -- DRAM A
SDRAM_BA : out std_logic_vector(2 downto 0) := (others => '0');
SDRAM_DQ : inout std_logic_vector(7 downto 0);
SDRAM_DM : inout std_logic;
SDRAM_CSn : out std_logic;
SDRAM_RASn : out std_logic;
SDRAM_CASn : out std_logic;
SDRAM_WEn : out std_logic;
SDRAM_CKE : out std_logic;
SDRAM_CLK : inout std_logic;
SDRAM_CLKn : inout std_logic;
SDRAM_ODT : out std_logic;
SDRAM_DQS : inout std_logic;
AUDIO_MCLK : out std_logic := '0';
AUDIO_BCLK : out std_logic := '0';
AUDIO_LRCLK : out std_logic := '0';
AUDIO_SDO : out std_logic := '0';
AUDIO_SDI : in std_logic;
-- IEC bus
IEC_ATN : inout std_logic;
IEC_DATA : inout std_logic;
IEC_CLOCK : inout std_logic;
IEC_RESET : in std_logic;
IEC_SRQ_IN : inout std_logic;
LED_DISKn : out std_logic; -- activity LED
LED_CARTn : out std_logic;
LED_SDACTn : out std_logic;
LED_MOTORn : out std_logic;
-- Ethernet RMII
ETH_RESETn : out std_logic := '1';
ETH_IRQn : in std_logic;
RMII_REFCLK : in std_logic;
RMII_CRS_DV : in std_logic;
RMII_RX_ER : in std_logic;
RMII_RX_DATA : in std_logic_vector(1 downto 0);
RMII_TX_DATA : out std_logic_vector(1 downto 0);
RMII_TX_EN : out std_logic;
MDIO_CLK : out std_logic := '0';
MDIO_DATA : inout std_logic := 'Z';
-- Speaker data
SPEAKER_DATA : out std_logic := '0';
SPEAKER_ENABLE : out std_logic := '0';
-- Debug UART
UART_TXD : out std_logic;
UART_RXD : in std_logic;
-- I2C Interface for RTC, audio codec and usb hub
I2C_SDA : inout std_logic := 'Z';
I2C_SCL : inout std_logic := 'Z';
I2C_SDA_18 : inout std_logic := 'Z';
I2C_SCL_18 : inout std_logic := 'Z';
-- Flash Interface
FLASH_CSn : out std_logic;
FLASH_SCK : out std_logic;
FLASH_MOSI : out std_logic;
FLASH_MISO : in std_logic;
FLASH_SEL : out std_logic := '0';
FLASH_SELCK : out std_logic := '0';
-- USB Interface (ULPI)
ULPI_RESET : out std_logic;
ULPI_CLOCK : in std_logic;
ULPI_NXT : in std_logic;
ULPI_STP : out std_logic;
ULPI_DIR : in std_logic;
ULPI_DATA : inout std_logic_vector(7 downto 0);
HUB_RESETn : out std_logic := '1';
HUB_CLOCK : out std_logic := '0';
-- Misc
BOARD_REVn : in std_logic_vector(4 downto 0);
-- Cassette Interface
CAS_MOTOR : in std_logic := '0';
CAS_SENSE : inout std_logic := 'Z';
CAS_READ : inout std_logic := 'Z';
CAS_WRITE : inout std_logic := 'Z';
-- Buttons
BUTTON : in std_logic_vector(2 downto 0));
end entity;
architecture rtl of u2p_cia_lockstep is
function or_reduce(a: std_logic_vector) return std_logic is
variable o : std_logic;
begin
o := '0';
for i in a'range loop
o := o or a(i);
end loop;
return o;
end function;
component nios_solo is
port (
clk_clk : in std_logic := 'X'; -- clk
io_ack : in std_logic := 'X'; -- ack
io_rdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- rdata
io_read : out std_logic; -- read
io_wdata : out std_logic_vector(7 downto 0); -- wdata
io_write : out std_logic; -- write
io_address : out std_logic_vector(19 downto 0); -- address
io_irq : in std_logic := 'X'; -- irq
io_u2p_ack : in std_logic := 'X'; -- ack
io_u2p_rdata : in std_logic_vector(7 downto 0) := (others => 'X'); -- rdata
io_u2p_read : out std_logic; -- read
io_u2p_wdata : out std_logic_vector(7 downto 0); -- wdata
io_u2p_write : out std_logic; -- write
io_u2p_address : out std_logic_vector(19 downto 0); -- address
io_u2p_irq : in std_logic := 'X'; -- irq
mem_mem_req_address : out std_logic_vector(25 downto 0); -- mem_req_address
mem_mem_req_byte_en : out std_logic_vector(3 downto 0); -- mem_req_byte_en
mem_mem_req_read_writen : out std_logic; -- mem_req_read_writen
mem_mem_req_request : out std_logic; -- mem_req_request
mem_mem_req_tag : out std_logic_vector(7 downto 0); -- mem_req_tag
mem_mem_req_wdata : out std_logic_vector(31 downto 0); -- mem_req_wdata
mem_mem_resp_dack_tag : in std_logic_vector(7 downto 0) := (others => 'X'); -- mem_resp_dack_tag
mem_mem_resp_data : in std_logic_vector(31 downto 0) := (others => 'X'); -- mem_resp_data
mem_mem_resp_rack_tag : in std_logic_vector(7 downto 0) := (others => 'X'); -- mem_resp_rack_tag
reset_reset_n : in std_logic := 'X' -- reset_n
);
end component nios_solo;
component pll
PORT
(
inclk0 : IN STD_LOGIC := '0';
c0 : OUT STD_LOGIC ;
c1 : OUT STD_LOGIC ;
locked : OUT STD_LOGIC
);
end component;
signal por_n : std_logic;
signal ref_reset : std_logic;
signal por_count : unsigned(15 downto 0) := (others => '0');
signal led_n : std_logic_vector(0 to 3);
signal RSTn_out : std_logic;
signal irq_oc, nmi_oc, rst_oc, dma_oc, exrom_oc, game_oc : std_logic;
signal slot_addr_o : std_logic_vector(15 downto 0);
signal slot_addr_t : std_logic;
signal slot_data_o : std_logic_vector(7 downto 0);
signal slot_data_t : std_logic;
signal slot_rwn_o : std_logic;
signal sys_clock : std_logic;
signal sys_reset : std_logic;
signal audio_clock : std_logic;
signal audio_reset : std_logic;
signal eth_reset : std_logic;
signal ulpi_reset_req : std_logic;
signal button_i : std_logic_vector(2 downto 0);
signal buffer_en : std_logic;
-- miscellaneous interconnect
signal ulpi_reset_i : std_logic;
-- memory controller interconnect
signal memctrl_inhibit : std_logic;
signal is_idle : std_logic;
signal cpu_mem_req : t_mem_req_32;
signal cpu_mem_resp : t_mem_resp_32;
signal mem_req : t_mem_req_32;
signal mem_resp : t_mem_resp_32;
signal uart_txd_from_logic : std_logic;
signal i2c_sda_i : std_logic;
signal i2c_sda_o : std_logic;
signal i2c_scl_i : std_logic;
signal i2c_scl_o : std_logic;
signal mdio_o : std_logic;
-- IEC open drain
signal iec_atn_o : std_logic;
signal iec_data_o : std_logic;
signal iec_clock_o : std_logic;
signal iec_srq_o : std_logic;
signal sw_iec_o : std_logic_vector(3 downto 0);
signal sw_iec_i : std_logic_vector(3 downto 0);
-- io buses
signal io_irq : std_logic;
signal io_req : t_io_req;
signal io_resp : t_io_resp;
signal io_u2p_req : t_io_req;
signal io_u2p_resp : t_io_resp;
signal io_req_new_io : t_io_req;
signal io_resp_new_io : t_io_resp;
signal io_req_remote : t_io_req;
signal io_resp_remote : t_io_resp;
signal io_req_ddr2 : t_io_req;
signal io_resp_ddr2 : t_io_resp;
-- audio
signal audio_speaker : signed(12 downto 0);
signal audio_left : signed(18 downto 0);
signal audio_right : signed(18 downto 0);
signal speaker_vol : std_logic_vector(3 downto 0);
begin
process(RMII_REFCLK)
begin
if rising_edge(RMII_REFCLK) then
if por_count = X"FFFF" then
por_n <= '1';
else
por_n <= '0';
por_count <= por_count + 1;
end if;
end if;
end process;
ref_reset <= not por_n;
i_pll: pll port map (
inclk0 => RMII_REFCLK, -- 50 MHz
c0 => HUB_CLOCK, -- 24 MHz
c1 => audio_clock, -- 12.245 MHz (47.831 kHz sample rate)
locked => open );
i_audio_reset: entity work.level_synchronizer
generic map ('1')
port map (
clock => audio_clock,
input => sys_reset,
input_c => audio_reset );
i_ulpi_reset: entity work.level_synchronizer
generic map ('1')
port map (
clock => ulpi_clock,
input => ulpi_reset_req,
input_c => ulpi_reset_i );
i_eth_reset: entity work.level_synchronizer
generic map ('1')
port map (
clock => RMII_REFCLK,
input => sys_reset,
input_c => eth_reset );
i_nios: nios_solo
port map (
clk_clk => sys_clock,
reset_reset_n => not sys_reset,
io_ack => io_resp.ack,
io_rdata => io_resp.data,
io_read => io_req.read,
io_wdata => io_req.data,
io_write => io_req.write,
unsigned(io_address) => io_req.address,
io_irq => io_irq,
io_u2p_ack => io_u2p_resp.ack,
io_u2p_rdata => io_u2p_resp.data,
io_u2p_read => io_u2p_req.read,
io_u2p_wdata => io_u2p_req.data,
io_u2p_write => io_u2p_req.write,
unsigned(io_u2p_address) => io_u2p_req.address,
io_u2p_irq => '0',
unsigned(mem_mem_req_address) => cpu_mem_req.address,
mem_mem_req_byte_en => cpu_mem_req.byte_en,
mem_mem_req_read_writen => cpu_mem_req.read_writen,
mem_mem_req_request => cpu_mem_req.request,
mem_mem_req_tag => cpu_mem_req.tag,
mem_mem_req_wdata => cpu_mem_req.data,
mem_mem_resp_dack_tag => cpu_mem_resp.dack_tag,
mem_mem_resp_data => cpu_mem_resp.data,
mem_mem_resp_rack_tag => cpu_mem_resp.rack_tag
);
i_split: entity work.io_bus_splitter
generic map (
g_range_lo => 8,
g_range_hi => 9,
g_ports => 3
)
port map (
clock => sys_clock,
req => io_u2p_req,
resp => io_u2p_resp,
reqs(0) => io_req_new_io,
reqs(1) => io_req_ddr2,
reqs(2) => io_req_remote,
resps(0) => io_resp_new_io,
resps(1) => io_resp_ddr2,
resps(2) => io_resp_remote
);
i_memphy: entity work.ddr2_ctrl
port map (
ref_clock => RMII_REFCLK,
ref_reset => ref_reset,
sys_clock_o => sys_clock,
sys_reset_o => sys_reset,
clock => sys_clock,
reset => sys_reset,
io_req => io_req_ddr2,
io_resp => io_resp_ddr2,
inhibit => memctrl_inhibit,
is_idle => is_idle,
req => mem_req,
resp => mem_resp,
SDRAM_CLK => SDRAM_CLK,
SDRAM_CLKn => SDRAM_CLKn,
SDRAM_CKE => SDRAM_CKE,
SDRAM_ODT => SDRAM_ODT,
SDRAM_CSn => SDRAM_CSn,
SDRAM_RASn => SDRAM_RASn,
SDRAM_CASn => SDRAM_CASn,
SDRAM_WEn => SDRAM_WEn,
SDRAM_A => SDRAM_A,
SDRAM_BA => SDRAM_BA(1 downto 0),
SDRAM_DM => SDRAM_DM,
SDRAM_DQ => SDRAM_DQ,
SDRAM_DQS => SDRAM_DQS
);
i_remote: entity work.update_io
port map (
clock => sys_clock,
reset => sys_reset,
slow_clock => audio_clock,
slow_reset => audio_reset,
io_req => io_req_remote,
io_resp => io_resp_remote,
flash_selck => FLASH_SELCK,
flash_sel => FLASH_SEL
);
i_u2p_io: entity work.u2p_io
port map (
clock => sys_clock,
reset => sys_reset,
io_req => io_req_new_io,
io_resp => io_resp_new_io,
mdc => MDIO_CLK,
mdio_i => MDIO_DATA,
mdio_o => mdio_o,
i2c_scl_i => i2c_scl_i,
i2c_scl_o => i2c_scl_o,
i2c_sda_i => i2c_sda_i,
i2c_sda_o => i2c_sda_o,
iec_i => sw_iec_i,
iec_o => sw_iec_o,
board_rev => not BOARD_REVn,
eth_irq_i => ETH_IRQn,
speaker_en => SPEAKER_ENABLE,
speaker_vol=> speaker_vol,
hub_reset_n=> HUB_RESETn,
ulpi_reset => ulpi_reset_req,
buffer_en => buffer_en
);
i2c_scl_i <= I2C_SCL and I2C_SCL_18;
i2c_sda_i <= I2C_SDA and I2C_SDA_18;
I2C_SCL <= '0' when i2c_scl_o = '0' else 'Z';
I2C_SDA <= '0' when i2c_sda_o = '0' else 'Z';
I2C_SCL_18 <= '0' when i2c_scl_o = '0' else 'Z';
I2C_SDA_18 <= '0' when i2c_sda_o = '0' else 'Z';
MDIO_DATA <= '0' when mdio_o = '0' else 'Z';
i_logic: entity work.ultimate_logic_32
generic map (
g_version => X"0D",
g_simulation => false,
g_ultimate2plus => true,
g_clock_freq => 62_500_000,
g_baud_rate => 115_200,
g_timer_rate => 200_000,
g_microblaze => false,
g_big_endian => false,
g_icap => false,
g_uart => true,
g_drive_1541 => true,
g_drive_1541_2 => false,
g_hardware_gcr => true,
g_ram_expansion => true,
g_extended_reu => false,
g_stereo_sid => false,
g_hardware_iec => true,
g_c2n_streamer => false,
g_c2n_recorder => false,
g_cartridge => true,
g_command_intf => true,
g_drive_sound => true,
g_rtc_chip => false,
g_rtc_timer => false,
g_usb_host => false,
g_usb_host2 => true,
g_spi_flash => true,
g_vic_copper => false,
g_video_overlay => false,
g_sampler => false,
g_analyzer => true,
g_profiler => false,
g_rmii => true )
port map (
-- globals
sys_clock => sys_clock,
sys_reset => sys_reset,
ulpi_clock => ulpi_clock,
ulpi_reset => ulpi_reset_i,
ext_io_req => io_req,
ext_io_resp => io_resp,
ext_mem_req => cpu_mem_req,
ext_mem_resp=> cpu_mem_resp,
cpu_irq => io_irq,
-- slot side
BUFFER_ENn => open,
VCC => SLOT_VCC,
phi2_i => SLOT_PHI2,
dotclk_i => SLOT_DOTCLK,
rstn_i => SLOT_RSTn,
rstn_o => RSTn_out,
slot_addr_o => slot_addr_o,
slot_addr_i => SLOT_ADDR,
slot_addr_t => slot_addr_t,
slot_data_o => slot_data_o,
slot_data_i => SLOT_DATA,
slot_data_t => slot_data_t,
rwn_i => SLOT_RWn,
rwn_o => slot_rwn_o,
exromn_i => SLOT_EXROMn,
exromn_o => exrom_oc,
gamen_i => SLOT_GAMEn,
gamen_o => game_oc,
irqn_i => SLOT_IRQn,
irqn_o => irq_oc,
nmin_i => SLOT_NMIn,
nmin_o => nmi_oc,
ba_i => SLOT_BA,
dman_o => dma_oc,
romhn_i => SLOT_ROMHn,
romln_i => SLOT_ROMLn,
io1n_i => SLOT_IO1n,
io2n_i => SLOT_IO2n,
-- local bus side
mem_inhibit => memctrl_inhibit,
mem_req => mem_req,
mem_resp => mem_resp,
-- Audio outputs
audio_speaker => audio_speaker,
audio_left => audio_left,
audio_right => audio_right,
speaker_vol => speaker_vol,
-- IEC bus
iec_reset_i => IEC_RESET,
iec_atn_i => IEC_ATN,
iec_data_i => IEC_DATA,
iec_clock_i => IEC_CLOCK,
iec_srq_i => IEC_SRQ_IN,
iec_reset_o => open,
iec_atn_o => iec_atn_o,
iec_data_o => iec_data_o,
iec_clock_o => iec_clock_o,
iec_srq_o => iec_srq_o,
MOTOR_LEDn => led_n(0),
DISK_ACTn => led_n(1),
CART_LEDn => led_n(2),
SDACT_LEDn => led_n(3),
-- Debug UART
UART_TXD => uart_txd_from_logic,
UART_RXD => UART_RXD,
-- SD Card Interface
SD_SSn => open,
SD_CLK => open,
SD_MOSI => open,
SD_MISO => '1',
SD_CARDDETn => '1',
SD_DATA => open,
-- RTC Interface
RTC_CS => open,
RTC_SCK => open,
RTC_MOSI => open,
RTC_MISO => '1',
-- Flash Interface
FLASH_CSn => FLASH_CSn,
FLASH_SCK => FLASH_SCK,
FLASH_MOSI => FLASH_MOSI,
FLASH_MISO => FLASH_MISO,
-- USB Interface (ULPI)
ULPI_NXT => ULPI_NXT,
ULPI_STP => ULPI_STP,
ULPI_DIR => ULPI_DIR,
ULPI_DATA => ULPI_DATA,
-- Cassette Interface
CAS_MOTOR => CAS_MOTOR,
CAS_SENSE => CAS_SENSE,
CAS_READ => CAS_READ,
CAS_WRITE => CAS_WRITE,
-- Ethernet Interface (RMII)
eth_clock => RMII_REFCLK,
eth_reset => eth_reset,
rmii_crs_dv => RMII_CRS_DV,
rmii_rxd => RMII_RX_DATA,
rmii_tx_en => RMII_TX_EN,
rmii_txd => RMII_TX_DATA,
-- Buttons
BUTTON => button_i );
SLOT_RSTn <= '0' when RSTn_out = '0' else 'Z';
SLOT_ADDR <= slot_addr_o when slot_addr_t = '1' else (others => 'Z');
SLOT_DATA <= slot_data_o when slot_data_t = '1' else (others => 'Z');
SLOT_RWn <= slot_rwn_o when slot_addr_t = '1' else 'Z';
irq_push: entity work.oc_pusher port map(clock => sys_clock, sig_in => irq_oc, oc_out => SLOT_IRQn);
nmi_push: entity work.oc_pusher port map(clock => sys_clock, sig_in => nmi_oc, oc_out => SLOT_NMIn);
dma_push: entity work.oc_pusher port map(clock => sys_clock, sig_in => dma_oc, oc_out => SLOT_DMAn);
exr_push: entity work.oc_pusher port map(clock => sys_clock, sig_in => exrom_oc, oc_out => SLOT_EXROMn);
gam_push: entity work.oc_pusher port map(clock => sys_clock, sig_in => game_oc, oc_out => SLOT_GAMEn);
LED_MOTORn <= led_n(0) xor sys_reset;
LED_DISKn <= led_n(1) xor sys_reset;
LED_CARTn <= led_n(2) xor sys_reset;
LED_SDACTn <= led_n(3) xor sys_reset;
IEC_SRQ_IN <= '0' when iec_srq_o = '0' or sw_iec_o(3) = '0' else 'Z';
IEC_ATN <= '0' when iec_atn_o = '0' or sw_iec_o(2) = '0' else 'Z';
IEC_DATA <= '0' when iec_data_o = '0' or sw_iec_o(1) = '0' else 'Z';
IEC_CLOCK <= '0' when iec_clock_o = '0' or sw_iec_o(0) = '0' else 'Z';
sw_iec_i <= IEC_SRQ_IN & IEC_ATN & IEC_DATA & IEC_CLOCK;
button_i <= not BUTTON;
ULPI_RESET <= por_n;
UART_TXD <= uart_txd_from_logic; -- and uart_txd_from_qsys;
i_pwm0: entity work.sigma_delta_dac --delta_sigma_2to5
generic map (
g_left_shift => 2,
g_divider => 10,
g_width => audio_speaker'length )
port map (
clock => sys_clock,
reset => sys_reset,
dac_in => audio_speaker,
dac_out => SPEAKER_DATA );
b_audio: block
signal audio_get_sample : std_logic;
signal sys_get_sample : std_logic;
signal stream_out_data : std_logic_vector(23 downto 0);
signal stream_out_tag : std_logic_vector(0 downto 0);
signal stream_out_valid : std_logic;
signal stream_in_data : std_logic_vector(23 downto 0);
signal stream_in_tag : std_logic_vector(0 downto 0);
signal stream_in_ready : std_logic;
signal audio_left_filt : signed(17 downto 0);
signal audio_right_filt : signed(17 downto 0);
signal audio_audio_left : std_logic_vector(audio_left_filt'range);
signal audio_audio_right: std_logic_vector(audio_right_filt'range);
begin
i_filt_left: entity work.lp_filter
port map (
clock => sys_clock,
reset => sys_reset,
signal_in => audio_left(18 downto 1),
low_pass => audio_left_filt );
i_filt_right: entity work.lp_filter
port map (
clock => sys_clock,
reset => sys_reset,
signal_in => audio_right(18 downto 1),
low_pass => audio_right_filt );
i2s: entity work.i2s_serializer
port map (
clock => audio_clock,
reset => audio_reset,
i2s_out => AUDIO_SDO,
i2s_in => AUDIO_SDI,
i2s_bclk => AUDIO_BCLK,
i2s_fs => AUDIO_LRCLK,
stream_out_data => stream_out_data,
stream_out_tag => stream_out_tag,
stream_out_valid => stream_out_valid,
stream_in_data => stream_in_data,
stream_in_tag => stream_in_tag,
stream_in_valid => '1',
stream_in_ready => stream_in_ready );
AUDIO_MCLK <= audio_clock;
i_sync_get: entity work.pulse_synchronizer
port map (
clock_in => audio_clock,
pulse_in => audio_get_sample,
clock_out => sys_clock,
pulse_out => sys_get_sample
);
i_sync_left: entity work.synchronizer_gzw
generic map (
g_width => audio_left_filt'length,
g_fast => false
)
port map(
tx_clock => sys_clock,
tx_push => sys_get_sample,
tx_data => std_logic_vector(audio_left_filt),
tx_done => open,
rx_clock => audio_clock,
rx_new_data => open,
rx_data => audio_audio_left
);
i_sync_right: entity work.synchronizer_gzw
generic map (
g_width => audio_right_filt'length,
g_fast => false
)
port map(
tx_clock => sys_clock,
tx_push => sys_get_sample,
tx_data => std_logic_vector(audio_right_filt),
tx_done => open,
rx_clock => audio_clock,
rx_new_data => open,
rx_data => audio_audio_right
);
process(audio_clock)
begin
if rising_edge(audio_clock) then
audio_get_sample <= '0';
if stream_in_ready = '1' then
if stream_in_tag(0) = '0' then
stream_in_tag(0) <= '1';
stream_in_data <= std_logic_vector(left_scale(signed(audio_audio_right), 1)) & "0000000";
audio_get_sample <= '1';
else
stream_in_tag(0) <= '0';
stream_in_data <= std_logic_vector(left_scale(signed(audio_audio_left), 1)) & "0000000";
end if;
end if;
if audio_reset = '1' then
stream_in_tag(0) <= '1';
end if;
end if;
end process;
end block;
SLOT_BUFFER_ENn <= not buffer_en;
b_cia: block
signal cia2_port_a_i : std_logic_vector(7 downto 0) := X"FF";
signal cia2_port_a_o : std_logic_vector(7 downto 0) := X"FF";
signal cia2_port_a_t : std_logic_vector(7 downto 0) := X"FF";
signal cia2_port_b_i : std_logic_vector(7 downto 0) := X"FF";
signal cia2_port_b_o : std_logic_vector(7 downto 0) := X"FF";
signal cia2_port_b_t : std_logic_vector(7 downto 0) := X"FF";
signal cia2_sp_i : std_logic := '1';
signal cia2_sp_o : std_logic := '1';
signal cia2_sp_t : std_logic := '1';
signal cia2_cnt_i : std_logic := '1';
signal cia2_cnt_o : std_logic := '1';
signal cia2_cnt_t : std_logic := '1';
signal cia2_pc_o : std_logic := '1';
signal cia2_flag_i : std_logic := '1';
signal cia2_irq : std_logic;
signal cia2_clock : std_logic;
signal cia2_reset : std_logic;
signal cia2_read : std_logic;
signal cia2_write : std_logic;
signal cia2_rdata : std_logic_vector(7 downto 0);
signal bus_data_latch : std_logic_vector(7 downto 0);
signal read_d : std_logic;
signal read_error : std_logic;
signal nmi_error : std_logic;
begin
cia2_write <= '1' when SLOT_RWn = '0' and SLOT_ADDR(15 downto 8) = X"DD" and SLOT_PHI2 = '1' else '0';
cia2_read <= '1' when SLOT_RWn = '1' and SLOT_ADDR(15 downto 8) = X"DD" and SLOT_PHI2 = '1' else '0';
cia2_clock <= not SLOT_PHI2;
process(cia2_clock)
begin
if rising_edge(cia2_clock) then
cia2_reset <= not SLOT_RSTn;
bus_data_latch <= SLOT_DATA;
read_d <= cia2_read;
end if;
end process;
process(SLOT_PHI2)
begin
if rising_edge(SLOT_PHI2) then
if cia2_rdata /= bus_data_latch and read_d = '1' then
read_error <= '1';
else
read_error <= '0';
end if;
end if;
end process;
nmi_error <= cia2_irq xnor SLOT_NMIn;
dummy <= or_reduce(nmi_error & read_error & cia2_rdata);
i_cia2: entity work.cia_registers
generic map (
g_unit_name => "CIA_2" )
port map (
clock => cia2_clock,
rising => '0',
falling => '1',
reset => cia2_reset,
addr => unsigned(SLOT_ADDR(3 downto 0)),
wen => cia2_write,
ren => cia2_read,
data_out => cia2_rdata,
data_in => SLOT_DATA,
-- pio --
port_a_o => cia2_port_a_o,
port_a_t => cia2_port_a_t,
port_a_i => cia2_port_a_i,
port_b_o => cia2_port_b_o,
port_b_t => cia2_port_b_t,
port_b_i => cia2_port_b_i,
-- serial pin
sp_o => cia2_sp_o,
sp_i => cia2_sp_i,
sp_t => cia2_sp_t,
cnt_i => cia2_cnt_i,
cnt_o => cia2_cnt_o,
cnt_t => cia2_cnt_t,
tod_pin => '0',
pc_o => cia2_pc_o,
flag_i => cia2_flag_i,
irq => cia2_irq );
cia2_port_a_i(7) <= (cia2_port_a_o(7) or not cia2_port_a_t(7)) and IEC_DATA;
cia2_port_a_i(6) <= (cia2_port_a_o(6) or not cia2_port_a_t(6)) and IEC_CLOCK;
cia2_port_a_i(5) <= (cia2_port_a_o(5) or not cia2_port_a_t(5));
cia2_port_a_i(4) <= (cia2_port_a_o(4) or not cia2_port_a_t(4));
cia2_port_a_i(3) <= (cia2_port_a_o(3) or not cia2_port_a_t(3));
cia2_port_a_i(2) <= (cia2_port_a_o(2) or not cia2_port_a_t(2));
cia2_port_a_i(1) <= (cia2_port_a_o(1) or not cia2_port_a_t(1));
cia2_port_a_i(0) <= (cia2_port_a_o(0) or not cia2_port_a_t(0));
cia2_port_b_i <= cia2_port_b_o or not cia2_port_b_t;
cia2_cnt_i <= cia2_cnt_o or not cia2_cnt_t;
cia2_sp_i <= cia2_sp_o or not cia2_sp_t;
end block;
end architecture;
| gpl-3.0 | 05d7abe1b1ae00efb2d4df90410ff4f6 | 0.467498 | 3.290911 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/audio/i2s_serializer.vhd | 1 | 2,654 | -------------------------------------------------------------------------------
-- Title : i2s_serializer
-- Author : Gideon Zweijtzer <[email protected]>
-------------------------------------------------------------------------------
-- Description: I2S Serializer / Deserializer
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity i2s_serializer is
port (
clock : in std_logic; -- equals i2s_mclk
reset : in std_logic;
i2s_out : out std_logic;
i2s_in : in std_logic;
i2s_bclk : out std_logic;
i2s_fs : out std_logic;
sample_pulse : out std_logic;
left_sample_out : out std_logic_vector(23 downto 0);
right_sample_out : out std_logic_vector(23 downto 0);
left_sample_in : in std_logic_vector(23 downto 0);
right_sample_in : in std_logic_vector(23 downto 0) );
end entity;
architecture rtl of i2s_serializer is
signal bit_count : unsigned(7 downto 0);
signal shift_reg : std_logic_vector(31 downto 0) := (others => '0');
begin
-- mclk = 256*fs. bclk = 64*fs (32 bits per channel)
process(clock)
begin
if rising_edge(clock) then
bit_count <= bit_count + 1;
i2s_bclk <= bit_count(1);
i2s_fs <= bit_count(7);
sample_pulse <= '0';
if bit_count(1 downto 0) = "00" then
i2s_out <= shift_reg(shift_reg'left);
elsif bit_count(1 downto 0) = "10" then
shift_reg <= shift_reg(shift_reg'left-1 downto 0) & i2s_in;
end if;
case bit_count is
when X"7E" =>
left_sample_out <= shift_reg(shift_reg'left-2 downto shift_reg'left - 25);
when X"FE" =>
right_sample_out <= shift_reg(shift_reg'left-2 downto shift_reg'left - 25);
sample_pulse <= '1';
when X"02" =>
shift_reg <= left_sample_in & "0000000" & i2s_in;
when X"82" =>
shift_reg <= right_sample_in & "0000000" & i2s_in;
when others =>
null;
end case;
if reset='1' then
bit_count <= (others => '1');
i2s_out <= '0';
left_sample_out <= (others => '0');
right_sample_out <= (others => '0');
end if;
end if;
end process;
end architecture;
| gpl-3.0 | 1851caed1e8549260c4f12fceadd4597 | 0.44951 | 3.868805 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_source/cpu_part_1541.vhd | 1 | 14,652 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.mem_bus_pkg.all;
entity cpu_part_1541 is
generic (
g_tag : std_logic_vector(7 downto 0) := X"02";
g_ram_base : unsigned(27 downto 0) := X"0060000" );
port (
clock : in std_logic;
falling : in std_logic;
rising : in std_logic;
reset : in std_logic;
-- serial bus pins
atn_o : out std_logic; -- open drain
atn_i : in std_logic;
clk_o : out std_logic; -- open drain
clk_i : in std_logic;
data_o : out std_logic; -- open drain
data_i : in std_logic;
-- memory interface
mem_req : out t_mem_req;
mem_resp : in t_mem_resp;
mem_busy : out std_logic;
-- Debug port
debug_data : out std_logic_vector(31 downto 0);
debug_valid : out std_logic;
-- configuration
bank_is_ram : in std_logic_vector(7 downto 1);
-- Parallel cable pins
via1_port_a_o : out std_logic_vector(7 downto 0);
via1_port_a_i : in std_logic_vector(7 downto 0);
via1_port_a_t : out std_logic_vector(7 downto 0);
via1_ca2_o : out std_logic;
via1_ca2_i : in std_logic;
via1_ca2_t : out std_logic;
via1_cb1_o : out std_logic;
via1_cb1_i : in std_logic;
via1_cb1_t : out std_logic;
-- drive pins
power : in std_logic;
drive_address : in std_logic_vector(1 downto 0);
motor_on : out std_logic;
mode : out std_logic;
write_prot_n : in std_logic;
step : out std_logic_vector(1 downto 0);
rate_ctrl : out std_logic_vector(1 downto 0);
byte_ready : in std_logic;
sync : in std_logic;
drv_rdata : in std_logic_vector(7 downto 0);
drv_wdata : out std_logic_vector(7 downto 0);
act_led : out std_logic );
end cpu_part_1541;
architecture structural of cpu_part_1541 is
signal soe : std_logic;
signal so_n : std_logic;
signal bank_is_ram_i : std_logic_vector(7 downto 0);
signal cpu_write : std_logic;
signal cpu_wdata : std_logic_vector(7 downto 0);
signal cpu_rdata : std_logic_vector(7 downto 0);
signal cpu_addr : std_logic_vector(16 downto 0);
signal cpu_irqn : std_logic;
signal ext_rdata : std_logic_vector(7 downto 0) := X"00";
signal io_rdata : std_logic_vector(7 downto 0);
signal via1_data : std_logic_vector(7 downto 0);
signal via2_data : std_logic_vector(7 downto 0);
signal via1_wen : std_logic;
signal via1_ren : std_logic;
signal via2_wen : std_logic;
signal via2_ren : std_logic;
signal via1_port_b_o : std_logic_vector(7 downto 0);
signal via1_port_b_t : std_logic_vector(7 downto 0);
signal via1_port_b_i : std_logic_vector(7 downto 0);
signal via1_ca1 : std_logic;
signal via1_cb2_o : std_logic;
signal via1_cb2_i : std_logic;
signal via1_cb2_t : std_logic;
signal via1_irq : std_logic;
signal via2_port_b_o : std_logic_vector(7 downto 0);
signal via2_port_b_t : std_logic_vector(7 downto 0);
signal via2_port_b_i : std_logic_vector(7 downto 0);
signal via2_ca2_o : std_logic;
signal via2_ca2_i : std_logic;
signal via2_ca2_t : std_logic;
signal via2_cb1_o : std_logic;
signal via2_cb1_i : std_logic;
signal via2_cb1_t : std_logic;
signal via2_cb2_o : std_logic;
signal via2_cb2_i : std_logic;
signal via2_cb2_t : std_logic;
signal via2_irq : std_logic;
signal io_select : std_logic;
signal cpu_clk_en : std_logic;
signal cpu_rising : std_logic;
type t_mem_state is (idle, newcycle, extcycle);
signal mem_state : t_mem_state;
-- "old" style signals
signal mem_request : std_logic;
signal mem_addr : unsigned(25 downto 0);
signal mem_rwn : std_logic;
signal mem_rack : std_logic;
signal mem_dack : std_logic;
signal mem_wdata : std_logic_vector(7 downto 0);
begin
mem_req.request <= mem_request;
mem_req.address <= mem_addr;
mem_req.read_writen <= mem_rwn;
mem_req.data <= mem_wdata;
mem_req.tag <= g_tag;
mem_req.size <= "00"; -- 1 byte at a time
mem_rack <= '1' when mem_resp.rack_tag = g_tag else '0';
mem_dack <= '1' when mem_resp.dack_tag = g_tag else '0';
cpu: entity work.cpu6502(cycle_exact)
port map (
cpu_clk => clock,
cpu_clk_en => cpu_clk_en,
cpu_reset => reset,
cpu_write => cpu_write,
cpu_wdata => cpu_wdata,
cpu_rdata => cpu_rdata,
cpu_addr => cpu_addr,
--cpu_pc => cpu_pc,
IRQn => cpu_irqn, -- IRQ interrupt (level sensitive)
NMIn => '1',
SOn => so_n );
-- Generate an output stream to debug internal operation of 1541 CPU
process(clock)
begin
if rising_edge(clock) then
debug_valid <= '0';
if cpu_clk_en = '1' then
debug_data <= '0' & atn_i & data_i & clk_i & sync & so_n & cpu_irqn & not cpu_write & cpu_rdata & cpu_addr(15 downto 0);
debug_valid <= '1';
if cpu_write = '1' then
debug_data(23 downto 16) <= cpu_wdata;
end if;
end if;
end if;
end process;
via1: entity work.via6522
port map (
clock => clock,
falling => cpu_clk_en,
rising => cpu_rising,
reset => reset,
addr => cpu_addr(3 downto 0),
wen => via1_wen,
ren => via1_ren,
data_in => cpu_wdata,
data_out => via1_data,
-- pio --
port_a_o => via1_port_a_o,
port_a_t => via1_port_a_t,
port_a_i => via1_port_a_i,
port_b_o => via1_port_b_o,
port_b_t => via1_port_b_t,
port_b_i => via1_port_b_i,
-- handshake pins
ca1_i => via1_ca1,
ca2_o => via1_ca2_o,
ca2_i => via1_ca2_i,
ca2_t => via1_ca2_t,
cb1_o => via1_cb1_o,
cb1_i => via1_cb1_i,
cb1_t => via1_cb1_t,
cb2_o => via1_cb2_o,
cb2_i => via1_cb2_i,
cb2_t => via1_cb2_t,
irq => via1_irq );
via2: entity work.via6522
port map (
clock => clock,
falling => cpu_clk_en,
rising => cpu_rising,
reset => reset,
addr => cpu_addr(3 downto 0),
wen => via2_wen,
ren => via2_ren,
data_in => cpu_wdata,
data_out => via2_data,
-- pio --
port_a_o => drv_wdata,
port_a_t => open,
port_a_i => drv_rdata,
port_b_o => via2_port_b_o,
port_b_t => via2_port_b_t,
port_b_i => via2_port_b_i,
-- handshake pins
ca1_i => so_n,
ca2_o => via2_ca2_o,
ca2_i => via2_ca2_i,
ca2_t => via2_ca2_t,
cb1_o => via2_cb1_o,
cb1_i => via2_cb1_i,
cb1_t => via2_cb1_t,
cb2_o => via2_cb2_o,
cb2_i => via2_cb2_i,
cb2_t => via2_cb2_t,
irq => via2_irq );
cpu_irqn <= not(via1_irq or via2_irq);
cpu_clk_en <= falling;
cpu_rising <= rising;
mem_busy <= '0' when mem_state = idle else '1';
bank_is_ram_i <= bank_is_ram & '0';
-- Fetch ROM byte
process(clock)
begin
if rising_edge(clock) then
mem_addr(25 downto 16) <= g_ram_base(25 downto 16);
case mem_state is
when idle =>
if cpu_clk_en = '1' then
mem_state <= newcycle;
end if;
when newcycle => -- we have a new address now
mem_addr(15 downto 0) <= unsigned(cpu_addr(15 downto 0));
io_select <= '0'; -- not active
-- Start by checking whether it is an extended RAM block
if bank_is_ram_i(to_integer(unsigned(cpu_addr(15 downto 13))))='1' then
mem_request <= '1';
mem_state <= extcycle;
elsif cpu_addr(15) = '1' then -- ROM Area, which is not overridden as RAM
if cpu_write = '0' then
mem_request <= '1';
mem_state <= extcycle;
else -- writing to rom -> ignore
mem_state <= idle;
end if;
-- It's not extended RAM, not ROM, so it must be internal RAM or I/O.
elsif cpu_addr(12 downto 11) = "00" then -- Internal RAM
mem_addr(14 downto 13) <= "00"; -- force mirroring for 2000-27FF, 4000-47FF and 6000-67FF.
mem_request <= '1';
mem_state <= extcycle;
else
io_select <= '1';
mem_state <= idle;
end if;
when extcycle =>
if mem_rack='1' then
mem_request <= '0';
if cpu_write='1' then
mem_state <= idle;
end if;
end if;
if mem_dack='1' and cpu_write='0' then -- only for reads
ext_rdata <= mem_resp.data;
mem_state <= idle;
end if;
when others =>
null;
end case;
if reset='1' then
io_select <= '0';
mem_request <= '0';
mem_state <= idle;
end if;
end if;
end process;
mem_rwn <= not cpu_write;
mem_wdata <= cpu_wdata;
-- address decoding and data muxing
with cpu_addr(12 downto 10) select io_rdata <=
via1_data when "110",
via2_data when "111",
X"FF" when others;
cpu_rdata <= io_rdata when io_select='1' else ext_rdata;
via1_wen <= '1' when cpu_write='1' and io_select='1' and cpu_addr(12 downto 10)="110" else '0';
via1_ren <= '1' when cpu_write='0' and io_select='1' and cpu_addr(12 downto 10)="110" else '0';
via2_wen <= '1' when cpu_write='1' and io_select='1' and cpu_addr(12 downto 10)="111" else '0';
via2_ren <= '1' when cpu_write='0' and io_select='1' and cpu_addr(12 downto 10)="111" else '0';
-- correctly attach the VIA pins to the outside world
via1_ca1 <= not atn_i;
via1_cb2_i <= via1_cb2_o or not via1_cb2_t;
-- Because Port B reads its own output when set to output, we do not need to consider the direction here
via1_port_b_i(7) <= not atn_i;
-- the following bits should read 0 when the jumper is closed (drive select = 0) or when driven low by the VIA itself
via1_port_b_i(6) <= drive_address(1); -- drive select
via1_port_b_i(5) <= drive_address(0); -- drive select;
via1_port_b_i(4) <= '1'; -- atn a - PUP
via1_port_b_i(3) <= '1'; -- clock out - PUP
via1_port_b_i(2) <= not (clk_i and (not (via1_port_b_o(3) or not via1_port_b_t(3))));
via1_port_b_i(1) <= '1'; -- data out - PUP
via1_port_b_i(0) <= not (data_i and (not (via1_port_b_o(1) or not via1_port_b_t(1))) and (not ((via1_port_b_o(4) or not via1_port_b_t(4)) xor (not atn_i))));
--auto_o <= not power or via1_port_b_i(4);
data_o <= not power or ((not (via1_port_b_o(1) or not via1_port_b_t(1))) and (not ((via1_port_b_o(4) or not via1_port_b_t(4)) xor (not atn_i))));
clk_o <= not power or (not (via1_port_b_o(3) or not via1_port_b_t(3)));
atn_o <= '1';
-- Do the same for VIA 2. Pin levels instead of output register.
via2_port_b_i(7) <= sync;
via2_port_b_i(6) <= '1'; --Density
via2_port_b_i(5) <= '1'; --Density
via2_port_b_i(4) <= write_prot_n;
via2_port_b_i(3) <= '1'; -- LED
via2_port_b_i(2) <= '1'; -- Motor
via2_port_b_i(1) <= '1'; -- Step
via2_port_b_i(0) <= '1'; -- Step
via2_cb1_i <= via2_cb1_o or not via2_cb1_t;
via2_cb2_i <= via2_cb2_o or not via2_cb2_t;
via2_ca2_i <= via2_ca2_o or not via2_ca2_t;
act_led <= not (via2_port_b_o(3) or not via2_port_b_t(3)) or not power;
mode <= via2_cb2_i;
step(0) <= via2_port_b_o(0) or not via2_port_b_t(0);
step(1) <= via2_port_b_o(1) or not via2_port_b_t(1);
motor_on <= (via2_port_b_o(2) or not via2_port_b_t(2)) and power;
rate_ctrl(0) <= via2_port_b_o(5) or not via2_port_b_t(5);
rate_ctrl(1) <= via2_port_b_o(6) or not via2_port_b_t(6);
soe <= via2_ca2_i;
so_n <= byte_ready or not soe;
end structural;
-- Original mapping:
-- 0000-07FF RAM
-- 0800-17FF open
-- 1800-1BFF VIA 1
-- 1C00-1FFF VIA 2
-- 2000-27FF RAM
-- 2800-37FF open
-- 3800-3BFF VIA 1
-- 3C00-3FFF VIA 2
-- 4000-47FF RAM
-- 4800-57FF open
-- 5800-5BFF VIA 1
-- 5C00-5FFF VIA 2
-- 6000-67FF RAM
-- 6800-77FF open
-- 7800-7BFF VIA 1
-- 7C00-7FFF VIA 2
-- 8000-BFFF ROM image (mirror)
-- C000-FFFF ROM image
| gpl-3.0 | c1d4cd2b2b94248167889c18e76b657e | 0.464305 | 3.221636 | false | false | false | false |
markusC64/1541ultimate2 | fpga/1541/vhdl_sim/mm_startup_1541_tc.vhd | 1 | 10,493 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_bfm_pkg.all;
use work.tl_flat_memory_model_pkg.all;
use work.c1541_pkg.all;
use work.tl_string_util_pkg.all;
use work.iec_bus_bfm_pkg.all;
entity mm_startup_1541_tc is
end;
architecture tc of mm_startup_1541_tc is
signal irq : std_logic;
constant c_wd177x_command : unsigned(15 downto 0) := X"1800";
constant c_wd177x_track : unsigned(15 downto 0) := X"1801";
constant c_wd177x_sector : unsigned(15 downto 0) := X"1802";
constant c_wd177x_datareg : unsigned(15 downto 0) := X"1803";
constant c_wd177x_status_clear : unsigned(15 downto 0) := X"1804";
constant c_wd177x_status_set : unsigned(15 downto 0) := X"1805";
constant c_wd177x_irq_ack : unsigned(15 downto 0) := X"1806";
constant c_wd177x_dma_mode : unsigned(15 downto 0) := X"1807";
constant c_wd177x_dma_addr : unsigned(15 downto 0) := X"1808"; -- DWORD
constant c_wd177x_dma_len : unsigned(15 downto 0) := X"180C"; -- WORD
constant c_param_ram : unsigned(15 downto 0) := X"1000";
begin
i_harness: entity work.harness_mm
port map (
io_irq => irq
);
process
variable io : p_io_bus_bfm_object;
variable dram : h_mem_object;
variable bfm : p_iec_bus_bfm_object;
variable msg : t_iec_message;
variable value : unsigned(31 downto 0);
variable params : std_logic_vector(31 downto 0);
variable rotation_speed : natural;
variable bit_time : natural;
begin
wait for 1 ns;
bind_io_bus_bfm("io_bfm", io);
bind_mem_model("dram", dram);
bind_iec_bus_bfm("iec_bfm", bfm);
load_memory("../../../roms/1541.bin", dram, X"00008000");
load_memory("../../../roms/1541.bin", dram, X"0000C000");
-- load_memory("../../../roms/sounds.bin", dram, X"00000000");
load_memory("../../../disks/cpm.g71", dram, X"00100000" ); -- 1 MB offset
wait for 20 us;
io_write(io, c_drvreg_drivetype, X"00"); -- switch to 1541 mode
io_write(io, c_drvreg_power, X"01");
wait for 20 us;
io_write(io, c_drvreg_reset, X"00");
rotation_speed := (31250000 / 20);
for i in 0 to 34 loop
value := unsigned(read_memory_32(dram, std_logic_vector(to_unsigned(16#100000# + 12 + i*8, 32))));
value := value + X"00100000";
params(15 downto 0) := read_memory_16(dram, std_logic_vector(value));
value := value + 2;
bit_time := rotation_speed / to_integer(unsigned(params(15 downto 0)));
params(31 downto 16) := std_logic_vector(to_unsigned(bit_time, 16));
report "Track " & integer'image(i+1) & ": " & hstr(value) & " - " & hstr(params);
io_write_32(io, c_param_ram + 16*i, std_logic_vector(value) );
io_write_32(io, c_param_ram + 16*i + 4, params );
io_write_32(io, c_param_ram + 16*i + 12, params );
end loop;
wait for 1800 ms;
io_write(io, c_drvreg_inserted, X"01");
-- iec_drf(bfm);
iec_send_atn(bfm, X"48"); -- Drive 8, Talk, I will listen
iec_send_atn(bfm, X"6F"); -- Open channel 15
iec_turnaround(bfm); -- start to listen
iec_get_message(bfm, msg);
iec_print_message(msg);
iec_send_atn(bfm, X"5F", true); -- Drives, Untalk!
wait for 10 ms;
wait;
end process;
-- Type Command 7 6 5 4 3 2 1 0
-- -------------------------------------------------------
-- I Restore 0 0 0 0 h v r1 r0
-- I Seek 0 0 0 1 h v r1 r0
-- I Step 0 0 1 u h v r1 r0
-- I Step in 0 1 0 u h v r1 r0
-- I Step out 0 1 1 u h v r1 r0
-- II Read sector 1 0 0 m h/s e 0/c 0
-- II Write sector 1 0 1 m h/s e p/c a
-- III Read address 1 1 0 0 h/0 e 0 0
-- III Read track 1 1 1 0 h/0 e 0 0
-- III Write track 1 1 1 1 h/0 e p/0 0
-- IV Force interrupt 1 1 0 1 i3 i2 i1 i0
process
variable io : p_io_bus_bfm_object;
variable dram : h_mem_object;
variable cmd : std_logic_vector(7 downto 0);
variable byte : std_logic_vector(7 downto 0);
variable track : natural := 0;
variable sector : natural := 0;
variable dir : std_logic := '1';
variable side : std_logic := '0';
procedure do_step(update : std_logic) is
begin
if dir = '0' then
if track < 80 then
track := track + 1;
end if;
else
if track > 0 then
track := track - 1;
end if;
end if;
if update = '1' then
io_read(io, c_wd177x_track, byte);
if dir = '0' then
byte := std_logic_vector(unsigned(byte) + 1);
else
byte := std_logic_vector(unsigned(byte) - 1);
end if;
io_write(io, c_wd177x_track, byte);
end if;
end procedure;
begin
wait for 1 ns;
bind_io_bus_bfm("io_bfm", io);
bind_mem_model("dram", dram);
while true loop
wait until irq = '1';
io_read(io, c_wd177x_command, cmd);
report "Command: " & hstr(cmd);
wait for 50 us;
if cmd(7 downto 4) = "0000" then
report "WD1770 Command: Restore";
io_write(io, c_wd177x_track, X"00"); -- set track to zero
track := 0;
-- no data transfer
io_write(io, c_wd177x_status_clear, X"01");
elsif cmd(7 downto 4) = "0001" then
io_read(io, c_wd177x_datareg, byte);
report "WD1770 Command: Seek: Track = " & integer'image(to_integer(unsigned(byte)));
io_write(io, c_wd177x_track, byte);
track := to_integer(unsigned(byte));
-- no data transfer
io_write(io, c_wd177x_status_clear, X"01");
elsif cmd(7 downto 5) = "001" then
report "WD1770 Command: Step.";
do_step(cmd(4));
io_write(io, c_wd177x_status_clear, X"01");
elsif cmd(7 downto 5) = "010" then
report "WD1770 Command: Step In.";
dir := '1';
do_step(cmd(4));
io_write(io, c_wd177x_status_clear, X"01");
elsif cmd(7 downto 5) = "011" then
report "WD1770 Command: Step Out.";
dir := '0';
do_step(cmd(4));
io_write(io, c_wd177x_status_clear, X"01");
elsif cmd(7 downto 5) = "100" then
io_read(io, c_wd177x_sector, byte);
sector := to_integer(unsigned(byte));
io_read(io, c_drvreg_status, byte);
side := byte(1);
report "WD1770 Command: Read Sector " & integer'image(sector) & " (Track: " & integer'image(track) & ", Side: " & std_logic'image(side) & ")";
io_write_32(io, c_wd177x_dma_addr, X"0000C000" ); -- read a piece of the ROM for now
io_write(io, c_wd177x_dma_len, X"00");
io_write(io, c_wd177x_dma_len+1, X"02"); -- 0x200 = sector size
io_write(io, c_wd177x_dma_mode, X"01"); -- read
-- data transfer, so we are not yet done
elsif cmd(7 downto 5) = "101" then
io_read(io, c_wd177x_sector, byte);
sector := to_integer(unsigned(byte));
io_read(io, c_drvreg_status, byte);
side := byte(1);
report "WD1770 Command: Write Sector " & integer'image(sector) & " (Track: " & integer'image(track) & ", Side: " & std_logic'image(side) & ")";
io_write_32(io, c_wd177x_dma_addr, X"00010000" ); -- just write somewhere safe
io_write(io, c_wd177x_dma_len, X"00");
io_write(io, c_wd177x_dma_len+1, X"02"); -- 0x200 = sector size
io_write(io, c_wd177x_dma_mode, X"02"); -- write
-- data transfer, so we are not yet done
elsif cmd(7 downto 4) = "1100" then
report "WD1770 Command: Read Address.";
write_memory_8(dram, X"00020000", std_logic_vector(to_unsigned(track, 8)) );
write_memory_8(dram, X"00020001", X"00" ); -- side (!!)
write_memory_8(dram, X"00020002", std_logic_vector(to_unsigned(sector, 8)) );
write_memory_8(dram, X"00020003", X"02" ); -- sector length = 512
write_memory_8(dram, X"00020004", X"F9" ); -- CRC1
write_memory_8(dram, X"00020005", X"5E" ); -- CRC2
io_write_32(io, c_wd177x_dma_addr, X"00020000" );
io_write(io, c_wd177x_dma_len, X"06");
io_write(io, c_wd177x_dma_len+1, X"00"); -- transfer 6 bytes
io_write(io, c_wd177x_dma_mode, X"01"); -- read
elsif cmd(7 downto 4) = "1110" then
report "WD1770 Command: Read Track (not implemented).";
elsif cmd(7 downto 4) = "1111" then
report "WD1770 Command: Write Track.";
io_write_32(io, c_wd177x_dma_addr, X"00010000" ); -- just write somewhere safe
io_write(io, c_wd177x_dma_len, X"6A");
io_write(io, c_wd177x_dma_len+1, X"18"); -- 6250 bytes
io_write(io, c_wd177x_dma_mode, X"02"); -- write
elsif cmd(7 downto 4) = "1101" then
io_write(io, c_wd177x_dma_mode, X"00"); -- stop
io_write(io, c_wd177x_status_clear, X"01");
end if;
io_write(io, c_wd177x_irq_ack, X"00");
end loop;
end process;
end architecture;
| gpl-3.0 | 57aef66af44cd1ed648143c220f6e913 | 0.486324 | 3.381566 | false | false | false | false |
ringof/radiofist_audio | core.vhd | 1 | 2,421 | -- Copyright (c) 2015 by David Goncalves <[email protected]>
-- See LICENCE.txt for details
--
-- core module of project; most functionality is under this module
-- in the hierarchy; only signal conversion and debounce is
-- handled seperately in io_pads - both are under the top module
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity core is
port (
din : in STD_LOGIC;
dout : out STD_LOGIC;
clkin : in STD_LOGIC;
reset : in STD_LOGIC;
test : inout STD_LOGIC_VECTOR (7 downto 0)
);
end core;
architecture RTL of core is
component clock is
port (
clk_in : in STD_LOGIC;
reset : in STD_LOGIC;
clk_6mhz : out STD_LOGIC
);
end component clock;
component sigma_delta_adc is
port (
clk : in STD_LOGIC;
reset : in STD_LOGIC;
comp : out STD_LOGIC;
one_bit_adc : out STD_LOGIC;
one_bit_dac : out STD_LOGIC
);
end component sigma_delta_adc;
component sinc3_filter is
port (
reset : in STD_LOGIC;
one_bit_adc_in : in STD_LOGIC;
clk : in STD_LOGIC;
decimation_clk : in STD_LOGIC;
output : out STD_LOGIC_VECTOR (24 downto 0)
);
end component sinc3_filter;
component fir_filter_wrapper is
port (
din : in STD_LOGIC_VECTOR(23 downto 0);
dout : out STD_LOGIC(9 downto 0);
reset : in STD_LOGIC;
clk : in STD_LOGIC
);
end component fir_filter_wrapper;
component sigma_delta_dac is
port (
din : in STD_LOGIC_VECTOR(9 downto 0);
dout : out STD_LOGIC;
reset : in STD_LOGIC;
clk : in STD_LOGIC
);
end component sigma_delta_dac;
signal one_bit_adc_i : STD_LOGIC;
signal decimation_clock_i : STD_LOGIC;
signal sinc3_filter_output : STD_LOGIC_VECTOR(24 downto 0);
begin
adc_clock : clock
port map(
clk_in => clk_in,
reset => reset,
clk_6mhz => clk_6mhz
);
sigma_delta_adc1 : sigma_delta_adc
port map(
clk => ADC_CLK,
reset => RESET,
comp => comp_out,
one_bit_adcc => one_bit_adc_i,
one_bit_dac => ADC_SD_DAC_OUT
);
sinc3_filter1 : sinc3_filter
port map(
reset => RESET,
one_bit_adc_in => one_bit_adc_i,
clk => ADC_CLK,
decimation_clk => decimation_clock_i,
output => sinc3_filter_output
);
adc_fir_lowpass : fir_filter_wrapper
port map(
din => sinc3_filter_output,
dout => open,
reset => RESET,
clk => decimation_clock_i
);
sigma_delta_dac1 : sigma_delta_dac
port map(
din => open,
dout => open,
reset => RESET,
clk => clk
);
end RTL;
| mit | 20c529be5e450a0b1d2dae3c34f867e9 | 0.650558 | 2.802083 | false | false | false | false |
jresendiz27/electronica | arquitectura/sumadorNBits/acarreoAnticipado/SumadorAcarreoAnticipado.vhdl | 2 | 1,028 | library ieee;
use ieee.std_logic_1164.all;
entity Prueba is
generic (numeroBits : integer :=4); --cantidad de bits
Port(
a: in std_logic_vector (numeroBits-1 downto 0);
b: in std_logic_vector (numeroBits-1 downto 0);
op : in std_logic;
s: out std_logic_vector (numeroBits-1 downto 0);
Cout: out std_logic);
end Prueba;
--eb(i) = b(i) xor op;
--c(0) = op;
--p(i) = a(i) or eb(i);
--g(i) = a(i) and eb(i);
--s(i) = p(i) or c(i);
--c(i+1) = c(i) and p(i) or g(i);
architecture A_Prueba of Prueba is
begin
process(a,b,op)
variable eb: std_logic_vector (numeroBits-1 downto 0);
variable p: std_logic_vector (numeroBits-1 downto 0);
variable g: std_logic_vector (numeroBits-1 downto 0);
variable c: std_logic_vector (numeroBits downto 0);
begin
C(0) := op;
for i in 0 to (numeroBits -1) loop
eb(i) := b(i) xor op;
p(i) := a(i) xor eb(i);
g(i) := a(i) and eb(i);
s(i) <= p(i) xor c(i);
c(i+1) := (c(i) and p(i)) or g(i);
end loop;
cout <= c(numeroBits);
--
end process;
end A_Prueba; | gpl-3.0 | 41fbdc21fa470cd84cdc9b2aa7323ca7 | 0.607004 | 2.325792 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/uart_lite/vhdl_source/rx.vhd | 1 | 2,850 | -------------------------------------------------------------------------------
--
-- (C) COPYRIGHT 2004, Gideon's Logic Architectures
--
-------------------------------------------------------------------------------
-- Title : Serial Receiver: 115200/8N1
-------------------------------------------------------------------------------
-- Author : Gideon Zweijtzer <[email protected]>
-- Created : Wed Apr 28, 2004
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity rx is
generic (clks_per_bit : integer := 434); -- 115k2 @ 50 MHz
port (
clk : in std_logic;
reset : in std_logic;
tick : in std_logic;
rxd : in std_logic;
rxchar : out std_logic_vector(7 downto 0);
rx_ack : out std_logic );
end rx;
architecture gideon of rx is
signal bitcnt : integer range 0 to 8;
signal bitvec : std_logic_vector(8 downto 0);
signal timer : integer range 0 to clks_per_bit;
type state_t is (Idle, StartBit, Receiving);
signal state : state_t;
signal rxd_c : std_logic;
begin
process(clk, reset)
begin
if clk'event and clk='1' then
rxd_c <= rxd;
rx_ack <= '0';
if tick = '1' then
case state is
when Idle =>
if rxd_c = '0' then
timer <= (clks_per_bit / 2) - 1;
state <= startbit;
end if;
when StartBit =>
if rxd_c = '1' then
state <= Idle;
elsif timer = 0 then
timer <= clks_per_bit - 1;
state <= receiving;
bitcnt <= 8;
else
timer <= timer - 1;
end if;
when Receiving =>
if timer=0 then
timer <= clks_per_bit - 1;
bitvec <= rxd_c & bitvec(8 downto 1);
if bitcnt = 0 then
state <= Idle;
rx_ack <= '1';
else
bitcnt <= bitcnt - 1;
end if;
else
timer <= timer - 1;
end if;
end case;
end if;
end if;
if reset='1' then
state <= Idle;
bitcnt <= 0;
timer <= 0;
bitvec <= (others => '0');
end if;
end process;
rxchar <= bitvec(7 downto 0);
end gideon;
| gpl-3.0 | fcc66b49b020b65521aa95119eb94f06 | 0.348421 | 4.956522 | false | false | false | false |
markusC64/1541ultimate2 | fpga/io/c2n_playback/vhdl_source/c2n_playback_io.vhd | 1 | 8,706 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.io_bus_pkg.all;
entity c2n_playback_io is
generic (
g_clock_freq : natural := 50_000_000 );
port (
clock : in std_logic;
reset : in std_logic;
req : in t_io_req;
resp : out t_io_resp;
c64_stopped : in std_logic;
generated_tick : out std_logic;
c2n_motor_in : in std_logic;
c2n_motor_out : out std_logic := '0'; -- not yet used
c2n_sense_in : in std_logic; -- not used
c2n_sense_out : out std_logic;
c2n_out_en_w : out std_logic;
c2n_out_en_r : out std_logic;
c2n_out_r : out std_logic;
c2n_out_w : out std_logic );
end c2n_playback_io;
architecture gideon of c2n_playback_io is
signal enabled : std_logic;
signal counter : unsigned(23 downto 0);
signal counter2 : unsigned(11 downto 0);
signal error : std_logic;
signal status : std_logic_vector(7 downto 0);
signal fifo_dout : std_logic_vector(7 downto 0);
signal fifo_read : std_logic;
signal fifo_full : std_logic;
signal fifo_empty : std_logic;
signal fifo_almostfull : std_logic;
signal fifo_flush : std_logic;
signal fifo_write : std_logic;
signal write_pulse : std_logic;
signal stream_en : std_logic;
type t_state is (idle, multi1, multi2, multi3, count_down);
signal state : t_state;
signal state_enc : std_logic_vector(1 downto 0);
signal mode : std_logic;
signal sel : std_logic_vector(1 downto 0);
signal motor_en : std_logic;
signal speed_sel : std_logic;
signal tick_out : std_logic;
attribute register_duplication : string;
attribute register_duplication of stream_en : signal is "no";
attribute register_duplication of motor_en : signal is "no";
begin
process(clock)
begin
if rising_edge(clock) then
-- c2n pin out and sync
stream_en <= enabled; --
motor_en <= c2n_motor_in;
if fifo_empty='1' and stream_en='1' then
error <= '1';
end if;
-- bus handling
resp <= c_io_resp_init;
fifo_flush <= '0';
if req.write='1' then
resp.ack <= '1'; -- ack for fifo write as well.
if req.address(11)='0' then
enabled <= req.data(0);
if req.data(1)='1' then
error <= '0';
end if;
fifo_flush <= req.data(2);
mode <= req.data(3);
c2n_sense_out <= req.data(4);
speed_sel <= req.data(5);
sel <= req.data(7 downto 6);
end if;
elsif req.read='1' then
resp.ack <= '1';
resp.data <= status;
end if;
case state is
when idle =>
if stream_en='1' and fifo_empty='0' then
write_pulse <= '1';
if fifo_dout=X"00" then
if mode='1' then
state <= multi1;
else
counter <= to_unsigned(256*8, counter'length);
counter2 <= to_unsigned(256*4, counter2'length);
state <= count_down;
write_pulse <= '0'; -- not really a pulse
end if;
else
counter <= unsigned("0000000000000" & fifo_dout & "000");
counter2 <= unsigned("00" & fifo_dout & "00"); -- 12 bits
state <= count_down;
end if;
else
write_pulse <= '0';
end if;
when multi1 =>
if enabled = '0' then
state <= idle;
elsif stream_en='1' and fifo_empty='0' then
counter(7 downto 0) <= unsigned(fifo_dout);
counter2(6 downto 0) <= unsigned(fifo_dout(7 downto 1));
state <= multi2;
end if;
when multi2 =>
if enabled = '0' then
state <= idle;
elsif stream_en='1' and fifo_empty='0' then
counter(15 downto 8) <= unsigned(fifo_dout);
counter2(11 downto 7) <= unsigned(fifo_dout(4 downto 0));
if fifo_dout(7 downto 5) /= "000" then
counter2 <= (others => '1');
end if;
state <= multi3;
end if;
when multi3 =>
if enabled = '0' then
state <= idle;
elsif stream_en='1' and fifo_empty='0' then
counter(23 downto 16) <= unsigned(fifo_dout);
if fifo_dout /= X"00" then
counter2 <= (others => '1');
end if;
state <= count_down;
end if;
when count_down =>
if enabled = '0' then
state <= idle;
elsif tick_out='1' and stream_en='1' and c64_stopped='0' then
if (counter2 = 1) or (counter2 = 0) then
write_pulse <= '0';
else
counter2 <= counter2 - 1;
end if;
if (counter = 1) or (counter = 0) then
state <= idle;
else
counter <= counter - 1;
end if;
end if;
when others =>
null;
end case;
if reset='1' then
enabled <= '0';
counter <= (others => '0');
error <= '0';
mode <= '0';
sel <= "00";
c2n_sense_out <= '0';
write_pulse <= '0';
end if;
end if;
end process;
fifo_write <= req.write and req.address(11); -- 0x800-0xFFF (2K)
fifo_read <= '0' when state = count_down else (stream_en and not fifo_empty);
fifo: entity work.sync_fifo
generic map (
g_depth => 2048, -- Actual depth.
g_data_width => 8,
g_threshold => 1536,
g_storage => "block",
g_fall_through => true )
port map (
clock => clock,
reset => reset,
rd_en => fifo_read,
wr_en => fifo_write,
din => req.data,
dout => fifo_dout,
flush => fifo_flush,
full => fifo_full,
almost_full => fifo_almostfull,
empty => fifo_empty,
count => open );
status(0) <= enabled;
status(1) <= error;
status(2) <= fifo_full;
status(3) <= fifo_almostfull;
status(4) <= state_enc(0);
status(5) <= state_enc(1);
status(6) <= stream_en;
status(7) <= fifo_empty;
-- mode 0: no output
-- mode 1: negative pulse on read
-- mode 2: positive pulse on write
-- mode 3: no output
with sel select c2n_out_r <=
not write_pulse when "01", -- Load from tap
'1' when others;
c2n_out_en_r <= stream_en when (sel = "01") else '0';
c2n_out_en_w <= stream_en when (sel = "10") else '0';
with sel select c2n_out_w <=
write_pulse when "10", -- Write to Tape
'1' when others;
with state select state_enc <=
"00" when idle,
"01" when multi1,
"01" when multi2,
"01" when multi3,
"10" when count_down,
"11" when others;
i_tape_speed: entity work.tape_speed_control
generic map (
g_clock_freq => g_clock_freq )
port map (
clock => clock,
reset => reset,
speed_sel => speed_sel,
motor_en => motor_en,
tick_out => tick_out
);
generated_tick <= tick_out;
end gideon;
| gpl-3.0 | b4736cbdea522394dad33159ce129bc6 | 0.426258 | 4.128023 | false | false | false | false |
markusC64/1541ultimate2 | fpga/fpga_top/ultimate_fpga/vhdl_sim/harness_v5.vhd | 1 | 16,254 |
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.tl_flat_memory_model_pkg.all;
use work.mem_bus_pkg.all;
use work.cart_slot_pkg.all;
use work.io_bus_pkg.all;
use work.io_bus_bfm_pkg.all;
use work.command_if_pkg.all;
entity harness_v5 is
end harness_v5;
architecture tb of harness_v5 is
constant c_uart_divisor : natural := 434;
signal PHI2 : std_logic := '0';
signal RSTn : std_logic := 'H';
signal DOTCLK : std_logic := '1';
signal BUFFER_ENn : std_logic := '1';
signal BA : std_logic := '0';
signal DMAn : std_logic := '1';
signal EXROMn : std_logic;
signal GAMEn : std_logic;
signal ROMHn : std_logic := '1';
signal ROMLn : std_logic := '1';
signal IO1n : std_logic := '1';
signal IO2n : std_logic := '1';
signal IRQn : std_logic := '1';
signal NMIn : std_logic := '1';
signal SDRAM_CSn : std_logic;
signal SDRAM_RASn : std_logic;
signal SDRAM_CASn : std_logic;
signal SDRAM_WEn : std_logic;
signal SDRAM_CKE : std_logic;
signal SDRAM_CLK : std_logic;
signal SDRAM_DQM : std_logic;
signal LB_ADDR : std_logic_vector(14 downto 0);
signal LB_DATA : std_logic_vector(7 downto 0) := X"00";
signal logic_SDRAM_CSn : std_logic;
signal logic_SDRAM_RASn : std_logic;
signal logic_SDRAM_CASn : std_logic;
signal logic_SDRAM_WEn : std_logic;
signal logic_SDRAM_CKE : std_logic;
signal logic_SDRAM_CLK : std_logic;
signal logic_SDRAM_DQM : std_logic;
signal logic_LB_ADDR : std_logic_vector(14 downto 0);
signal PWM_OUT : std_logic_vector(1 downto 0);
signal IEC_ATN : std_logic := '1';
signal IEC_DATA : std_logic := '1';
signal IEC_CLOCK : std_logic := '1';
signal IEC_RESET : std_logic := '1';
signal IEC_SRQ_IN : std_logic := '1';
signal DISK_ACTn : std_logic; -- activity LED
signal CART_LEDn : std_logic;
signal SDACT_LEDn : std_logic;
signal MOTOR_LEDn : std_logic;
signal UART_TXD : std_logic;
signal UART_RXD : std_logic := '1';
signal SD_SSn : std_logic;
signal SD_CLK : std_logic;
signal SD_MOSI : std_logic;
signal SD_MISO : std_logic := '1';
signal SD_WP : std_logic := '1';
signal SD_CARDDETn : std_logic := '1';
signal BUTTON : std_logic_vector(2 downto 0) := "000";
signal SLOT_ADDR : std_logic_vector(15 downto 0);
signal SLOT_DATA : std_logic_vector(7 downto 0);
signal RWn : std_logic := '1';
signal CAS_MOTOR : std_logic := '1';
signal CAS_SENSE : std_logic := '0';
signal CAS_READ : std_logic := '0';
signal CAS_WRITE : std_logic := '0';
signal RTC_CS : std_logic;
signal RTC_SCK : std_logic;
signal RTC_MOSI : std_logic;
signal RTC_MISO : std_logic := '1';
signal FLASH_CSn : std_logic;
signal FLASH_SCK : std_logic;
signal FLASH_MOSI : std_logic;
signal FLASH_MISO : std_logic := '1';
signal ULPI_CLOCK : std_logic := '0';
signal ULPI_RESET : std_logic := '0';
signal ULPI_NXT : std_logic := '0';
signal ULPI_STP : std_logic;
signal ULPI_DIR : std_logic := '0';
signal ULPI_DATA : std_logic_vector(7 downto 0) := (others => 'H');
signal sys_clock : std_logic := '0';
signal sys_reset : std_logic := '0';
signal sys_shifted : std_logic := '0';
signal rx_char : std_logic_vector(7 downto 0);
signal rx_char_d : std_logic_vector(7 downto 0);
signal rx_ack : std_logic;
signal tx_char : std_logic_vector(7 downto 0) := X"00";
signal tx_done : std_logic;
signal do_tx : std_logic := '0';
shared variable dram : h_mem_object;
shared variable ram : h_mem_object;
-- shared variable rom : h_mem_object;
-- shared variable bram : h_mem_object;
-- memory controller interconnect
signal memctrl_inhibit : std_logic := '0';
signal mem_req : t_mem_req;
signal mem_resp : t_mem_resp;
signal mem_req_cached : t_mem_burst_req;
signal mem_resp_cached : t_mem_burst_resp;
signal io_req : t_io_req;
signal io_resp : t_io_resp;
-- cache monitoring
signal hit_count : unsigned(31 downto 0);
signal miss_count : unsigned(31 downto 0);
signal hit_ratio : real := 0.0;
begin
mut: entity work.ultimate_logic
generic map (
g_simulation => true,
g_uart => true,
g_drive_1541 => true,
g_drive_1541_2 => true,
g_hardware_gcr => true,
g_cartridge => true,
g_command_intf => true,
g_stereo_sid => true,
g_ram_expansion => true,
g_extended_reu => true,
g_hardware_iec => true,
g_c2n_streamer => true,
g_c2n_recorder => true,
g_drive_sound => true,
g_rtc_chip => true,
g_rtc_timer => true,
g_usb_host => true,
g_spi_flash => true )
port map (
sys_clock => sys_clock,
sys_reset => sys_reset,
PHI2 => PHI2,
DOTCLK => DOTCLK,
RSTn => RSTn,
BUFFER_ENn => BUFFER_ENn,
SLOT_ADDR => SLOT_ADDR,
SLOT_DATA => SLOT_DATA,
RWn => RWn,
BA => BA,
DMAn => DMAn,
EXROMn => EXROMn,
GAMEn => GAMEn,
ROMHn => ROMHn,
ROMLn => ROMLn,
IO1n => IO1n,
IO2n => IO2n,
IRQn => IRQn,
NMIn => NMIn,
-- local bus side
mem_inhibit => memctrl_inhibit,
--memctrl_idle => memctrl_idle,
mem_req => mem_req,
mem_resp => mem_resp,
-- io bus for simulation
sim_io_req => io_req,
sim_io_resp => io_resp,
-- PWM outputs (for audio)
PWM_OUT => PWM_OUT,
-- IEC bus
IEC_ATN => IEC_ATN,
IEC_DATA => IEC_DATA,
IEC_CLOCK => IEC_CLOCK,
IEC_RESET => IEC_RESET,
IEC_SRQ_IN => IEC_SRQ_IN,
DISK_ACTn => DISK_ACTn, -- activity LED
CART_LEDn => CART_LEDn,
SDACT_LEDn => SDACT_LEDn,
MOTOR_LEDn => MOTOR_LEDn,
-- Debug UART
UART_TXD => UART_TXD,
UART_RXD => UART_RXD,
-- SD Card Interface
SD_SSn => SD_SSn,
SD_CLK => SD_CLK,
SD_MOSI => SD_MOSI,
SD_MISO => SD_MISO,
SD_CARDDETn => SD_CARDDETn,
-- Cassette Interface
CAS_MOTOR => CAS_MOTOR,
CAS_SENSE => CAS_SENSE,
CAS_READ => CAS_READ,
CAS_WRITE => CAS_WRITE,
-- RTC Interface
RTC_CS => RTC_CS,
RTC_SCK => RTC_SCK,
RTC_MOSI => RTC_MOSI,
RTC_MISO => RTC_MISO,
-- Flash Interface
FLASH_CSn => FLASH_CSn,
FLASH_SCK => FLASH_SCK,
FLASH_MOSI => FLASH_MOSI,
FLASH_MISO => FLASH_MISO,
-- USB Interface (ULPI)
ULPI_CLOCK => ULPI_CLOCK,
ULPI_RESET => ULPI_RESET,
ULPI_NXT => ULPI_NXT,
ULPI_STP => ULPI_STP,
ULPI_DIR => ULPI_DIR,
ULPI_DATA => ULPI_DATA,
-- Buttons
BUTTON => BUTTON );
i_cache: entity work.dm_cache
port map (
clock => sys_clock,
reset => sys_reset,
client_req => mem_req,
client_resp => mem_resp,
mem_req => mem_req_cached,
mem_resp => mem_resp_cached,
hit_count => hit_count,
miss_count => miss_count );
hit_ratio <= real(to_integer(hit_count)) / real(to_integer(miss_count) + to_integer(hit_count) + 1);
i_memctrl: entity work.ext_mem_ctrl_v5_sdr
generic map (
g_simulation => true,
A_Width => 15 )
port map (
clock => sys_clock,
clk_shifted => sys_shifted,
reset => sys_reset,
inhibit => '0', --memctrl_inhibit,
is_idle => open, --memctrl_idle,
req => mem_req_cached,
resp => mem_resp_cached,
SDRAM_CSn => logic_SDRAM_CSn,
SDRAM_RASn => logic_SDRAM_RASn,
SDRAM_CASn => logic_SDRAM_CASn,
SDRAM_WEn => logic_SDRAM_WEn,
SDRAM_CKE => logic_SDRAM_CKE,
SDRAM_CLK => logic_SDRAM_CLK,
MEM_A => logic_LB_ADDR,
MEM_D => LB_DATA );
-- clock to out.. for data it is inside of the memory controller, because it's bidirectional
SDRAM_CSn <= transport logic_SDRAM_CSn after 4.9 ns;
SDRAM_RASn <= transport logic_SDRAM_RASn after 4.9 ns;
SDRAM_CASn <= transport logic_SDRAM_CASn after 4.9 ns;
SDRAM_WEn <= transport logic_SDRAM_WEn after 4.9 ns;
SDRAM_CKE <= transport logic_SDRAM_CKE after 4.9 ns;
SDRAM_CLK <= transport logic_SDRAM_CLK after 4.9 ns;
LB_ADDR <= transport logic_LB_ADDR after 4.9 ns;
sys_clock <= not sys_clock after 10 ns; -- 50 MHz
sys_reset <= '1', '0' after 100 ns;
sys_shifted <= transport sys_clock after 15 ns; -- 270 degrees
ULPI_CLOCK <= not ULPI_CLOCK after 8.333 ns; -- 60 MHz
ULPI_RESET <= '1', '0' after 100 ns;
PHI2 <= not PHI2 after 507.5 ns; -- 0.98525 MHz
RSTn <= '0', 'H' after 6 us, '0' after 100 us, 'H' after 105 us;
i_ulpi_phy: entity work.ulpi_phy_bfm
generic map (
g_rx_interval => 100000 )
port map (
clock => ULPI_CLOCK,
reset => ULPI_RESET,
ULPI_DATA => ULPI_DATA,
ULPI_DIR => ULPI_DIR,
ULPI_NXT => ULPI_NXT,
ULPI_STP => ULPI_STP );
i_io_bfm: entity work.io_bus_bfm
generic map (
g_name => "io_bfm" )
port map (
clock => sys_clock,
req => io_req,
resp => io_resp );
process
begin
bind_mem_model("intram", ram);
bind_mem_model("dram", dram);
load_memory("../../software/1st_boot/result/1st_boot.bin", ram, X"00000000");
-- 1st boot will try to load the 2nd bootloader and application from flash. In simulation this is a cumbersome
-- process. It would work with a good model of the serial spi flash, but since it is not included in the public
-- archive, you need to create a special boot image that just jumps to 0x20000 and load the application here to dram:
load_memory("../../software/ultimate/result/ultimate.bin", dram, X"00020000");
wait;
end process;
SLOT_DATA <= (others => 'H');
ROMHn <= '1';
ROMLn <= not PHI2 after 50 ns;
IO1n <= '1';
IO2n <= '1';
process
begin
SLOT_ADDR <= X"D400";
RWn <= '1';
while true loop
wait until PHI2 = '0';
--SLOT_ADDR(8 downto 0) <= std_logic_vector(unsigned(SLOT_ADDR(8 downto 0)) + 1);
SLOT_ADDR <= std_logic_vector(unsigned(SLOT_ADDR) + 1);
RWn <= '1';
wait until PHI2 = '0';
RWn <= '0';
end loop;
end process;
process
begin
BA <= '1';
for i in 0 to 100 loop
wait until PHI2='0';
end loop;
BA <= '0';
for i in 0 to 10 loop
wait until PHI2='0';
end loop;
end process;
dram_bfm: entity work.dram_model_8
generic map(
g_given_name => "dram",
g_cas_latency => 2,
g_burst_len_r => 4,
g_burst_len_w => 4,
g_column_bits => 10,
g_row_bits => 13,
g_bank_bits => 2 )
port map (
CLK => SDRAM_CLK,
CKE => SDRAM_CKE,
A => LB_ADDR(12 downto 0),
BA => LB_ADDR(14 downto 13),
CSn => SDRAM_CSn,
RASn => SDRAM_RASn,
CASn => SDRAM_CASn,
WEn => SDRAM_WEn,
DQM => SDRAM_DQM,
DQ => LB_DATA);
i_rx: entity work.rx
generic map (c_uart_divisor)
port map (
clk => sys_clock,
reset => sys_reset,
rxd => UART_TXD,
rxchar => rx_char,
rx_ack => rx_ack );
i_tx: entity work.tx
generic map (c_uart_divisor)
port map (
clk => sys_clock,
reset => sys_reset,
dotx => do_tx,
txchar => tx_char,
done => tx_done,
txd => UART_RXD );
process(sys_clock)
begin
if rising_edge(sys_clock) then
if rx_ack='1' then
rx_char_d <= rx_char;
end if;
end if;
end process;
-- procedure register_io_bus_bfm(named : string; variable pntr: inout p_io_bus_bfm_object);
-- procedure bind_io_bus_bfm(named : string; variable pntr: inout p_io_bus_bfm_object);
-- procedure io_read(variable io : inout p_io_bus_bfm_object; addr : unsigned; data : out std_logic_vector(7 downto 0));
-- procedure io_write(variable io : inout p_io_bus_bfm_object; addr : unsigned; data : std_logic_vector(7 downto 0));
-- constant c_cart_c64_mode : unsigned(3 downto 0) := X"0";
-- constant c_cart_c64_stop : unsigned(3 downto 0) := X"1";
-- constant c_cart_c64_stop_mode : unsigned(3 downto 0) := X"2";
-- constant c_cart_c64_clock_detect : unsigned(3 downto 0) := X"3";
-- constant c_cart_cartridge_rom_base : unsigned(3 downto 0) := X"4";
-- constant c_cart_cartridge_type : unsigned(3 downto 0) := X"5";
-- constant c_cart_cartridge_kill : unsigned(3 downto 0) := X"6";
-- constant c_cart_reu_enable : unsigned(3 downto 0) := X"8";
-- constant c_cart_reu_size : unsigned(3 downto 0) := X"9";
-- constant c_cart_swap_buttons : unsigned(3 downto 0) := X"A";
-- constant c_cart_ethernet_enable : unsigned(3 downto 0) := X"F";
process
variable io : p_io_bus_bfm_object;
begin
wait until sys_reset='0';
wait until sys_clock='1';
bind_io_bus_bfm("io_bfm", io);
io_write(io, X"40000" + c_cart_c64_mode, X"04"); -- reset
io_write(io, X"40000" + c_cart_cartridge_type, X"06"); -- retro
io_write(io, X"40000" + c_cart_c64_mode, X"08"); -- unreset
io_write(io, X"44000" + c_cif_io_slot_base, X"7E");
io_write(io, X"44000" + c_cif_io_slot_enable, X"01");
wait for 6 us;
wait until sys_clock='1';
io_write(io, X"42002", X"42");
wait;
end process;
process
procedure send_char(i: std_logic_vector(7 downto 0)) is
begin
if tx_done /= '1' then
wait until tx_done = '1';
end if;
wait until sys_clock='1';
tx_char <= i;
do_tx <= '1';
wait until tx_done = '0';
wait until sys_clock='1';
do_tx <= '0';
end procedure;
procedure send_string(i : string) is
variable b : std_logic_vector(7 downto 0);
begin
for n in i'range loop
b := std_logic_vector(to_unsigned(character'pos(i(n)), 8));
send_char(b);
end loop;
send_char(X"0d");
send_char(X"0a");
end procedure;
begin
wait for 2 ms;
--send_string("wd 4005000 12345678");
send_string("run");
-- send_string("m 100000");
-- send_string("w 400000F 4");
wait;
end process;
-- check timing data
process(PHI2)
begin
if falling_edge(PHI2) then
assert SLOT_DATA'last_event >= 189 ns
report "Timing error on C64 bus."
severity error;
end if;
end process;
end tb;
| gpl-3.0 | 3bab2287c25e3fde9a356c0a6adf0901 | 0.51009 | 3.357571 | false | false | false | false |
chiggs/nvc | test/bounds/issue54.vhd | 4 | 442 | entity issue54 is
begin
end entity issue54;
architecture a of issue54 is
begin
p : process
variable v : bit_vector(7 downto 0) := (others => '0');
begin
v(3 downto 0) := (7 downto 4 => '1'); -- OK
v(7 downto 4) := (3 downto 0 => '1'); -- OK
v(7 downto 4) := (3 downto 0 => '1', others => '0'); -- Error
assert (v = (7 downto 0 => '1'));
wait;
end process p;
end architecture a;
| gpl-3.0 | 24b4fd186ae22428bead3cd85a9359de | 0.515837 | 3.25 | false | false | false | false |
vzh/geda-gaf | utils/netlist/examples/vams/vhdl/basic-vhdl/transitest_arc.vhdl | 15 | 1,201 | -- Structural VAMS generated by gnetlist
-- Secondary unit
ARCHITECTURE transistor_test OF top_entity IS
terminal unnamed_net5 : electrical;
terminal unnamed_net4 : electrical;
terminal unnamed_net3 : electrical;
terminal unnamed_net2 : electrical;
terminal unnamed_net1 : electrical;
BEGIN
-- Architecture statement part
BJT1 : ENTITY BJT_transistor_simple(simple_arc)
GENERIC MAP (
NEL => 5.0)
PORT MAP ( Base => unnamed_net2,
Collector => unnamed_net5,
Emitter => unnamed_net1);
VS_base : ENTITY VOLTAGE_SOURCE(sinusodial)
GENERIC MAP (
amplitude => 1.0,
k => 150.0)
PORT MAP ( LT => unnamed_net3,
RT => unnamed_net1);
VS_collector : ENTITY VOLTAGE_SOURCE(sinusodial)
GENERIC MAP (
amplitude => 2.0,
offset => 10.2,
k => 100.0)
PORT MAP ( LT => unnamed_net4,
RT => unnamed_net1);
RES_collecter : ENTITY RESISTOR
GENERIC MAP (
r => 60.0)
PORT MAP ( RT => unnamed_net4,
LT => unnamed_net5);
RES_base : ENTITY RESISTOR
GENERIC MAP (
r => 10000.0)
PORT MAP ( RT => unnamed_net2,
LT => unnamed_net3);
GND : ENTITY GROUND_NODE
PORT MAP ( T1 => unnamed_net1);
END ARCHITECTURE transistor_test;
| gpl-2.0 | 35c7a3bddbeb8a91d8ea4347541dc719 | 0.655287 | 3.111399 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.