92 lines
3.3 KiB
VHDL
92 lines
3.3 KiB
VHDL
--
|
|
-- Global definitions for Red Pitaya PuzzleFW firmware.
|
|
--
|
|
-- Joris van Rantwijk 2024
|
|
--
|
|
|
|
library ieee;
|
|
use ieee.std_logic_1164.all;
|
|
use ieee.numeric_std.all;
|
|
|
|
|
|
package puzzlefw_pkg is
|
|
|
|
-- 32-bit address for DMA on AXI bus, aligned to 8-byte multiple.
|
|
subtype dma_address_type is std_logic_vector(31 downto 3);
|
|
type dma_address_array is array(natural range <>) of dma_address_type;
|
|
|
|
-- 64-bit data for DMA on AXI bus.
|
|
subtype dma_data_type is std_logic_vector(63 downto 0);
|
|
type dma_data_array is array(natural range <>) of dma_data_type;
|
|
|
|
-- Register addresses.
|
|
constant reg_addr_mask: std_logic_vector(31 downto 0) := x"0010fffc";
|
|
constant reg_info: natural := 16#000000#;
|
|
constant reg_irq_enable: natural := 16#000010#;
|
|
constant reg_dma_en: natural := 16#000100#;
|
|
constant reg_dma_status: natural := 16#000104#;
|
|
constant reg_dma_clear: natural := 16#000108#;
|
|
constant reg_rcnt: natural := 16#000200#;
|
|
constant reg_wcnt: natural := 16#000204#;
|
|
constant reg_start: natural := 16#000208#;
|
|
constant reg_dma_buf_addr: natural := 16#100000#;
|
|
constant reg_dma_buf_size: natural := 16#100004#;
|
|
constant reg_test_irq: natural := 16#100100#;
|
|
constant reg_test_led: natural := 16#100104#;
|
|
|
|
-- Firmware info word.
|
|
constant fw_api_version: natural := 1;
|
|
constant fw_version_major: natural := 0;
|
|
constant fw_version_minor: natural := 2;
|
|
constant fw_info_word: std_logic_vector(31 downto 0) :=
|
|
x"4a"
|
|
& std_logic_vector(to_unsigned(fw_api_version, 8))
|
|
& std_logic_vector(to_unsigned(fw_version_major, 8))
|
|
& std_logic_vector(to_unsigned(fw_version_minor, 8));
|
|
|
|
-- ADC input port type.
|
|
type adc_data_input_type is array(0 to 1) of std_logic_vector(15 downto 0);
|
|
|
|
-- Control registers: read/write access by processor, output signals to FPGA.
|
|
type registers_control is record
|
|
irq_enable: std_logic;
|
|
test_irq: std_logic_vector(7 downto 0);
|
|
test_led: std_logic_vector(7 downto 0);
|
|
dma_en: std_logic;
|
|
dma_buf_addr: std_logic_vector(31 downto 12);
|
|
dma_buf_size: std_logic_vector(31 downto 12);
|
|
end record;
|
|
|
|
-- Status registers: input signals from FPGA, read-only access by processor.
|
|
type registers_status is record
|
|
dma_busy: std_logic;
|
|
dma_err_read: std_logic;
|
|
dma_err_write: std_logic;
|
|
dma_err_address: std_logic;
|
|
dma_err_any: std_logic;
|
|
rcnt: unsigned(31 downto 0);
|
|
wcnt: unsigned(31 downto 0);
|
|
end record;
|
|
|
|
-- Trigger registers: write-only access by processor, single-cycle pulse signals to FPGA.
|
|
type registers_trigger is record
|
|
dma_clear: std_logic;
|
|
start: std_logic;
|
|
end record;
|
|
|
|
constant registers_control_init: registers_control := (
|
|
irq_enable => '0',
|
|
test_irq => (others => '0'),
|
|
test_led => (others => '0'),
|
|
dma_en => '0',
|
|
dma_buf_addr => (others => '0'),
|
|
dma_buf_size => (others => '0')
|
|
);
|
|
|
|
constant registers_trigger_init: registers_trigger := (
|
|
dma_clear => '0',
|
|
start => '0'
|
|
);
|
|
|
|
end package;
|