Merge branch 'SMB-377_SM-200_GroupDLED' into ELGIP-179-runtimePOFProtocolSel
This commit is contained in:
commit
124928cf87
8 changed files with 636 additions and 807 deletions
|
|
@ -1,229 +0,0 @@
|
|||
-- megafunction wizard: %RAM: 2-PORT%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: altsyncram
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: generic_seq_ram.vhd
|
||||
-- Megafunction Name(s):
|
||||
-- altsyncram
|
||||
--
|
||||
-- Simulation Library Files(s):
|
||||
-- altera_mf
|
||||
-- ============================================================
|
||||
-- ************************************************************
|
||||
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
--
|
||||
-- 14.1.1 Build 190 01/19/2015 SJ Web Edition
|
||||
-- ************************************************************
|
||||
|
||||
|
||||
--Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
--Your use of Altera Corporation's design tools, logic functions
|
||||
--and other software and tools, and its AMPP partner logic
|
||||
--functions, and any output files from any of the foregoing
|
||||
--(including device programming or simulation files), and any
|
||||
--associated documentation or information are expressly subject
|
||||
--to the terms and conditions of the Altera Program License
|
||||
--Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
--the Altera MegaCore Function License Agreement, or other
|
||||
--applicable license agreement, including, without limitation,
|
||||
--that your use is for the sole purpose of programming logic
|
||||
--devices manufactured by Altera and sold by Altera or its
|
||||
--authorized distributors. Please refer to the applicable
|
||||
--agreement for further details.
|
||||
|
||||
|
||||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.all;
|
||||
|
||||
LIBRARY altera_mf;
|
||||
USE altera_mf.altera_mf_components.all;
|
||||
use work.common_pkg.all;
|
||||
|
||||
ENTITY generic_seq_ram_15 IS
|
||||
generic (
|
||||
SEQ_DEPTH : natural range 1 to 1024
|
||||
);
|
||||
PORT
|
||||
(
|
||||
address_a : IN STD_LOGIC_VECTOR (log2(SEQ_DEPTH)-1 DOWNTO 0);
|
||||
address_b : IN STD_LOGIC_VECTOR (log2(SEQ_DEPTH)-1 DOWNTO 0);
|
||||
clock : IN STD_LOGIC := '1';
|
||||
data_a : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
data_b : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
wren_a : IN STD_LOGIC := '0';
|
||||
wren_b : IN STD_LOGIC := '0';
|
||||
q_a : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
q_b : OUT STD_LOGIC_VECTOR (31 DOWNTO 0)
|
||||
);
|
||||
END generic_seq_ram_15;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF generic_seq_ram_15 IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
SIGNAL sub_wire1 : STD_LOGIC_VECTOR (31 DOWNTO 0);
|
||||
|
||||
BEGIN
|
||||
q_a <= sub_wire0(31 DOWNTO 0);
|
||||
q_b <= sub_wire1(31 DOWNTO 0);
|
||||
|
||||
altsyncram_component : altsyncram
|
||||
GENERIC MAP (
|
||||
address_reg_b => "CLOCK0",
|
||||
clock_enable_input_a => "BYPASS",
|
||||
clock_enable_input_b => "BYPASS",
|
||||
clock_enable_output_a => "BYPASS",
|
||||
clock_enable_output_b => "BYPASS",
|
||||
indata_reg_b => "CLOCK0",
|
||||
intended_device_family => "Cyclone V",
|
||||
lpm_type => "altsyncram",
|
||||
numwords_a => SEQ_DEPTH,
|
||||
numwords_b => SEQ_DEPTH,
|
||||
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_mixed_ports => "OLD_DATA",
|
||||
read_during_write_mode_port_a => "NEW_DATA_NO_NBE_READ",
|
||||
read_during_write_mode_port_b => "NEW_DATA_NO_NBE_READ",
|
||||
widthad_a => log2(SEQ_DEPTH),
|
||||
widthad_b => log2(SEQ_DEPTH),
|
||||
width_a => 32,
|
||||
width_b => 32,
|
||||
width_byteena_a => 1,
|
||||
width_byteena_b => 1,
|
||||
wrcontrol_wraddress_reg_b => "CLOCK0"
|
||||
)
|
||||
PORT MAP (
|
||||
address_a => address_a,
|
||||
address_b => address_b,
|
||||
clock0 => clock,
|
||||
data_a => data_a,
|
||||
data_b => data_b,
|
||||
wren_a => wren_a,
|
||||
wren_b => wren_b,
|
||||
q_a => sub_wire0,
|
||||
q_b => sub_wire1
|
||||
);
|
||||
|
||||
|
||||
|
||||
END SYN;
|
||||
|
||||
-- ============================================================
|
||||
-- CNX file retrieval info
|
||||
-- ============================================================
|
||||
-- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
|
||||
-- Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRdata NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRq NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRrren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRwraddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRwren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
|
||||
-- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
|
||||
-- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: MEMSIZE NUMERIC "8192"
|
||||
-- Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: MIFfilename STRING ""
|
||||
-- Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "2"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: REGdata NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: REGq NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGrdaddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGrren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGwraddress NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: REGwren NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
-- Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: UseDPRAM NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: VarWidth NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "32"
|
||||
-- Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "32"
|
||||
-- Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "32"
|
||||
-- Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "32"
|
||||
-- Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: enable NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: rden NUMERIC "0"
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK0"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: INDATA_REG_B STRING "CLOCK0"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
|
||||
-- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "256"
|
||||
-- Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "256"
|
||||
-- Retrieval info: CONSTANT: OPERATION_MODE STRING "BIDIR_DUAL_PORT"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_REG_B STRING "UNREGISTERED"
|
||||
-- Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
|
||||
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_MIXED_PORTS STRING "DONT_CARE"
|
||||
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_A STRING "NEW_DATA_NO_NBE_READ"
|
||||
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_B STRING "NEW_DATA_NO_NBE_READ"
|
||||
-- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "8"
|
||||
-- Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "8"
|
||||
-- Retrieval info: CONSTANT: WIDTH_A NUMERIC "32"
|
||||
-- Retrieval info: CONSTANT: WIDTH_B NUMERIC "32"
|
||||
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_B NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WRCONTROL_WRADDRESS_REG_B STRING "CLOCK0"
|
||||
-- Retrieval info: USED_PORT: address_a 0 0 8 0 INPUT NODEFVAL "address_a[7..0]"
|
||||
-- Retrieval info: USED_PORT: address_b 0 0 8 0 INPUT NODEFVAL "address_b[7..0]"
|
||||
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
|
||||
-- Retrieval info: USED_PORT: data_a 0 0 32 0 INPUT NODEFVAL "data_a[31..0]"
|
||||
-- Retrieval info: USED_PORT: data_b 0 0 32 0 INPUT NODEFVAL "data_b[31..0]"
|
||||
-- Retrieval info: USED_PORT: q_a 0 0 32 0 OUTPUT NODEFVAL "q_a[31..0]"
|
||||
-- Retrieval info: USED_PORT: q_b 0 0 32 0 OUTPUT NODEFVAL "q_b[31..0]"
|
||||
-- Retrieval info: USED_PORT: wren_a 0 0 0 0 INPUT GND "wren_a"
|
||||
-- Retrieval info: USED_PORT: wren_b 0 0 0 0 INPUT GND "wren_b"
|
||||
-- Retrieval info: CONNECT: @address_a 0 0 8 0 address_a 0 0 8 0
|
||||
-- Retrieval info: CONNECT: @address_b 0 0 8 0 address_b 0 0 8 0
|
||||
-- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @data_a 0 0 32 0 data_a 0 0 32 0
|
||||
-- Retrieval info: CONNECT: @data_b 0 0 32 0 data_b 0 0 32 0
|
||||
-- Retrieval info: CONNECT: @wren_a 0 0 0 0 wren_a 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @wren_b 0 0 0 0 wren_b 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q_a 0 0 32 0 @q_a 0 0 32 0
|
||||
-- Retrieval info: CONNECT: q_b 0 0 32 0 @q_b 0 0 32 0
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.cmp TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram.bsf FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL generic_seq_ram_inst.vhd FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
||||
|
|
@ -24,13 +24,14 @@ entity pof_tx_0 is
|
|||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
init : in std_logic;
|
||||
init_done : out std_logic;
|
||||
pd_in : in std_logic;
|
||||
inc_pos : in std_logic;
|
||||
dec_pos : in std_logic;
|
||||
abs_position : in std_logic_vector(31 downto 0);
|
||||
tx_data : out std_logic;
|
||||
-- Avalon MM Interface
|
||||
avs_address : in std_logic_vector( 2 downto 0);
|
||||
avs_address : in std_logic_vector(2 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
|
|
@ -40,10 +41,10 @@ end entity pof_tx_0;
|
|||
|
||||
architecture rtl of pof_tx_0 is
|
||||
|
||||
constant CSR : std_logic_vector( 2 downto 0) := b"000";
|
||||
constant ERROR_INJ_REG : std_logic_vector( 2 downto 0) := b"001";
|
||||
constant TIMING_REG : std_logic_vector( 2 downto 0) := b"010";
|
||||
constant FIFO_LEVEL_REG : std_logic_vector( 2 downto 0) := b"011";
|
||||
constant CSR : std_logic_vector(2 downto 0) := b"000";
|
||||
constant ERROR_INJ_REG : std_logic_vector(2 downto 0) := b"001";
|
||||
constant TIMING_REG : std_logic_vector(2 downto 0) := b"010";
|
||||
constant FIFO_LEVEL_REG : std_logic_vector(2 downto 0) := b"011";
|
||||
|
||||
constant KEEPALIVE_PERIOD_DEF : integer := 100;
|
||||
constant INIT_BLOCKED_PERIOD_DEF : integer := 200;
|
||||
|
|
@ -51,45 +52,45 @@ architecture rtl of pof_tx_0 is
|
|||
function odd_parity(data : std_logic_vector) return std_logic is
|
||||
variable parity_bit : std_logic := '1';
|
||||
begin
|
||||
for n in 0 to data'length-1 loop
|
||||
for n in 0 to data'length - 1 loop
|
||||
parity_bit := parity_bit xor data(n);
|
||||
end loop; -- n
|
||||
end loop; -- n
|
||||
return parity_bit;
|
||||
end function odd_parity;
|
||||
|
||||
function bin2gray(bin : std_logic_vector) return std_logic_vector is
|
||||
variable gray : std_logic_vector(bin'range);
|
||||
begin
|
||||
gray := bin xor ('0' & bin(bin'length-1 downto 1));
|
||||
gray := bin xor ('0' & bin(bin'length - 1 downto 1));
|
||||
return gray;
|
||||
end function bin2gray;
|
||||
|
||||
signal rd_event, wr_event, empty, full, tx_ready : std_logic;
|
||||
signal rd_event_d, wr_event_i, symbol_valid : std_logic;
|
||||
signal enable, toggle_sync, toggle_pd : std_logic;
|
||||
signal add_keepalive, ovfl_err, init_d, init_gen : std_logic;
|
||||
signal clear, pd_in_d, pd_gen, parity_bit : std_logic;
|
||||
signal inject_error, inject_error_req : std_logic;
|
||||
signal pd_event, pd_event_d, pd_event_dd : std_logic;
|
||||
signal init_blocked, pd_event_ddd, delayed_pos : std_logic;
|
||||
signal clr_fifo_lmax : std_logic;
|
||||
|
||||
signal rd_event, wr_event, empty, full, tx_ready : std_logic;
|
||||
signal rd_event_d, wr_event_i, symbol_valid : std_logic;
|
||||
signal enable, toggle_sync, toggle_pd : std_logic;
|
||||
signal add_keepalive, ovfl_err, init_d, init_gen : std_logic;
|
||||
signal clear, pd_in_d, pd_gen, parity_bit : std_logic;
|
||||
signal inject_error, inject_error_req : std_logic;
|
||||
signal pd_event, pd_event_d, pd_event_dd : std_logic;
|
||||
signal init_blocked, pd_event_ddd, delayed_pos : std_logic;
|
||||
signal clr_fifo_lmax : std_logic;
|
||||
--
|
||||
signal delayed_pos_v : std_logic_vector( 2 downto 0);
|
||||
signal init_v, gray, bit_div : std_logic_vector( 3 downto 0);
|
||||
signal latched_pos : std_logic_vector( 3 downto 0);
|
||||
signal event_in_i : std_logic_vector( 6 downto 0);
|
||||
signal event_in, event_out : std_logic_vector( 7 downto 0);
|
||||
signal symbol : std_logic_vector( 7 downto 0);
|
||||
signal init_blk_cnt : std_logic_vector( 9 downto 0) := (others => '0');
|
||||
signal keepalive_cnt : std_logic_vector( 9 downto 0);
|
||||
signal keepalive_period : std_logic_vector( 9 downto 0);
|
||||
signal init_blocked_period : std_logic_vector( 9 downto 0);
|
||||
signal fifo_level, fifo_level_max : std_logic_vector( 9 downto 0);
|
||||
signal delayed_pos_v : std_logic_vector(2 downto 0);
|
||||
signal init_v, gray, bit_div : std_logic_vector(3 downto 0);
|
||||
signal latched_pos : std_logic_vector(3 downto 0);
|
||||
signal event_in_i : std_logic_vector(6 downto 0);
|
||||
signal event_in, event_out : std_logic_vector(7 downto 0);
|
||||
signal symbol : std_logic_vector(7 downto 0);
|
||||
signal init_blk_cnt : std_logic_vector(9 downto 0) := (others => '0');
|
||||
signal keepalive_cnt : std_logic_vector(9 downto 0);
|
||||
signal keepalive_period : std_logic_vector(9 downto 0);
|
||||
signal init_blocked_period : std_logic_vector(9 downto 0);
|
||||
signal fifo_level, fifo_level_max : std_logic_vector(9 downto 0);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
clear <= not enable or init_d;
|
||||
clear <= (not enable) or init_d;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Encode events and queue these in a FIFO
|
||||
|
|
@ -97,71 +98,77 @@ begin
|
|||
|
||||
pEVENT_GEN : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if (clk = '1' and clk'event) then
|
||||
init_d <= init;
|
||||
if(init = '1' and init_d = '0' and init_blocked = '0') then
|
||||
init_v <= "1100";
|
||||
if (init = '0' and init_d = '1') then
|
||||
-- set up int_v to create 2 packets with the new toggle_sync value when init set low
|
||||
init_v <= "1100";
|
||||
-- start timer so this doesn't get triggered again too soon
|
||||
-- the local clear will still hapen as that depends on init_d
|
||||
init_blk_cnt <= init_blocked_period;
|
||||
else
|
||||
init_v <= '0' & init_v(3 downto 1);
|
||||
if (init_blocked = '1') then
|
||||
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt) - 1);
|
||||
end if;
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
if (enable = '0') then
|
||||
toggle_sync <= '0';
|
||||
elsif(init_d = '1' and init_blocked = '0') then
|
||||
elsif (init = '1' and init_d = '0' and init_blocked = '0') then
|
||||
-- toggle the bit just when init set high.
|
||||
toggle_sync <= not toggle_sync;
|
||||
end if;
|
||||
if(init_gen = '1') then
|
||||
init_blk_cnt <= init_blocked_period;
|
||||
elsif(init_blocked = '1') then
|
||||
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt)-1);
|
||||
end if;
|
||||
pd_in_d <= pd_in;
|
||||
|
||||
pd_in_d <= pd_in;
|
||||
pd_event_d <= pd_event;
|
||||
pd_event_dd <= pd_event_d;
|
||||
pd_event_ddd <= pd_event_dd;
|
||||
if(pd_event = '1') then
|
||||
if (pd_event = '1') then
|
||||
latched_pos <= abs_position(3 downto 0);
|
||||
end if;
|
||||
if((dec_pos = '1' or inc_pos = '1') and pd_gen = '1') then
|
||||
if ((dec_pos = '1' or inc_pos = '1') and pd_gen = '1') then
|
||||
delayed_pos_v <= "111";
|
||||
else
|
||||
delayed_pos_v <= '0' & delayed_pos_v(2 downto 1);
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
if (enable = '0') then
|
||||
toggle_pd <= '0';
|
||||
elsif(pd_event = '1') then
|
||||
elsif (pd_event = '1') then
|
||||
toggle_pd <= not toggle_pd;
|
||||
end if;
|
||||
wr_event <= wr_event_i or add_keepalive;
|
||||
event_in <= parity_bit & event_in_i;
|
||||
if(enable = '0' or wr_event_i = '1') then
|
||||
wr_event <= wr_event_i or add_keepalive;
|
||||
event_in <= parity_bit & event_in_i;
|
||||
if (enable = '0' or wr_event_i = '1') then
|
||||
keepalive_cnt <= keepalive_period;
|
||||
else
|
||||
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt)-1);
|
||||
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt) - 1);
|
||||
end if;
|
||||
if(clear = '1') then
|
||||
if (clear = '1') then
|
||||
ovfl_err <= '0';
|
||||
elsif(wr_event = '1' and full = '1') then
|
||||
elsif (wr_event = '1' and full = '1') then
|
||||
ovfl_err <= '1';
|
||||
end if;
|
||||
if(clear = '1' or wr_event = '1') then
|
||||
if (clear = '1' or wr_event = '1') then
|
||||
inject_error <= '0';
|
||||
elsif(inject_error_req = '1') then
|
||||
elsif (inject_error_req = '1') then
|
||||
inject_error <= '1';
|
||||
end if;
|
||||
if(init_gen = '1' or clr_fifo_lmax = '1') then
|
||||
if (clear = '1' or clr_fifo_lmax = '1') then
|
||||
fifo_level_max <= (others => '0');
|
||||
elsif(unsigned(fifo_level) > unsigned(fifo_level_max)) then
|
||||
elsif (unsigned(fifo_level) > unsigned(fifo_level_max)) then
|
||||
fifo_level_max <= fifo_level;
|
||||
end if;
|
||||
init_done <= not (init_d or init_blocked); -- true only when the init messages have been transmitted (based on timing)
|
||||
end if;
|
||||
end process pEVENT_GEN;
|
||||
|
||||
init_gen <= init_v(0);
|
||||
|
||||
init_blocked <= '1' when unsigned(init_blk_cnt) /= 0 else '0';
|
||||
|
||||
|
||||
pd_event <= pd_in and not pd_in_d;
|
||||
pd_gen <= pd_event or pd_event_d or pd_event_dd;
|
||||
pd_event <= pd_in and not pd_in_d;
|
||||
pd_gen <= pd_event or pd_event_d or pd_event_dd;
|
||||
|
||||
delayed_pos <= delayed_pos_v(0) and pd_event_ddd;
|
||||
|
||||
|
|
@ -169,7 +176,7 @@ begin
|
|||
|
||||
add_keepalive <= '1' when wr_event_i = '0' and unsigned(keepalive_cnt) = 0 else '0';
|
||||
|
||||
gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else bin2gray(abs_position(3 downto 0));
|
||||
gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else bin2gray(abs_position(3 downto 0));
|
||||
|
||||
-- toggle_pd is repeated twice in the tx word, to improve resiliance against
|
||||
-- double bit-flips errors
|
||||
|
|
@ -178,10 +185,10 @@ gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else
|
|||
parity_bit <= odd_parity(event_in_i) xor inject_error;
|
||||
|
||||
iQUEUE_EVENT : entity work.sync_fifo
|
||||
generic map (
|
||||
generic map(
|
||||
FIFO_WIDTH => 8,
|
||||
FIFO_DEPTH => 1024)
|
||||
port map (
|
||||
port map(
|
||||
sclr => clear,
|
||||
clock => clk,
|
||||
data => event_in,
|
||||
|
|
@ -195,23 +202,23 @@ gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else
|
|||
-----------------------------------------------------------------------------
|
||||
-- Transmit symbols over serial link
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
pGET_EVENT : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if (clk = '1' and clk'event) then
|
||||
rd_event_d <= rd_event;
|
||||
symbol_valid <= rd_event_d;
|
||||
end if;
|
||||
end process pGET_EVENT;
|
||||
|
||||
rd_event <= '1' when tx_ready = '1' and empty = '0' and rd_event_d = '0' and symbol_valid = '0' else '0';
|
||||
|
||||
symbol <= event_out;
|
||||
|
||||
symbol <= event_out;
|
||||
|
||||
iTX_SYMBOL : entity work.uart_tx_0
|
||||
generic map (
|
||||
generic map(
|
||||
data_width => 8)
|
||||
port map (
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
bit_div => bit_div,
|
||||
|
|
@ -227,36 +234,36 @@ gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else
|
|||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
if (reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
enable <= '0';
|
||||
clr_fifo_lmax <= '0';
|
||||
bit_div <= "0010";
|
||||
keepalive_period <= std_logic_vector(to_unsigned(KEEPALIVE_PERIOD_DEF, 10));
|
||||
init_blocked_period <= std_logic_vector(to_unsigned(INIT_BLOCKED_PERIOD_DEF, 10));
|
||||
elsif(clk = '1' and clk'event) then
|
||||
inject_error_req <= '0';
|
||||
clr_fifo_lmax <= '0';
|
||||
elsif (clk = '1' and clk'event) then
|
||||
inject_error_req <= '0';
|
||||
clr_fifo_lmax <= '0';
|
||||
-- CTRL registers
|
||||
if(avs_write = '1') then
|
||||
if (avs_write = '1') then
|
||||
case avs_address is
|
||||
when CSR =>
|
||||
enable <= avs_writedata(0);
|
||||
clr_fifo_lmax <= avs_writedata(2);
|
||||
bit_div <= avs_writedata(7 downto 4);
|
||||
when ERROR_INJ_REG =>
|
||||
enable <= avs_writedata(0);
|
||||
clr_fifo_lmax <= avs_writedata(2);
|
||||
bit_div <= avs_writedata(7 downto 4);
|
||||
when ERROR_INJ_REG =>
|
||||
inject_error_req <= avs_writedata(0);
|
||||
when TIMING_REG =>
|
||||
keepalive_period <= avs_writedata( 9 downto 0);
|
||||
keepalive_period <= avs_writedata(9 downto 0);
|
||||
init_blocked_period <= avs_writedata(25 downto 16);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
-- Read Ctrl & Status registers
|
||||
avs_readdatavalid <= avs_read;
|
||||
if(avs_read = '1') then
|
||||
if (avs_read = '1') then
|
||||
case avs_address is
|
||||
when CSR =>
|
||||
when CSR =>
|
||||
avs_readdata <= X"000000" & bit_div & b"0" & clr_fifo_lmax & ovfl_err & enable;
|
||||
when TIMING_REG =>
|
||||
avs_readdata <= 6x"0" & init_blocked_period & 6x"0" & keepalive_period;
|
||||
|
|
@ -268,5 +275,5 @@ gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else
|
|||
end if;
|
||||
end if;
|
||||
end process pCTRL_STATUS;
|
||||
|
||||
|
||||
end architecture rtl;
|
||||
|
|
|
|||
|
|
@ -1,87 +1,89 @@
|
|||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/clk
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/reset_n
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_read
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_write
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/sel_slave_0
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/sel_slave_1
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_write_sl0
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_read_sl0
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_readdatavalid_sl0
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_write_sl1
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_read_sl1
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_readdatavalid_sl1
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/init_tx
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/init_rx
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/dir_in
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pd_in
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/inc_pos
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/dec_pos
|
||||
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_1_tb/abs_position
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/tx_data
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/rx_data
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/init_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/dir_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/enc_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pd_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/inc_pos_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/dec_pos_out
|
||||
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_1_tb/abs_pos_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/print_start_in
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/print_start_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/ps_flip_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/test_completed
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/running
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/configuring
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/passed
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/failed
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/stimuli_completed
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/avs_address
|
||||
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_writedata
|
||||
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_readdata_sl0
|
||||
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_readdata_sl1
|
||||
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_1_tb/abs_position_d
|
||||
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_1_tb/swathe_pos
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/swathe_cnt
|
||||
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_m
|
||||
add wave -noupdate -expand -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_s
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/detected_error
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/dir_discr_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pd_discr_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pd_in_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pd_out_cnt
|
||||
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_1_tb/abs_position
|
||||
add wave -noupdate -expand -group TB -radix decimal /pof_tx_rx_1_tb/abs_pos_out
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pos_discr_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/end_of_swathe
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/enc_pulse_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/dir_err
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pd_err
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/pos_err
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/enc_err
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/ovfl_err
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/ps_err
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/injected_errors
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/sent_packets
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/injected_error_type
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/max_pos
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/min_pos
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/exp_enc_pulse
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/exp_enc_cnt
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/error_rate_thres
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/one_pps
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/max_error_flag
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/rx_watchdog
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/rx_watchdog_en
|
||||
add wave -noupdate -expand -group TB /pof_tx_rx_1_tb/rx_watchdog_clr
|
||||
add wave -noupdate /pof_tx_rx_1_tb/pos_discr_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/clk
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/reset_n
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_read
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_write
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/sel_slave_0
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/sel_slave_1
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_write_sl0
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_read_sl0
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_readdatavalid_sl0
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_write_sl1
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_read_sl1
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_readdatavalid_sl1
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/init_tx
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/init_rx
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/dir_in
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pd_in
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/inc_pos
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/dec_pos
|
||||
add wave -noupdate -group TB -radix decimal /pof_tx_rx_1_tb/abs_position
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/tx_data
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/rx_data
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/init_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/dir_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/enc_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pd_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/inc_pos_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/dec_pos_out
|
||||
add wave -noupdate -group TB -radix decimal /pof_tx_rx_1_tb/abs_pos_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/print_start_in
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/print_start_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/ps_flip_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/test_completed
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/running
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/configuring
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/passed
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/failed
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/stimuli_completed
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/avs_address
|
||||
add wave -noupdate -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_writedata
|
||||
add wave -noupdate -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_readdata_sl0
|
||||
add wave -noupdate -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_readdata_sl1
|
||||
add wave -noupdate -group TB -radix decimal /pof_tx_rx_1_tb/abs_position_d
|
||||
add wave -noupdate -group TB -radix decimal /pof_tx_rx_1_tb/swathe_pos
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/swathe_cnt
|
||||
add wave -noupdate -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_m
|
||||
add wave -noupdate -group TB -radix hexadecimal /pof_tx_rx_1_tb/avs_s
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/detected_error
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/dir_discr_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pd_discr_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pd_in_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pd_out_cnt
|
||||
add wave -noupdate -group TB -radix decimal /pof_tx_rx_1_tb/abs_position
|
||||
add wave -noupdate -group TB -radix decimal /pof_tx_rx_1_tb/abs_pos_out
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/end_of_swathe
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/enc_pulse_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/dir_err
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pd_err
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/pos_err
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/enc_err
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/ovfl_err
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/ps_err
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/injected_errors
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/sent_packets
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/injected_error_type
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/max_pos
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/min_pos
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/exp_enc_pulse
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/exp_enc_cnt
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/error_rate_thres
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/one_pps
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/max_error_flag
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/rx_watchdog
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/rx_watchdog_en
|
||||
add wave -noupdate -group TB /pof_tx_rx_1_tb/rx_watchdog_clr
|
||||
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init
|
||||
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_blocked
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_TX/abs_position
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/reset_n
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/clk
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/init
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/pd_in
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/inc_pos
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/dec_pos
|
||||
add wave -noupdate -group POF-Tx -radix decimal /pof_tx_rx_1_tb/iPOF_TX/abs_position
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/tx_data
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/avs_address
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/avs_write
|
||||
|
|
@ -104,7 +106,6 @@ add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/ovfl_err
|
|||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/init_d
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/init_gen
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/init_v
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/init_blocked
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/init_blk_cnt
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/parity_bit
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/inject_error
|
||||
|
|
@ -129,16 +130,16 @@ add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/event_in_i
|
|||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/event_in
|
||||
add wave -noupdate -group POF-Tx /pof_tx_rx_1_tb/iPOF_TX/event_out
|
||||
add wave -noupdate -group POF-Tx -radix decimal /pof_tx_rx_1_tb/iPOF_TX/keepalive_cnt
|
||||
add wave -noupdate /pof_tx_rx_1_tb/iPOF_RX/init_out
|
||||
add wave -noupdate -radix decimal /pof_tx_rx_1_tb/iPOF_RX/abs_pos
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/reset_n
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/clk
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/init
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/rx_clk
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/rx_data
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/init_out
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/pd_out
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/inc_pos
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/dec_pos
|
||||
add wave -noupdate -group POF-Rx -radix decimal /pof_tx_rx_1_tb/iPOF_RX/abs_pos
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/print_start_out
|
||||
add wave -noupdate -group POF-Rx -radix unsigned /pof_tx_rx_1_tb/iPOF_RX/error_rate_thres
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/one_pps
|
||||
|
|
@ -211,9 +212,10 @@ add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data_out_val
|
|||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/rx_data
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/rx_data_i
|
||||
add wave -noupdate -group POF-Rx /pof_tx_rx_1_tb/iPOF_RX/iRX_SYMBOL/data
|
||||
add wave -noupdate /pof_tx_rx_1_tb/iPOF_TX/init_blocked
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {1338555000 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
WaveRestoreCursors {{Cursor 1} {6005000 ps} 0} {{Cursor 2} {5595000 ps} 0} {{Cursor 3} {4135000 ps} 0}
|
||||
quietly wave cursor active 3
|
||||
configure wave -namecolwidth 305
|
||||
configure wave -valuecolwidth 100
|
||||
configure wave -justifyvalue left
|
||||
|
|
@ -228,4 +230,4 @@ configure wave -griddelta 40
|
|||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {4636240802 ps} {7857466274 ps}
|
||||
WaveRestoreZoom {0 ps} {8368238 ps}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ entity pof_tx_1 is
|
|||
reset_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
init : in std_logic;
|
||||
init_done : out std_logic;
|
||||
pd_in : in std_logic;
|
||||
print_start : in std_logic;
|
||||
inc_pos : in std_logic;
|
||||
|
|
@ -95,7 +96,7 @@ architecture rtl of pof_tx_1 is
|
|||
|
||||
begin
|
||||
|
||||
clear <= not enable or init_d;
|
||||
clear <= (not enable) or init_d;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Encode events and queue these in a FIFO
|
||||
|
|
@ -103,24 +104,28 @@ begin
|
|||
|
||||
pEVENT_GEN : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if (clk = '1' and clk'event) then
|
||||
init_d <= init;
|
||||
if(init = '1' and init_d = '0' and init_blocked = '0') then
|
||||
init_v <= "1100";
|
||||
if (init = '0' and init_d = '1') then
|
||||
-- set up int_v to create 2 packets with the new toggle_sync value when init set low
|
||||
init_v <= "1100";
|
||||
-- start timer so this doesn't get triggered again too soon
|
||||
-- the local clear will still hapen as that depends on init_d
|
||||
init_blk_cnt <= init_blocked_period;
|
||||
else
|
||||
init_v <= '0' & init_v(3 downto 1);
|
||||
if (init_blocked = '1') then
|
||||
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt) - 1);
|
||||
end if;
|
||||
end if;
|
||||
if(enable = '0') then
|
||||
if (enable = '0') then
|
||||
toggle_sync <= '0';
|
||||
elsif(init_d = '1' and init_blocked = '0') then
|
||||
elsif (init = '1' and init_d = '0' and init_blocked = '0') then
|
||||
-- toggle the bit just when init set high.
|
||||
toggle_sync <= not toggle_sync;
|
||||
end if;
|
||||
if(init_gen = '1') then
|
||||
init_blk_cnt <= init_blocked_period;
|
||||
elsif(init_blocked = '1') then
|
||||
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt)-1);
|
||||
end if;
|
||||
pd_in_d <= pd_in;
|
||||
|
||||
pd_in_d <= pd_in;
|
||||
pd_event_d <= pd_event;
|
||||
pd_event_dd <= pd_event_d;
|
||||
pd_event_ddd <= pd_event_dd;
|
||||
|
|
@ -162,11 +167,12 @@ begin
|
|||
elsif(inject_error_req = '1') then
|
||||
inject_error <= '1';
|
||||
end if;
|
||||
if(init_gen = '1' or clr_fifo_lmax = '1') then
|
||||
if (clear = '1' or clr_fifo_lmax = '1') then
|
||||
fifo_level_max <= (others => '0');
|
||||
elsif(unsigned(fifo_level) > unsigned(fifo_level_max)) then
|
||||
fifo_level_max <= fifo_level;
|
||||
end if;
|
||||
init_done <= not (init_d or init_blocked); -- true only when the init messages have been transmitted (based on timing)
|
||||
end if;
|
||||
end process pEVENT_GEN;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ architecture behav of pof_tx_rx_1_tb is
|
|||
|
||||
constant UART_BIT_DIV : integer := 6; -- divide by 6
|
||||
|
||||
constant SYMBOL_LEN : natural := 8; -- UART symbol length, excluding
|
||||
-- start/stop and parity bits
|
||||
constant SYMBOL_LEN : natural := 8; -- UART symbol length, excluding
|
||||
-- start/stop and parity bits
|
||||
|
||||
-- Print-Start toggling period
|
||||
constant PS_SWITCH_PER : natural := 5000;
|
||||
|
||||
|
||||
type injected_error_t is (DATA_ERROR, START_BIT_ERROR, STOP_BIT_ERROR);
|
||||
|
||||
|
||||
|
|
@ -66,13 +66,13 @@ architecture behav of pof_tx_rx_1_tb is
|
|||
signal tx_data, rx_data, init_out, dir_out : std_logic;
|
||||
signal pd_out, inc_pos_out, dec_pos_out, end_of_swathe : std_logic;
|
||||
signal print_start_in, print_start_out : std_logic;
|
||||
signal ps_flip_cnt : natural := 0;
|
||||
signal ps_flip_cnt : natural := 0;
|
||||
--
|
||||
signal test_completed, running, configuring : boolean;
|
||||
signal passed, failed, stimuli_completed : boolean;
|
||||
signal detected_error : boolean := false;
|
||||
--
|
||||
signal avs_address : std_logic_vector( 2 downto 0);
|
||||
signal avs_address : std_logic_vector(2 downto 0);
|
||||
signal avs_writedata : std_logic_vector(31 downto 0);
|
||||
signal avs_readdata_sl0, avs_readdata_sl1 : std_logic_vector(31 downto 0);
|
||||
signal abs_position, abs_position_d : std_logic_vector(31 downto 0);
|
||||
|
|
@ -141,7 +141,7 @@ begin -- architecture behav
|
|||
|
||||
iPOF_RX : entity work.pof_rx_1
|
||||
generic map(
|
||||
GEN_BIT_DIV => UART_BIT_DIV)
|
||||
GEN_BIT_DIV => UART_BIT_DIV)
|
||||
port map(
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
|
|
@ -267,15 +267,15 @@ begin -- architecture behav
|
|||
|
||||
pSTIMULI_REGs : process(clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
if (reset_n = '0') then
|
||||
abs_position_d <= (others => '0');
|
||||
print_start_in <= '0';
|
||||
ps_flip_cnt <= 0;
|
||||
elsif(clk = '1' and clk'event) then
|
||||
elsif (clk = '1' and clk'event) then
|
||||
abs_position_d <= abs_position;
|
||||
if(running = true) then
|
||||
if(ps_flip_cnt = PS_SWITCH_PER-1) then
|
||||
ps_flip_cnt <= 0;
|
||||
if (running = true) then
|
||||
if (ps_flip_cnt = PS_SWITCH_PER - 1) then
|
||||
ps_flip_cnt <= 0;
|
||||
print_start_in <= not print_start_in;
|
||||
else
|
||||
ps_flip_cnt <= ps_flip_cnt + 1;
|
||||
|
|
@ -341,7 +341,7 @@ begin -- architecture behav
|
|||
wait until clk = '1' and clk'event;
|
||||
while swathe_pos /= SWATHE_LEN loop
|
||||
-- generate a position increment
|
||||
tmp_int := rv.RandInt(1, 100);
|
||||
tmp_int := rv.RandInt(1, 100);
|
||||
--tmp_int := 100;
|
||||
if (tmp_int < 20) then
|
||||
-- generate a position increment opposite to the swathe direction
|
||||
|
|
@ -360,7 +360,7 @@ begin -- architecture behav
|
|||
end if;
|
||||
end if;
|
||||
--
|
||||
tmp_int := rv.RandInt(1, 100);
|
||||
tmp_int := rv.RandInt(1, 100);
|
||||
if (tmp_int <= 5 and pd_dist >= 10) then
|
||||
pd_dist := 0;
|
||||
-- generate a PD increment: the PD might be either concurrent or not
|
||||
|
|
@ -377,9 +377,9 @@ begin -- architecture behav
|
|||
wait until clk = '1' and clk'event;
|
||||
when others => null;
|
||||
end case;
|
||||
pd_in <= '1';
|
||||
pd_in <= '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '0';
|
||||
pd_in <= '0';
|
||||
end if;
|
||||
pd_dist := pd_dist + 1;
|
||||
rand_time := rv.RandInt(-25, 25) * (10 ns);
|
||||
|
|
@ -448,7 +448,7 @@ begin -- architecture behav
|
|||
begin
|
||||
sent_packets <= 0;
|
||||
injected_errors <= 0;
|
||||
last_inj_err := 0;
|
||||
last_inj_err := 0;
|
||||
if (running /= true) then
|
||||
wait until running = true;
|
||||
end if;
|
||||
|
|
@ -456,30 +456,30 @@ begin -- architecture behav
|
|||
while running loop
|
||||
wait until symbol_valid = '1' and symbol_valid'event;
|
||||
sent_packets <= sent_packets + 1;
|
||||
if(last_inj_err > 0) then
|
||||
if (last_inj_err > 0) then
|
||||
last_inj_err := last_inj_err - 1;
|
||||
end if;
|
||||
if (last_inj_err = 0 and rv.RandInt(1, 10000) < integer(INJECT_ERROR_PERC*100.0)) then
|
||||
if (last_inj_err = 0 and rv.RandInt(1, 10000) < integer(INJECT_ERROR_PERC * 100.0)) then
|
||||
-- Select the type of error to inject: The error type distribution is
|
||||
-- as follows:
|
||||
-- 80% of data errors, including errors on the parity-bit
|
||||
-- 10% of start-bit errors
|
||||
-- 10% of stop-bit errors
|
||||
last_inj_err := 5;
|
||||
et_sel := rv_et.RandInt(1, 100);
|
||||
if(et_sel < 80) then
|
||||
et_sel := rv_et.RandInt(1, 100);
|
||||
if (et_sel < 80) then
|
||||
injected_error_type <= DATA_ERROR;
|
||||
-- Inject an error:
|
||||
-- Number of bits to flip in the tx word
|
||||
bit_flips := rv.RandInt(1, 3);
|
||||
bit_flips := rv.RandInt(1, 3);
|
||||
--bit_flips := 2;
|
||||
b0 := rv.RandInt(0, SYMBOL_LEN);
|
||||
exclude_1(0) := b0;
|
||||
b1 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_1);
|
||||
exclude_2 := (0 => b0, 1 => b1);
|
||||
b2 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_2);
|
||||
flip_vect := (others => '0');
|
||||
flip_vect(b0) := '1';
|
||||
b0 := rv.RandInt(0, SYMBOL_LEN);
|
||||
exclude_1(0) := b0;
|
||||
b1 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_1);
|
||||
exclude_2 := (0 => b0, 1 => b1);
|
||||
b2 := rv.RandInt(min => 0, max => SYMBOL_LEN, exclude => exclude_2);
|
||||
flip_vect := (others => '0');
|
||||
flip_vect(b0) := '1';
|
||||
if (bit_flips >= 2) then
|
||||
flip_vect(b1) := '1';
|
||||
end if;
|
||||
|
|
@ -491,44 +491,45 @@ begin -- architecture behav
|
|||
flip_vect := (others => '0');
|
||||
end if;
|
||||
log("bit-flip = " & to_string(bit_flips) & ", flip_vect = " & to_string(flip_vect) & ".", VLOW);
|
||||
symbol <= force symbol xor flip_vect;
|
||||
injected_errors <= injected_errors + 1;
|
||||
symbol <= force symbol xor flip_vect;
|
||||
injected_errors <= injected_errors + 1;
|
||||
wait until clk = '1' and clk'event;
|
||||
wait until clk = '1' and clk'event;
|
||||
symbol <= release;
|
||||
last_flip := flip_vect;
|
||||
|
||||
elsif(et_sel < 90) then
|
||||
last_flip := (others => '0');
|
||||
symbol <= release;
|
||||
last_flip := flip_vect;
|
||||
|
||||
elsif (et_sel < 90) then
|
||||
last_flip := (others => '0');
|
||||
injected_error_type <= START_BIT_ERROR;
|
||||
-- Directly force tx_data to low for some time
|
||||
sbe_len := rv_et.RandInt(3, 10);
|
||||
injected_errors <= injected_errors + 1;
|
||||
-- goes low one clock cycle (i.e. half a "bit") early and stays there while the shifting continues
|
||||
sbe_len := 2;
|
||||
injected_errors <= injected_errors + 1;
|
||||
log("Injected error on the UART Start-Bit.", VLOW);
|
||||
tx_data <= force '0';
|
||||
tx_data <= force '0';
|
||||
for i in 1 to sbe_len loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- i
|
||||
tx_data <= release;
|
||||
end loop; -- i
|
||||
tx_data <= release;
|
||||
else
|
||||
last_flip := (others => '0');
|
||||
last_flip := (others => '0');
|
||||
injected_error_type <= STOP_BIT_ERROR;
|
||||
-- To create an error on the UART stop-bit, force to zero the signal
|
||||
-- used to switch tx_data to high, at the end of the message
|
||||
uart_tx_set_tx_data <= force '0';
|
||||
sbe_len := rv_et.RandInt(20, 25);
|
||||
sbe_len := 22;
|
||||
for i in 1 to sbe_len loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- i
|
||||
end loop; -- i
|
||||
-- issue the stop bit
|
||||
uart_tx_set_tx_data <= force '1';
|
||||
wait until clk = '1' and clk'event;
|
||||
uart_tx_set_tx_data <= force '0';
|
||||
wait until clk = '1' and clk'event;
|
||||
uart_tx_set_tx_data <= release;
|
||||
injected_errors <= injected_errors + 1;
|
||||
injected_errors <= injected_errors + 1;
|
||||
log("Injected error on the UART Stop-Bit.", VLOW);
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
last_flip := (others => '0');
|
||||
end if;
|
||||
|
|
@ -555,7 +556,7 @@ begin -- architecture behav
|
|||
dir_err <= '0';
|
||||
elsif (dir_discr_cnt > DISCR_THRES) then
|
||||
dir_err <= '1';
|
||||
if(error_logged = false) then
|
||||
if (error_logged = false) then
|
||||
log("ERROR: Detected Discrepancy in the Direction: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
|
||||
error_logged := true;
|
||||
end if;
|
||||
|
|
@ -579,7 +580,7 @@ begin -- architecture behav
|
|||
pd_err <= '0';
|
||||
elsif (pd_discr_cnt > DISCR_THRES) then
|
||||
pd_err <= '1';
|
||||
if(error_logged = false) then
|
||||
if (error_logged = false) then
|
||||
log("ERROR: Misaligned PD count: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
|
||||
error_logged := true;
|
||||
end if;
|
||||
|
|
@ -593,7 +594,7 @@ begin -- architecture behav
|
|||
pos_err <= '0';
|
||||
elsif (pos_discr_cnt > DISCR_THRES) then
|
||||
pos_err <= '1';
|
||||
if(error_logged = false) then
|
||||
if (error_logged = false) then
|
||||
log("ERROR: Misaligned in the Absolute-Position: Discrepancy Count bigger than " & to_string(DISCR_THRES) & ".", VLOW);
|
||||
error_logged := true;
|
||||
end if;
|
||||
|
|
@ -609,11 +610,11 @@ begin -- architecture behav
|
|||
elsif (end_of_swathe = '1' and enc_pulse_cnt /= SWATHE_LEN) then
|
||||
enc_err <= '1';
|
||||
end if;
|
||||
if(reset_n = '0') then
|
||||
if (reset_n = '0') then
|
||||
ps_err <= '0';
|
||||
elsif(running = true and ps_flip_cnt = integer(0.9*real(PS_SWITCH_PER)) and print_start_out /= print_start_in) then
|
||||
elsif (running = true and ps_flip_cnt = integer(0.9 * real(PS_SWITCH_PER)) and print_start_out /= print_start_in) then
|
||||
ps_err <= '1';
|
||||
if(error_logged = false) then
|
||||
if (error_logged = false) then
|
||||
log("ERROR: Print-Start error.", VLOW);
|
||||
error_logged := true;
|
||||
end if;
|
||||
|
|
@ -653,10 +654,10 @@ begin -- architecture behav
|
|||
begin
|
||||
if (reset_n = '0') then
|
||||
detected_error <= false;
|
||||
error_logged := false;
|
||||
error_logged := false;
|
||||
elsif (clk = '1' and clk'event) then
|
||||
if (ovfl_err = '1' or dir_err = '1' or pd_err = '1' or pos_err = '1' or ps_err = '1') then
|
||||
if(ovfl_err = '1') then
|
||||
if (ovfl_err = '1') then
|
||||
log("ERROR: Detected Overflow Error.", VLOW);
|
||||
end if;
|
||||
detected_error <= true;
|
||||
|
|
|
|||
|
|
@ -1,246 +1,271 @@
|
|||
[{
|
||||
"ip_name": "som_ctrl_1",
|
||||
"bus": "csr",
|
||||
"addr_width" : "6",
|
||||
"description": "SOM Controller IP",
|
||||
"addr_hi_bit" : "6",
|
||||
"addr_lo_bit" : "5",
|
||||
"sub_blocks": {
|
||||
"local": {
|
||||
"instance": "",
|
||||
"process": "enabled",
|
||||
"offset": "0x0"
|
||||
},
|
||||
"swim_2": {
|
||||
"instance": "iSWIM_MNG",
|
||||
"process": "enabled",
|
||||
"offset": "0x20"
|
||||
}
|
||||
},
|
||||
"registers": {
|
||||
"ip_id" : {
|
||||
"address" : "0",
|
||||
"width" : "32",
|
||||
"description" : "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x0F",
|
||||
"description" : "IP identifier number"
|
||||
},
|
||||
"mfr_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0xff",
|
||||
"description" : "Manufacturer number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip_ver" : {
|
||||
"address" : "1",
|
||||
"width" : "32",
|
||||
"description" : "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
|
||||
"fields": {
|
||||
"minor_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"description" : "Minor number"
|
||||
},
|
||||
"major_number" : {
|
||||
"type" : "c",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0x01",
|
||||
"description" : "Major number"
|
||||
|
||||
},
|
||||
"reserved" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "16",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"power_good_status": {
|
||||
"address": "2",
|
||||
"width": "3",
|
||||
"description": "",
|
||||
"fields": {
|
||||
"p_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_good pin status"
|
||||
},
|
||||
"p_in_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_in_good pin status"
|
||||
},
|
||||
"p_host_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_host_good pin status"
|
||||
}
|
||||
[
|
||||
{
|
||||
"ip_name": "som_ctrl_1",
|
||||
"bus": "csr",
|
||||
"addr_width": "6",
|
||||
"description": "SOM Controller IP",
|
||||
"addr_hi_bit": "6",
|
||||
"addr_lo_bit": "5",
|
||||
"sub_blocks": {
|
||||
"local": {
|
||||
"instance": "",
|
||||
"process": "enabled",
|
||||
"offset": "0x0"
|
||||
},
|
||||
"swim_2": {
|
||||
"instance": "iSWIM_MNG",
|
||||
"process": "enabled",
|
||||
"offset": "0x20"
|
||||
}
|
||||
},
|
||||
"host_power_control": {
|
||||
"address": "3",
|
||||
"width": "7",
|
||||
"description": "",
|
||||
"fields": {
|
||||
"host_pwr_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_pwr_en pin"
|
||||
},
|
||||
"host_5v_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_5v_en pin"
|
||||
},
|
||||
"host_3v3_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_3v3_en pin"
|
||||
},
|
||||
"host_2v5_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_2v5_en pin"
|
||||
},
|
||||
"host_1v5_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v5_en pin"
|
||||
},
|
||||
"host_1v2_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v2_en pin"
|
||||
},
|
||||
"host_1v1_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v1_en pin"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_sel": {
|
||||
"address": "4",
|
||||
"width": "32",
|
||||
"description": "Monitoring Points selection",
|
||||
"fields": {
|
||||
"mp_0_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-0"
|
||||
},
|
||||
"mp_0_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-0, 1 => MP-0 output three-stated"
|
||||
},
|
||||
"mp_1_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-1"
|
||||
},
|
||||
"mp_1_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-1, 1 => MP-1 output three-stated"
|
||||
},
|
||||
"mp_2_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-2"
|
||||
},
|
||||
"mp_2_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-2, 1 => MP-2 output three-stated"
|
||||
},
|
||||
"mp_3_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-3"
|
||||
},
|
||||
"mp_3_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-3, 1 => MP-3 output three-stated"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_stretch": {
|
||||
"address": "5",
|
||||
"width": "4",
|
||||
"reset": "0x0",
|
||||
"type": "w",
|
||||
"description": "Monitoring Points Stretch-Pulse enable"
|
||||
},
|
||||
"som_led": {
|
||||
"type": "w",
|
||||
"address": "6",
|
||||
"reset": "0x00",
|
||||
"width": "5",
|
||||
"description": "SOM LEDs value"
|
||||
},
|
||||
"stm8_ift": {
|
||||
"address": "7",
|
||||
"width": "9",
|
||||
"description": "STM8 interface",
|
||||
"fields": {
|
||||
"stm8_trigger_rx": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "stm8_trigger_rx"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "rsv",
|
||||
"bit_len": "7",
|
||||
"description": "Reserved bits"
|
||||
},
|
||||
"stm8_alert_tx": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "stm8_alert_tx"
|
||||
}
|
||||
},
|
||||
"registers": {
|
||||
"ip_id": {
|
||||
"address": "0",
|
||||
"width": "32",
|
||||
"description": "Unique ID for this IP block",
|
||||
"fields": {
|
||||
"ip_number": {
|
||||
"type": "c",
|
||||
"bit_len": "8",
|
||||
"reset": "0x0F",
|
||||
"description": "IP identifier number"
|
||||
},
|
||||
"mfr_number": {
|
||||
"type": "c",
|
||||
"bit_len": "8",
|
||||
"reset": "0xff",
|
||||
"description": "Manufacturer number"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "rsv",
|
||||
"bit_len": "16",
|
||||
"description": "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip_ver": {
|
||||
"address": "1",
|
||||
"width": "32",
|
||||
"description": "Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.",
|
||||
"fields": {
|
||||
"minor_number": {
|
||||
"type": "c",
|
||||
"bit_len": "8",
|
||||
"reset": "0x02",
|
||||
"description": "Minor number"
|
||||
},
|
||||
"major_number": {
|
||||
"type": "c",
|
||||
"bit_len": "8",
|
||||
"reset": "0x01",
|
||||
"description": "Major number"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "rsv",
|
||||
"bit_len": "16",
|
||||
"description": "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"power_good_status": {
|
||||
"address": "2",
|
||||
"width": "3",
|
||||
"description": "",
|
||||
"fields": {
|
||||
"p_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_good pin status"
|
||||
},
|
||||
"p_in_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_in_good pin status"
|
||||
},
|
||||
"p_host_good": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "U",
|
||||
"description": "p_host_good pin status"
|
||||
}
|
||||
}
|
||||
},
|
||||
"host_power_control": {
|
||||
"address": "3",
|
||||
"width": "7",
|
||||
"description": "",
|
||||
"fields": {
|
||||
"host_pwr_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_pwr_en pin"
|
||||
},
|
||||
"host_5v_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_5v_en pin"
|
||||
},
|
||||
"host_3v3_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_3v3_en pin"
|
||||
},
|
||||
"host_2v5_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_2v5_en pin"
|
||||
},
|
||||
"host_1v5_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v5_en pin"
|
||||
},
|
||||
"host_1v2_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v2_en pin"
|
||||
},
|
||||
"host_1v1_en": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "drives host_1v1_en pin"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_sel": {
|
||||
"address": "4",
|
||||
"width": "32",
|
||||
"description": "Monitoring Points selection",
|
||||
"fields": {
|
||||
"mp_0_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-0"
|
||||
},
|
||||
"mp_0_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-0, 1 => MP-0 output three-stated"
|
||||
},
|
||||
"mp_1_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-1"
|
||||
},
|
||||
"mp_1_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-1, 1 => MP-1 output three-stated"
|
||||
},
|
||||
"mp_2_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-2"
|
||||
},
|
||||
"mp_2_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-2, 1 => MP-2 output three-stated"
|
||||
},
|
||||
"mp_3_sel": {
|
||||
"type": "w",
|
||||
"bit_len": "7",
|
||||
"reset": "0x0",
|
||||
"description": "source selection for MP-3"
|
||||
},
|
||||
"mp_3_drive_n": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x1",
|
||||
"description": "0 => Driving MP-3, 1 => MP-3 output three-stated"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_stretch": {
|
||||
"address": "5",
|
||||
"width": "4",
|
||||
"reset": "0x0",
|
||||
"type": "w",
|
||||
"description": "Monitoring Points Stretch-Pulse enable"
|
||||
},
|
||||
"som_led": {
|
||||
"type": "w",
|
||||
"address": "6",
|
||||
"reset": "0x00",
|
||||
"width": "5",
|
||||
"description": "SOM LEDs value"
|
||||
},
|
||||
"stm8_ift": {
|
||||
"address": "7",
|
||||
"width": "9",
|
||||
"description": "STM8 interface",
|
||||
"fields": {
|
||||
"stm8_trigger_rx": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "stm8_trigger_rx"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "rsv",
|
||||
"bit_len": "7",
|
||||
"description": "Reserved bits"
|
||||
},
|
||||
"stm8_alert_tx": {
|
||||
"type": "r",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "stm8_alert_tx"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_pin_sel": {
|
||||
"type": "w",
|
||||
"address": "8",
|
||||
"reset": "0x0",
|
||||
"width": "1",
|
||||
"description": "Rewire Monitoring Points pins to SOM header J5 (Debug)"
|
||||
},
|
||||
"som_group_d_led": {
|
||||
"address": "9",
|
||||
"width": "3",
|
||||
"description": "SOM Group D LEDs value",
|
||||
"fields": {
|
||||
"LED_R": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "Active Low Group D Red LED"
|
||||
},
|
||||
"LED_Y": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "Active Low Group D Yellow LED"
|
||||
},
|
||||
"LED_G": {
|
||||
"type": "w",
|
||||
"bit_len": "1",
|
||||
"reset": "0x0",
|
||||
"description": "Active Low Group D Green LED"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mon_pt_pin_sel": {
|
||||
"type": "w",
|
||||
"address": "8",
|
||||
"reset": "0x0",
|
||||
"width": "1",
|
||||
"description": "Rewire Monitoring Points pins to SOM header J5 (Debug)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
]
|
||||
|
|
@ -20,60 +20,64 @@ library ieee;
|
|||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.som_ctrl_1_pkg.all;
|
||||
|
||||
|
||||
entity som_ctrl_1 is
|
||||
port (
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
port(
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
-- Avalon-MM I/F
|
||||
avs_address : in std_logic_vector( 5 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0);
|
||||
avs_address : in std_logic_vector(5 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
avs_readdatavalid : out std_logic;
|
||||
avs_readdata : out std_logic_vector(31 downto 0);
|
||||
-- SOM Specific I/Fs:
|
||||
som_mon_pt_pin_rewire : out std_logic;
|
||||
som_mon_pt_en : out std_logic_vector( 3 downto 0); -- SOM Timing Output enable
|
||||
som_mon_pt : out std_logic_vector( 3 downto 0); -- SOM Timing I/Os
|
||||
mon_pt_src : in std_logic_vector(31 downto 0); -- Source signals for the SOM monitoring points
|
||||
som_mon_pt_pin_rewire : out std_logic;
|
||||
som_mon_pt_en : out std_logic_vector(3 downto 0); -- SOM Timing Output enable
|
||||
som_mon_pt : out std_logic_vector(3 downto 0); -- SOM Timing I/Os
|
||||
mon_pt_src : in std_logic_vector(31 downto 0); -- Source signals for the SOM monitoring points
|
||||
-- STM8 & swim
|
||||
stm8_alert_tx : in std_logic;
|
||||
stm8_trigger_rx : out std_logic;
|
||||
swim_tx : out std_logic;
|
||||
swim_rx : in std_logic;
|
||||
stm8_alert_tx : in std_logic;
|
||||
stm8_trigger_rx : out std_logic;
|
||||
swim_tx : out std_logic;
|
||||
swim_rx : in std_logic;
|
||||
-- SOM Miscellaneous I/Os
|
||||
p_good : in std_logic;
|
||||
p_in_good : in std_logic;
|
||||
p_host_good : in std_logic;
|
||||
host_pwr_en : out std_logic;
|
||||
host_5v_en : out std_logic;
|
||||
host_3v3_en : out std_logic;
|
||||
host_2v5_en : out std_logic;
|
||||
host_1v5_en : out std_logic;
|
||||
host_1v2_en : out std_logic;
|
||||
host_1v1_en : out std_logic;
|
||||
-- SOM LEDs
|
||||
som_led : out std_logic_vector(5 downto 1));
|
||||
p_good : in std_logic;
|
||||
p_in_good : in std_logic;
|
||||
p_host_good : in std_logic;
|
||||
host_pwr_en : out std_logic;
|
||||
host_5v_en : out std_logic;
|
||||
host_3v3_en : out std_logic;
|
||||
host_2v5_en : out std_logic;
|
||||
host_1v5_en : out std_logic;
|
||||
host_1v2_en : out std_logic;
|
||||
host_1v1_en : out std_logic;
|
||||
-- SOM Group D LEDs section
|
||||
n_group_d_led_g : out std_logic;
|
||||
n_group_d_led_y : out std_logic;
|
||||
n_group_d_led_r : out std_logic;
|
||||
-- SOM DEBUG LEDs
|
||||
som_led : out std_logic_vector(5 downto 1));
|
||||
|
||||
end entity som_ctrl_1;
|
||||
|
||||
architecture rtl of som_ctrl_1 is
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF0F";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000101";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000102";
|
||||
|
||||
signal ctrl_write, ctrl_read : std_logic;
|
||||
signal swim_write, swim_read, swim_read_d : std_logic;
|
||||
signal avs_read_d : std_logic;
|
||||
signal mon_pt_pin_rewire : std_logic;
|
||||
signal avs_addr : std_logic_vector( 3 downto 0);
|
||||
signal swim_addr, mp_stretch_en : std_logic_vector( 3 downto 0);
|
||||
signal mon_pt_i, mon_pt_ii : std_logic_vector( 3 downto 0);
|
||||
signal mon_pt_sel_0, mon_pt_sel_1 : std_logic_vector( 7 downto 0);
|
||||
signal mon_pt_sel_2, mon_pt_sel_3 : std_logic_vector( 7 downto 0);
|
||||
signal avs_addr : std_logic_vector(3 downto 0);
|
||||
signal swim_addr, mp_stretch_en : std_logic_vector(3 downto 0);
|
||||
signal mon_pt_i, mon_pt_ii : std_logic_vector(3 downto 0);
|
||||
signal mon_pt_sel_0, mon_pt_sel_1 : std_logic_vector(7 downto 0);
|
||||
signal mon_pt_sel_2, mon_pt_sel_3 : std_logic_vector(7 downto 0);
|
||||
signal swim_writedata, swim_readdata : std_logic_vector(31 downto 0);
|
||||
signal avs_readdata_i : std_logic_vector(31 downto 0);
|
||||
|
||||
|
|
@ -83,10 +87,10 @@ begin
|
|||
-- SWIM I/F
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iSWIM_MNG: entity work.swim_2
|
||||
generic map (
|
||||
iSWIM_MNG : entity work.swim_2
|
||||
generic map(
|
||||
CLK_FREQ_MHZ => 100)
|
||||
port map (
|
||||
port map(
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
avs_address => swim_addr,
|
||||
|
|
@ -101,13 +105,13 @@ begin
|
|||
-----------------------------------------------------------------------------
|
||||
-- MOnitoring Points
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
som_mon_pt_pin_rewire <= mon_pt_pin_rewire;
|
||||
--
|
||||
som_mon_pt_en(0) <= not mon_pt_sel_0(7);
|
||||
som_mon_pt_en(1) <= not mon_pt_sel_1(7);
|
||||
som_mon_pt_en(2) <= not mon_pt_sel_2(7);
|
||||
som_mon_pt_en(3) <= not mon_pt_sel_3(7);
|
||||
som_mon_pt_en(0) <= not mon_pt_sel_0(7);
|
||||
som_mon_pt_en(1) <= not mon_pt_sel_1(7);
|
||||
som_mon_pt_en(2) <= not mon_pt_sel_2(7);
|
||||
som_mon_pt_en(3) <= not mon_pt_sel_3(7);
|
||||
|
||||
-- Monitoring Point selection
|
||||
mon_pt_ii(0) <= mon_pt_src(to_integer(unsigned(mon_pt_sel_0(4 downto 0))));
|
||||
|
|
@ -118,16 +122,16 @@ begin
|
|||
-- Pulse stretching
|
||||
gMP_STRETCH : for n in 0 to 3 generate
|
||||
|
||||
iSTRETCH: entity work.stretch_pulse
|
||||
generic map (
|
||||
iSTRETCH : entity work.stretch_pulse
|
||||
generic map(
|
||||
pulse_polarity => 0,
|
||||
ext_pulse_width => 25)
|
||||
port map (
|
||||
port map(
|
||||
rstN => reset_n,
|
||||
clk => clk,
|
||||
pulse_in => mon_pt_ii(n),
|
||||
pulse_out => mon_pt_i(n));
|
||||
|
||||
|
||||
end generate gMP_STRETCH;
|
||||
|
||||
som_mon_pt(0) <= mon_pt_ii(0) when mp_stretch_en(0) = '0' else mon_pt_i(0);
|
||||
|
|
@ -144,81 +148,91 @@ begin
|
|||
swim_writedata <= avs_writedata;
|
||||
|
||||
swim_write <= '1' when avs_write = '1' and avs_address(5) = '1' else '0';
|
||||
swim_read <= '1' when avs_read = '1' and avs_address(5) = '1' else '0';
|
||||
swim_read <= '1' when avs_read = '1' and avs_address(5) = '1' else '0';
|
||||
|
||||
ctrl_write <= '1' when avs_write = '1' and avs_address(5) = '0' else '0';
|
||||
ctrl_read <= '1' when avs_read = '1' and avs_address(5) = '0' else '0';
|
||||
|
||||
avs_addr <= avs_address(3 downto 0);
|
||||
|
||||
pCTRL_STATUS : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
if (reset_n = '0') then
|
||||
avs_readdatavalid <= '0';
|
||||
--
|
||||
host_pwr_en <= '0';
|
||||
host_5v_en <= '0';
|
||||
host_3v3_en <= '0';
|
||||
host_2v5_en <= '0';
|
||||
host_1v5_en <= '0';
|
||||
host_1v2_en <= '0';
|
||||
host_1v1_en <= '0';
|
||||
host_pwr_en <= '0';
|
||||
host_5v_en <= '0';
|
||||
host_3v3_en <= '0';
|
||||
host_2v5_en <= '0';
|
||||
host_1v5_en <= '0';
|
||||
host_1v2_en <= '0';
|
||||
host_1v1_en <= '0';
|
||||
--
|
||||
stm8_trigger_rx <= '0';
|
||||
stm8_trigger_rx <= '0';
|
||||
--
|
||||
mon_pt_sel_0 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_1 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_2 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_3 <= (7 => '1', others => '0');
|
||||
mp_stretch_en <= (others => '0');
|
||||
mon_pt_sel_0 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_1 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_2 <= (7 => '1', others => '0');
|
||||
mon_pt_sel_3 <= (7 => '1', others => '0');
|
||||
mp_stretch_en <= (others => '0');
|
||||
--
|
||||
mon_pt_pin_rewire <= '0';
|
||||
|
||||
--
|
||||
som_led <= (others => '0');
|
||||
elsif(clk = '1' and clk'event) then
|
||||
|
||||
--
|
||||
n_group_d_led_g <= '0'; -- default all group d LEDs on to match other products
|
||||
n_group_d_led_y <= '0';
|
||||
n_group_d_led_r <= '0';
|
||||
som_led <= (others => '0');
|
||||
elsif (clk = '1' and clk'event) then
|
||||
-- CTRL registers
|
||||
if(avs_write = '1') then
|
||||
if (ctrl_write = '1') then
|
||||
case avs_addr is
|
||||
when CSR_HOST_PWR_ADDR =>
|
||||
host_pwr_en <= avs_writedata(0);
|
||||
host_5v_en <= avs_writedata(1);
|
||||
host_3v3_en <= avs_writedata(2);
|
||||
host_2v5_en <= avs_writedata(3);
|
||||
host_1v5_en <= avs_writedata(4);
|
||||
host_1v2_en <= avs_writedata(5);
|
||||
host_1v1_en <= avs_writedata(6);
|
||||
host_pwr_en <= avs_writedata(0);
|
||||
host_5v_en <= avs_writedata(1);
|
||||
host_3v3_en <= avs_writedata(2);
|
||||
host_2v5_en <= avs_writedata(3);
|
||||
host_1v5_en <= avs_writedata(4);
|
||||
host_1v2_en <= avs_writedata(5);
|
||||
host_1v1_en <= avs_writedata(6);
|
||||
when CSR_MON_PT_SEL_ADDR =>
|
||||
mon_pt_sel_0 <= avs_writedata( 7 downto 0);
|
||||
mon_pt_sel_1 <= avs_writedata(15 downto 8);
|
||||
mon_pt_sel_2 <= avs_writedata(23 downto 16);
|
||||
mon_pt_sel_3 <= avs_writedata(31 downto 24);
|
||||
mon_pt_sel_0 <= avs_writedata(7 downto 0);
|
||||
mon_pt_sel_1 <= avs_writedata(15 downto 8);
|
||||
mon_pt_sel_2 <= avs_writedata(23 downto 16);
|
||||
mon_pt_sel_3 <= avs_writedata(31 downto 24);
|
||||
when CSR_MON_PT_STRETCH_ADDR =>
|
||||
mp_stretch_en <= avs_writedata( 3 downto 0);
|
||||
mp_stretch_en <= avs_writedata(3 downto 0);
|
||||
when CSR_SOM_LED_ADDR =>
|
||||
som_led <= avs_writedata( 4 downto 0);
|
||||
som_led <= avs_writedata(4 downto 0);
|
||||
when CSR_STM8_ADDR =>
|
||||
stm8_trigger_rx <= avs_writedata(0);
|
||||
when CSR_MON_PT_PIN_SEL =>
|
||||
when CSR_MON_PT_PIN_SEL_ADDR =>
|
||||
mon_pt_pin_rewire <= avs_writedata(0);
|
||||
when CSR_SOM_GROUP_D_LED_ADDR =>
|
||||
n_group_d_led_r <= avs_writedata(0);
|
||||
n_group_d_led_y <= avs_writedata(1);
|
||||
n_group_d_led_g <= avs_writedata(2);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
|
||||
-- Read Ctrl & Status registers
|
||||
if(avs_read = '1') then
|
||||
if (ctrl_read = '1') then
|
||||
case avs_addr is
|
||||
when CSR_IP_ID_ADDR =>
|
||||
avs_readdata_i <= CSR_IP_ID;
|
||||
when CSR_IP_VER_ADDR =>
|
||||
when CSR_IP_VER_ADDR =>
|
||||
avs_readdata_i <= CSR_IP_VER;
|
||||
when CSR_PWR_GOOD_ADDR =>
|
||||
when CSR_PWR_GOOD_ADDR =>
|
||||
avs_readdata_i <= (0 => p_good, 1 => p_in_good, 2 => p_host_good, others => '0');
|
||||
when CSR_HOST_PWR_ADDR =>
|
||||
avs_readdata_i(0) <= host_pwr_en;
|
||||
avs_readdata_i(1) <= host_5v_en;
|
||||
avs_readdata_i(2) <= host_3v3_en;
|
||||
avs_readdata_i(3) <= host_2v5_en;
|
||||
avs_readdata_i(4) <= host_1v5_en;
|
||||
avs_readdata_i(5) <= host_1v2_en;
|
||||
avs_readdata_i(6) <= host_1v1_en;
|
||||
avs_readdata_i(0) <= host_pwr_en;
|
||||
avs_readdata_i(1) <= host_5v_en;
|
||||
avs_readdata_i(2) <= host_3v3_en;
|
||||
avs_readdata_i(3) <= host_2v5_en;
|
||||
avs_readdata_i(4) <= host_1v5_en;
|
||||
avs_readdata_i(5) <= host_1v2_en;
|
||||
avs_readdata_i(6) <= host_1v1_en;
|
||||
avs_readdata_i(31 downto 7) <= (others => '0');
|
||||
when CSR_MON_PT_SEL_ADDR =>
|
||||
avs_readdata_i <= mon_pt_sel_3 & mon_pt_sel_2 & mon_pt_sel_1 & mon_pt_sel_0;
|
||||
|
|
@ -228,16 +242,18 @@ begin
|
|||
avs_readdata_i <= 27x"0" & som_led;
|
||||
when CSR_STM8_ADDR =>
|
||||
avs_readdata_i <= (0 => stm8_trigger_rx, 8 => stm8_alert_tx, others => '0');
|
||||
when CSR_MON_PT_PIN_SEL =>
|
||||
when CSR_MON_PT_PIN_SEL_ADDR =>
|
||||
avs_readdata_i <= (0 => mon_pt_pin_rewire, others => '0');
|
||||
when CSR_SOM_GROUP_D_LED_ADDR =>
|
||||
avs_readdata_i <= 29x"0" & n_group_d_led_g & n_group_d_led_y & n_group_d_led_r;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
end if;
|
||||
-- Output mux between local status registers and the swim if. Adjust
|
||||
-- latency for the read-valid.
|
||||
swim_read_d <= swim_read;
|
||||
if(swim_read_d = '1') then
|
||||
swim_read_d <= swim_read;
|
||||
if (swim_read_d = '1') then
|
||||
avs_readdata <= swim_readdata;
|
||||
else
|
||||
avs_readdata <= avs_readdata_i;
|
||||
|
|
|
|||
|
|
@ -21,17 +21,18 @@ use ieee.numeric_std.all;
|
|||
|
||||
package som_ctrl_1_pkg is
|
||||
|
||||
constant CSR_IP_ID_ADDR : std_logic_vector(3 downto 0) := 4x"0";
|
||||
constant CSR_IP_VER_ADDR : std_logic_vector(3 downto 0) := 4x"1";
|
||||
constant CSR_PWR_GOOD_ADDR : std_logic_vector(3 downto 0) := 4x"2";
|
||||
constant CSR_HOST_PWR_ADDR : std_logic_vector(3 downto 0) := 4x"3";
|
||||
constant CSR_MON_PT_SEL_ADDR : std_logic_vector(3 downto 0) := 4x"4";
|
||||
constant CSR_MON_PT_STRETCH_ADDR : std_logic_vector(3 downto 0) := 4x"5";
|
||||
constant CSR_SOM_LED_ADDR : std_logic_vector(3 downto 0) := 4x"6";
|
||||
constant CSR_STM8_ADDR : std_logic_vector(3 downto 0) := 4x"7";
|
||||
constant CSR_MON_PT_PIN_SEL : std_logic_vector(3 downto 0) := 4x"8";
|
||||
constant CSR_IP_ID_ADDR : std_logic_vector(3 downto 0) := 4x"0";
|
||||
constant CSR_IP_VER_ADDR : std_logic_vector(3 downto 0) := 4x"1";
|
||||
constant CSR_PWR_GOOD_ADDR : std_logic_vector(3 downto 0) := 4x"2";
|
||||
constant CSR_HOST_PWR_ADDR : std_logic_vector(3 downto 0) := 4x"3";
|
||||
constant CSR_MON_PT_SEL_ADDR : std_logic_vector(3 downto 0) := 4x"4";
|
||||
constant CSR_MON_PT_STRETCH_ADDR : std_logic_vector(3 downto 0) := 4x"5";
|
||||
constant CSR_SOM_LED_ADDR : std_logic_vector(3 downto 0) := 4x"6";
|
||||
constant CSR_STM8_ADDR : std_logic_vector(3 downto 0) := 4x"7";
|
||||
constant CSR_MON_PT_PIN_SEL_ADDR : std_logic_vector(3 downto 0) := 4x"8";
|
||||
constant CSR_SOM_GROUP_D_LED_ADDR : std_logic_vector(3 downto 0) := 4x"9";
|
||||
|
||||
-- offset for the SWIM interface subblock
|
||||
constant CSR_SWIM_IF_OFFSET : std_logic_vector(5 downto 0) := 6x"20";
|
||||
constant CSR_SWIM_IF_OFFSET : std_logic_vector(5 downto 0) := 6x"20";
|
||||
|
||||
end package som_ctrl_1_pkg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue