DHBKM1024I-8 Added link crc error registers
This commit is contained in:
parent
e4c48fb8b9
commit
15911f2dcc
16 changed files with 970 additions and 349 deletions
|
|
@ -21,7 +21,7 @@ script {
|
|||
// Tools (tag on master)
|
||||
env.FW_DEV_TOOL_BRANCH = "refs/tags/ELGIP_2020_02_12_A_SS"
|
||||
// Generic IP
|
||||
env.GENERIC_IP_BRANCH = "refs/tags/ELGIP_2020_02_17_A_SS"
|
||||
env.GENERIC_IP_BRANCH = "refs/tags/KM1024i_2020_05_15_A_CS"
|
||||
// MinGW
|
||||
env.MINGW_REPO = "git@hydra:GIS_Embedded_Logic/mingw.git"
|
||||
env.MINGW_BRANCH = "origin/master"
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ entity pixel_buffer_0 IS
|
|||
|
||||
ip_id_ip_number : out std_logic_vector( 7 downto 0) := 8x"1c";
|
||||
ip_id_mfr_number : out std_logic_vector( 7 downto 0) := 8x"00";
|
||||
ip_ver_minor_number : out std_logic_vector( 7 downto 0) := 8x"02";
|
||||
ip_ver_minor_number : out std_logic_vector( 7 downto 0) := 8x"04";
|
||||
ip_ver_major_number : out std_logic_vector( 7 downto 0) := 8x"00";
|
||||
|
||||
diag_word_count : out std_logic_vector(6 downto 0)
|
||||
|
|
@ -336,10 +336,11 @@ begin
|
|||
end if;
|
||||
|
||||
-- If pixel buffer peeking diags enabled, export the read pointer
|
||||
-- being careful as the diag port is fixed width but rd_ptr is defined by generic
|
||||
-- Note that this will zero-pad or truncate depending on which vector is longer. It's only for diagnostic purposes.
|
||||
diag_peek_rdptr <= (others => '0');
|
||||
if is_en_peek then
|
||||
diag_peek_rdptr <= rd_ptr(0)(7 downto 0);
|
||||
else
|
||||
diag_peek_rdptr <= (others => '0');
|
||||
diag_peek_rdptr <= std_logic_vector(resize(unsigned(rd_ptr(0)), diag_peek_rdptr'length));
|
||||
end if;
|
||||
|
||||
-- Increment the read pointer for each read request
|
||||
|
|
@ -358,7 +359,7 @@ begin
|
|||
-- Update buffer input state when ever we get a strobe
|
||||
if wr_req_int = '1' and error = '0' then
|
||||
|
||||
-- If the buffer 32 bit word count reached 3*bpp - 1, then rollover to 0
|
||||
-- If the buffer 32 bit word count reached 4*SHIFT_DEPTH/32-1, then rollover to 0
|
||||
if buf_word_count = word_wrap then
|
||||
|
||||
buf_word_count <= (others => '0');
|
||||
|
|
|
|||
|
|
@ -94,6 +94,31 @@ architecture struct of hmb_fpga_top is
|
|||
);
|
||||
end component;
|
||||
|
||||
function crc_calc (
|
||||
crc_in : in std_logic_vector(15 downto 0);
|
||||
data_in : in std_logic_vector( 9 downto 0))
|
||||
return std_logic_vector is
|
||||
variable crc_out : std_logic_vector(15 downto 0);
|
||||
begin
|
||||
crc_out(00) := crc_in(06) xor crc_in(07) xor crc_in(08) xor crc_in(09) xor crc_in(10) xor crc_in(11) xor crc_in(12) xor crc_in(13) xor crc_in(14) xor crc_in(15) xor data_in(00) xor data_in(01) xor data_in(02) xor data_in(03) xor data_in(04) xor data_in(05) xor data_in(06) xor data_in(07) xor data_in(08) xor data_in(09);
|
||||
crc_out(01) := crc_in(07) xor crc_in(08) xor crc_in(09) xor crc_in(10) xor crc_in(11) xor crc_in(12) xor crc_in(13) xor crc_in(14) xor crc_in(15) xor data_in(01) xor data_in(02) xor data_in(03) xor data_in(04) xor data_in(05) xor data_in(06) xor data_in(07) xor data_in(08) xor data_in(09);
|
||||
crc_out(02) := crc_in(06) xor crc_in(07) xor data_in(00) xor data_in(01);
|
||||
crc_out(03) := crc_in(07) xor crc_in(08) xor data_in(01) xor data_in(02);
|
||||
crc_out(04) := crc_in(08) xor crc_in(09) xor data_in(02) xor data_in(03);
|
||||
crc_out(05) := crc_in(09) xor crc_in(10) xor data_in(03) xor data_in(04);
|
||||
crc_out(06) := crc_in(10) xor crc_in(11) xor data_in(04) xor data_in(05);
|
||||
crc_out(07) := crc_in(11) xor crc_in(12) xor data_in(05) xor data_in(06);
|
||||
crc_out(08) := crc_in(12) xor crc_in(13) xor data_in(06) xor data_in(07);
|
||||
crc_out(09) := crc_in(13) xor crc_in(14) xor data_in(07) xor data_in(08);
|
||||
crc_out(10) := crc_in(00) xor crc_in(14) xor crc_in(15) xor data_in(08) xor data_in(09);
|
||||
crc_out(11) := crc_in(01) xor crc_in(15) xor data_in(09);
|
||||
crc_out(12) := crc_in(02);
|
||||
crc_out(13) := crc_in(03);
|
||||
crc_out(14) := crc_in(04);
|
||||
crc_out(15) := crc_in(05) xor crc_in(06) xor crc_in(07) xor crc_in(08) xor crc_in(09) xor crc_in(10) xor crc_in(11) xor crc_in(12) xor crc_in(13) xor crc_in(14) xor crc_in(15) xor data_in(00) xor data_in(01) xor data_in(02) xor data_in(03) xor data_in(04) xor data_in(05) xor data_in(06) xor data_in(07) xor data_in(08) xor data_in(09);
|
||||
return std_logic_vector(crc_out);
|
||||
end function;
|
||||
|
||||
type read_data_t is array (0 to 3) of std_logic_vector(31 downto 0);
|
||||
|
||||
constant CYCLES_PER_US : integer := 99;
|
||||
|
|
@ -107,7 +132,15 @@ architecture struct of hmb_fpga_top is
|
|||
constant I2C_ADDR_LINK_PHMSB : std_logic_vector(15 downto 0) := 16x"0006";
|
||||
constant I2C_ADDR_WD_CTRL : std_logic_vector(15 downto 0) := 16x"0010";
|
||||
constant I2C_ADDR_WD_STATUS : std_logic_vector(15 downto 0) := 16x"0011";
|
||||
|
||||
constant I2C_ADDR_CNT_ERR_L3 : std_logic_vector(15 downto 0) := 16x"0012";
|
||||
constant I2C_ADDR_CNT_ERR_L2 : std_logic_vector(15 downto 0) := 16x"0013";
|
||||
constant I2C_ADDR_CNT_ERR_L1 : std_logic_vector(15 downto 0) := 16x"0014";
|
||||
constant I2C_ADDR_CNT_ERR_L0 : std_logic_vector(15 downto 0) := 16x"0015";
|
||||
constant I2C_ADDR_CNT_ERR_R3 : std_logic_vector(15 downto 0) := 16x"0016";
|
||||
constant I2C_ADDR_CNT_ERR_R2 : std_logic_vector(15 downto 0) := 16x"0017";
|
||||
constant I2C_ADDR_CNT_ERR_R1 : std_logic_vector(15 downto 0) := 16x"0018";
|
||||
constant I2C_ADDR_CNT_ERR_R0 : std_logic_vector(15 downto 0) := 16x"0019";
|
||||
|
||||
constant DVAL_L_POS : integer := 0 + 9;
|
||||
constant LATCH_L_POS : integer := 0 + 5;
|
||||
constant LOAD_L_POS : integer := 0 + 4;
|
||||
|
|
@ -176,6 +209,23 @@ architecture struct of hmb_fpga_top is
|
|||
signal dclka_inj : std_logic_vector(3 downto 0) := "0000";
|
||||
signal dclkb_inj : std_logic_vector(3 downto 0) := "0000";
|
||||
|
||||
signal rx_l_crc : integer range 0 to 16 := 0;
|
||||
signal rx_r_crc : integer range 0 to 16 := 0;
|
||||
signal crc_l_rx : std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal crc_r_rx : std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal crc_l_reg : std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal crc_r_reg : std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal crc_l_loc : std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal crc_r_loc : std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal crc_l_rcvd : std_logic;
|
||||
signal crc_r_rcvd : std_logic;
|
||||
signal crc_l_err : std_logic;
|
||||
signal crc_r_err : std_logic;
|
||||
signal crc_l_ecnt : unsigned(31 downto 0) := (others => '0');
|
||||
signal crc_r_ecnt : unsigned(31 downto 0) := (others => '0');
|
||||
signal crc_l_clr : std_logic_vector(1 downto 0) := "00";
|
||||
signal crc_r_clr : std_logic_vector(1 downto 0) := "00";
|
||||
|
||||
begin
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
|
@ -383,6 +433,8 @@ begin
|
|||
|
||||
-- Cross clock domain
|
||||
link_aligned <= link_aligned(0) & lvds_aligned;
|
||||
crc_l_clr <= crc_l_clr(0) & '0';
|
||||
crc_r_clr <= crc_r_clr(0) & '0';
|
||||
|
||||
-- Write registers
|
||||
if wr_en = '1' then
|
||||
|
|
@ -396,6 +448,14 @@ begin
|
|||
when I2C_ADDR_WD_CTRL => clr_wd <= wr_data(0);
|
||||
en_wd <= wr_data(1);
|
||||
wd_period <= wr_data(5 downto 2);
|
||||
when I2C_ADDR_CNT_ERR_L3 => crc_l_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_L2 => crc_l_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_L1 => crc_l_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_L0 => crc_l_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_R3 => crc_r_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_R2 => crc_r_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_R1 => crc_r_clr <= "11";
|
||||
when I2C_ADDR_CNT_ERR_R0 => crc_r_clr <= "11";
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
|
@ -411,6 +471,14 @@ begin
|
|||
when I2C_ADDR_LINK_PHMSB => rd_data(1 downto 0) <= phase_shift(9 downto 8);
|
||||
when I2C_ADDR_WD_CTRL => rd_data(5 downto 0) <= wd_period & en_wd & clr_wd;
|
||||
when I2C_ADDR_WD_STATUS => rd_data(0) <= wd_alarm;
|
||||
when I2C_ADDR_CNT_ERR_L3 => rd_data(7 downto 0) <= std_logic_vector(crc_l_ecnt(31 downto 24));
|
||||
when I2C_ADDR_CNT_ERR_L2 => rd_data(7 downto 0) <= std_logic_vector(crc_l_ecnt(23 downto 16));
|
||||
when I2C_ADDR_CNT_ERR_L1 => rd_data(7 downto 0) <= std_logic_vector(crc_l_ecnt(15 downto 08));
|
||||
when I2C_ADDR_CNT_ERR_L0 => rd_data(7 downto 0) <= std_logic_vector(crc_l_ecnt(07 downto 00));
|
||||
when I2C_ADDR_CNT_ERR_R3 => rd_data(7 downto 0) <= std_logic_vector(crc_r_ecnt(31 downto 24));
|
||||
when I2C_ADDR_CNT_ERR_R2 => rd_data(7 downto 0) <= std_logic_vector(crc_r_ecnt(23 downto 16));
|
||||
when I2C_ADDR_CNT_ERR_R1 => rd_data(7 downto 0) <= std_logic_vector(crc_r_ecnt(15 downto 08));
|
||||
when I2C_ADDR_CNT_ERR_R0 => rd_data(7 downto 0) <= std_logic_vector(crc_r_ecnt(07 downto 00));
|
||||
when others => rd_data(0) <= '0';
|
||||
end case?;
|
||||
end if;
|
||||
|
|
@ -469,14 +537,22 @@ begin
|
|||
s_r <= data_lvds_rx(DAT_R_RNG);
|
||||
end if;
|
||||
|
||||
latch_l <= data_lvds_rx(LATCH_L_POS);
|
||||
if rx_l_crc = 0 then
|
||||
latch_l <= data_lvds_rx(LATCH_L_POS);
|
||||
else
|
||||
latch_l <= '0';
|
||||
end if;
|
||||
load_l <= data_lvds_rx(LOAD_L_POS);
|
||||
gsclk_l <= data_lvds_rx(GSCLK_L_POS);
|
||||
plstm2_l <= data_lvds_rx(PLSTM2_L_POS);
|
||||
plstm1_l <= data_lvds_rx(PLSTM1_L_POS);
|
||||
stb_l <= data_lvds_rx(STB_L_POS);
|
||||
|
||||
latch_r <= data_lvds_rx(LATCH_R_POS);
|
||||
if rx_r_crc = 0 then
|
||||
latch_r <= data_lvds_rx(LATCH_R_POS);
|
||||
else
|
||||
latch_r <= '0';
|
||||
end if;
|
||||
load_r <= data_lvds_rx(LOAD_R_POS);
|
||||
gsclk_r <= data_lvds_rx(GSCLK_R_POS);
|
||||
plstm2_r <= data_lvds_rx(PLSTM2_R_POS);
|
||||
|
|
@ -498,10 +574,81 @@ begin
|
|||
plstm2_r <= '0';
|
||||
plstm1_r <= '0';
|
||||
stb_r <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
process (clk_lvds_50)
|
||||
begin
|
||||
if rising_edge(clk_lvds_50) then
|
||||
if lvds_aligned = '1' then
|
||||
crc_l_reg <= crc_calc(crc_l_reg, data_lvds_rx( 9 downto 0));
|
||||
crc_r_reg <= crc_calc(crc_r_reg, data_lvds_rx(19 downto 10));
|
||||
crc_l_rcvd<= '0';
|
||||
crc_r_rcvd<= '0';
|
||||
crc_l_err <= '0';
|
||||
crc_r_err <= '0';
|
||||
|
||||
if latch_l = '1' and data_lvds_rx(LATCH_L_POS) = '0' then
|
||||
rx_l_crc <= 16;
|
||||
end if;
|
||||
|
||||
if rx_l_crc /= 0 then
|
||||
if rx_l_crc = 16 then
|
||||
crc_l_reg <= crc_calc(X"0000", data_lvds_rx( 9 downto 0));
|
||||
crc_l_loc <= crc_l_reg;
|
||||
end if;
|
||||
rx_l_crc <= rx_l_crc - 1;
|
||||
crc_l_rx <= crc_l_rx(14 downto 0) & data_lvds_rx(LATCH_L_POS);
|
||||
if rx_l_crc = 1 then
|
||||
crc_l_rcvd <= '1';
|
||||
end if;
|
||||
elsif crc_l_rcvd = '1' then
|
||||
if crc_l_rx /= crc_l_loc then
|
||||
crc_l_err <= '1';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if latch_r = '1' and data_lvds_rx(LATCH_R_POS) = '0' then
|
||||
rx_r_crc <= 16;
|
||||
end if;
|
||||
|
||||
if rx_r_crc /= 0 then
|
||||
if rx_r_crc = 16 then
|
||||
crc_r_reg <= crc_calc(X"0000", data_lvds_rx(19 downto 10));
|
||||
crc_r_loc <= crc_r_reg;
|
||||
end if;
|
||||
rx_r_crc <= rx_r_crc - 1;
|
||||
crc_r_rx <= crc_r_rx(14 downto 0) & data_lvds_rx(LATCH_R_POS);
|
||||
if rx_r_crc = 1 then
|
||||
crc_r_rcvd <= '1';
|
||||
end if;
|
||||
elsif crc_r_rcvd = '1' then
|
||||
if crc_r_rx /= crc_r_loc then
|
||||
crc_r_err <= '1';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if crc_l_err = '1' then
|
||||
crc_l_ecnt <= to_unsigned(to_integer(crc_l_ecnt) + 1, 32);
|
||||
end if;
|
||||
|
||||
if crc_r_err = '1' then
|
||||
crc_r_ecnt <= to_unsigned(to_integer(crc_r_ecnt) + 1, 32);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if crc_l_clr(1) = '1' then
|
||||
crc_l_ecnt <= (others => '0');
|
||||
end if;
|
||||
|
||||
if crc_r_clr(1) = '1' then
|
||||
crc_r_ecnt <= (others => '0');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Use valid signal to generate head clock at 20MHz
|
||||
process (clk_lvds_100)
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -89,33 +89,138 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"cpu_wave_seq_addr0" : {
|
||||
"select_head01phase" : {
|
||||
"address" : "2",
|
||||
"width" : "8",
|
||||
"type" : "w",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 0"
|
||||
"width" : "32",
|
||||
"description" : "FPM Phase selection heads 0-1",
|
||||
"fields" : {
|
||||
"shead00" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0",
|
||||
"description" : "FPM phase to use for head 0 sub head 0"
|
||||
},
|
||||
"reserved0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"shead01" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "1",
|
||||
"description" : "FPM phase to use for head 0 sub head 1"
|
||||
},
|
||||
"reserved1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"shead10" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0",
|
||||
"description" : "FPM phase to use for head 1 sub head 0"
|
||||
},
|
||||
"reserved2" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"shead11" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "1",
|
||||
"description" : "FPM phase to use for head 1 sub head 1"
|
||||
},
|
||||
"reserved3" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cpu_wave_seq_addr1" : {
|
||||
"select_head23phase" : {
|
||||
"address" : "3",
|
||||
"width" : "8",
|
||||
"type" : "w",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 1"
|
||||
"width" : "32",
|
||||
"description" : "FPM Phase selection heads 2-3",
|
||||
"fields" : {
|
||||
"shead20" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0",
|
||||
"description" : "FPM phase to use for head 2 sub head 0"
|
||||
},
|
||||
"reserved0" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"shead21" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "1",
|
||||
"description" : "FPM phase to use for head 2 sub head 1"
|
||||
},
|
||||
"reserved1" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"shead30" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "0",
|
||||
"description" : "FPM phase to use for head 3 sub head 0"
|
||||
},
|
||||
"reserved2" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
},
|
||||
"shead31" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "5",
|
||||
"reset" : "1",
|
||||
"description" : "FPM phase to use for head 3 sub head 1"
|
||||
},
|
||||
"reserved3" : {
|
||||
"type" : "rsv",
|
||||
"bit_len" : "3",
|
||||
"description" : "Reserved bits"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cpu_wave_seq_addr2" : {
|
||||
"address" : "4",
|
||||
"width" : "8",
|
||||
"type" : "w",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 2"
|
||||
},
|
||||
"cpu_wave_seq_addr3" : {
|
||||
"cpu_wave_seq" : {
|
||||
"address" : "5",
|
||||
"width" : "8",
|
||||
"type" : "w",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 3"
|
||||
"width" : "32",
|
||||
"description" : "Sequence start addresses for waveform sequencers",
|
||||
"fields" : {
|
||||
"addr0" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 0"
|
||||
},
|
||||
"addr1" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 1"
|
||||
},
|
||||
"addr2" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 2"
|
||||
},
|
||||
"addr3" : {
|
||||
"type" : "w",
|
||||
"bit_len" : "8",
|
||||
"reset" : "0",
|
||||
"description" : "Sequence start address for waveform sequencer 3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cpu_wave_seq_start" : {
|
||||
"address" : "6",
|
||||
|
|
@ -126,7 +231,7 @@
|
|||
},
|
||||
"seq_status_a" : {
|
||||
"address" : "7",
|
||||
"width" : "16",
|
||||
"width" : "12",
|
||||
"description" : "Print unit sequencer statuses",
|
||||
"fields" : {
|
||||
"wave_seq_busy" : {
|
||||
|
|
@ -140,20 +245,20 @@
|
|||
"bit_len" : "4",
|
||||
"reset" : "0x00",
|
||||
"description" : "Print unit data sequencer busy statuses"
|
||||
},
|
||||
"data_core_empty" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"seq_status_b" : {
|
||||
"address" : "8",
|
||||
"width" : "20",
|
||||
"description" : "Print unit sequencer statuses",
|
||||
"fields" : {
|
||||
"data_core_empty" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "4",
|
||||
"reset" : "0x00",
|
||||
"description" : "Print unit data core empty statuses"
|
||||
}
|
||||
}
|
||||
},
|
||||
"seq_status_b" : {
|
||||
"address" : "8",
|
||||
"width" : "16",
|
||||
"description" : "Print unit sequencer statuses",
|
||||
"fields" : {
|
||||
},
|
||||
"data_core_overrun" : {
|
||||
"type" : "r",
|
||||
"bit_len" : "4",
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ entity print_ctrl is
|
|||
axm_rvalid : in std_logic; --slave data valid
|
||||
axm_rready : out std_logic; --master ready to accept
|
||||
|
||||
fire_req : in std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
fire_req : in std_logic_vector(32*NUM_HEADS-1 downto 0);
|
||||
fire_data : in std_logic_vector( 7 downto 0);
|
||||
|
||||
stm8_trigger_rx : out std_logic;
|
||||
|
|
@ -152,6 +152,7 @@ architecture rtl of print_ctrl is
|
|||
type bpp_vec_t is array (0 to NUM_HEADS-1) of std_logic_vector( 3 downto 0);
|
||||
type diag_wc_vec_t is array (0 to NUM_HEADS-1) of std_logic_vector( 6 downto 0);
|
||||
type cpu_gl_map_t is array (0 to NUM_HEADS-1) of std_logic_vector(15 downto 0);
|
||||
type fpm_phase_sel_t is array (0 to NUM_HEADS-1) of std_logic_vector( 9 downto 0);
|
||||
|
||||
signal stm8_trigger_rx_int : std_logic_vector(NUM_HEADS-1 downto 0);
|
||||
signal wave_seq_busy : std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
|
|
@ -210,7 +211,9 @@ architecture rtl of print_ctrl is
|
|||
signal fire_req_data_int : std_logic_vector( 7 downto 0);
|
||||
signal fire_req_edge : std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
signal fire_req_dly : std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
|
||||
signal fire_req_choice : std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
signal fpm_phase_sel : fpm_phase_sel_t;
|
||||
|
||||
signal dest_port_wr : std_logic_vector(NUM_HEADS downto 0);
|
||||
signal dest_port_rdy : std_logic_vector(NUM_HEADS downto 0);
|
||||
|
||||
|
|
@ -226,7 +229,7 @@ begin
|
|||
-- -----------------------------------------------
|
||||
|
||||
-- Pulse at falling edge
|
||||
fire_req_edge <= fire_req_dly and not fire_req;
|
||||
fire_req_edge <= fire_req_dly and not fire_req_choice;
|
||||
|
||||
-- STM8 trigger whenever any print unit outputs trigger
|
||||
stm8_trigger_rx <= '1' when to_integer(unsigned(stm8_trigger_rx_int)) /= 0 else '0';
|
||||
|
|
@ -251,9 +254,17 @@ begin
|
|||
-- Only want a CPU instigated measurement to go to head 0 (they're ORed together anyway)
|
||||
cpu_adc_meas(NUM_HEADS-1 downto 1) <= (others => '0');
|
||||
|
||||
-- Select fpm phases
|
||||
fpm_phase_sel_gen : for i in 0 to NUM_HEADS-1 generate
|
||||
|
||||
fire_req_choice(i*SUB_HEADS+0) <= fire_req(to_integer(unsigned(fpm_phase_sel(i)( 4 downto 0))));
|
||||
fire_req_choice(i*SUB_HEADS+1) <= fire_req(to_integer(unsigned(fpm_phase_sel(i)( 9 downto 5))));
|
||||
|
||||
end generate;
|
||||
|
||||
fire_req_int <= std_logic_vector(to_unsigned((2**(SUB_HEADS*NUM_HEADS)-1), SUB_HEADS*NUM_HEADS)) when cpu_fire_req_pulse = '1' else fire_req_edge;
|
||||
fire_req_data_int <= fire_data when fire_req_edge /= std_logic_vector(to_unsigned(0, SUB_HEADS*NUM_HEADS)) else cpu_fire_req;
|
||||
|
||||
|
||||
-- -----------------------------------------------
|
||||
-- Convert input fire request to a pulse on the
|
||||
-- falling egde
|
||||
|
|
@ -263,7 +274,7 @@ begin
|
|||
if rst_n = '0' then
|
||||
fire_req_dly <= (others => '0');
|
||||
elsif clk'event and clk = '1' then
|
||||
fire_req_dly <= fire_req;
|
||||
fire_req_dly <= fire_req_choice;
|
||||
|
||||
-- Default data values are 0
|
||||
diag_peek_data <= (others => '0');
|
||||
|
|
@ -357,6 +368,15 @@ begin
|
|||
clk => clk,
|
||||
rst_n => rst_n,
|
||||
|
||||
select_head01phase_shead00 => fpm_phase_sel(0)( 4 downto 0),
|
||||
select_head01phase_shead01 => fpm_phase_sel(0)( 9 downto 5),
|
||||
select_head01phase_shead10 => fpm_phase_sel(1)( 4 downto 0),
|
||||
select_head01phase_shead11 => fpm_phase_sel(1)( 9 downto 5),
|
||||
select_head23phase_shead20 => fpm_phase_sel(2)( 4 downto 0),
|
||||
select_head23phase_shead21 => fpm_phase_sel(2)( 9 downto 5),
|
||||
select_head23phase_shead30 => fpm_phase_sel(3)( 4 downto 0),
|
||||
select_head23phase_shead31 => fpm_phase_sel(3)( 9 downto 5),
|
||||
|
||||
cpu_wave_seq_addr0 => wave_addr_cpu(0),
|
||||
cpu_wave_seq_addr1 => wave_addr_cpu(1),
|
||||
cpu_wave_seq_addr2 => wave_addr_cpu(2),
|
||||
|
|
@ -394,7 +414,7 @@ begin
|
|||
cpu_fire_req => cpu_fire_req,
|
||||
cpu_fire_req_in => (others => '0'),
|
||||
|
||||
seq_status_a_data_core_empty => empty, -- @suppress "Incorrect array size in assignment: expected 4 but was NUM_HEADS"
|
||||
seq_status_b_data_core_empty => empty, -- @suppress "Incorrect array size in assignment: expected 4 but was NUM_HEADS"
|
||||
seq_status_b_data_core_overrun => overrun, -- @suppress "Incorrect array size in assignment: expected 4 but was NUM_HEADS"
|
||||
seq_status_b_data_core_underrun=> underrun, -- @suppress "Incorrect array size in assignment: expected 4 but was NUM_HEADS"
|
||||
seq_status_b_data_core_fp_drop => fp_drop, -- @suppress "Incorrect array size in assignment: expected 4 but was NUM_HEADS"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"ip_name" : "core",
|
||||
"bus" : "csr",
|
||||
"addr_hi_bit" : "15",
|
||||
"addr_lo_bit" : "11",
|
||||
"addr_lo_bit" : "10",
|
||||
"description" : "This block is the top level for the GMA SOM board soft IP",
|
||||
"sub_blocks" : {
|
||||
"generic_pio_1" : {
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"swim_2" : {
|
||||
"instance" : "",
|
||||
"process" : "enabled",
|
||||
"offset" : "0x0800"
|
||||
"offset" : "0x0400"
|
||||
},
|
||||
"hmb_fpga_cfg_5" : {
|
||||
"instance" : "",
|
||||
|
|
@ -50,45 +50,40 @@
|
|||
"process" : "enabled",
|
||||
"offset" : "0x4800"
|
||||
},
|
||||
"fpm_ctrl_4" : {
|
||||
"fpm_ctrl_6" : {
|
||||
"instance" : "",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0x8000"
|
||||
},
|
||||
"fpm_diags_4" : {
|
||||
"instance" : "",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0x8800"
|
||||
},
|
||||
"fpm_event_log_4" : {
|
||||
"instance" : "",
|
||||
"process" : "disabled",
|
||||
"offset" : "0x9000"
|
||||
},
|
||||
"enc_pd_emul_1" : {
|
||||
"instance" : "",
|
||||
"process" : "cpp",
|
||||
"offset" : "0x9800"
|
||||
},
|
||||
"pulse_generator_2:a" : {
|
||||
"instance" : "0",
|
||||
"ems_0" : {
|
||||
"instance" : "",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0xa000"
|
||||
},
|
||||
"pulse_generator_2:b" : {
|
||||
"instance" : "1",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0xa800"
|
||||
},
|
||||
"pulse_generator_2:c" : {
|
||||
"instance" : "2",
|
||||
"pulse_generator_3:a" : {
|
||||
"instance" : "0",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0xb000"
|
||||
},
|
||||
"pulse_generator_2:d" : {
|
||||
"instance" : "3",
|
||||
"pulse_generator_3:b" : {
|
||||
"instance" : "1",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0xb800"
|
||||
},
|
||||
"pulse_generator_3:c" : {
|
||||
"instance" : "2",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0xc000"
|
||||
},
|
||||
"pulse_generator_3:d" : {
|
||||
"instance" : "3",
|
||||
"process" : "cpp, txt",
|
||||
"offset" : "0xc800"
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
|||
|
|
@ -173,6 +173,31 @@ end entity core;
|
|||
--! Architecture RTL for top level soft IP of SoM
|
||||
architecture rtl of core is
|
||||
|
||||
function crc_calc (
|
||||
crc_in : in std_logic_vector(15 downto 0);
|
||||
data_in : in std_logic_vector( 9 downto 0))
|
||||
return std_logic_vector is
|
||||
variable crc_out : std_logic_vector(15 downto 0);
|
||||
begin
|
||||
crc_out(00) := crc_in(06) xor crc_in(07) xor crc_in(08) xor crc_in(09) xor crc_in(10) xor crc_in(11) xor crc_in(12) xor crc_in(13) xor crc_in(14) xor crc_in(15) xor data_in(00) xor data_in(01) xor data_in(02) xor data_in(03) xor data_in(04) xor data_in(05) xor data_in(06) xor data_in(07) xor data_in(08) xor data_in(09);
|
||||
crc_out(01) := crc_in(07) xor crc_in(08) xor crc_in(09) xor crc_in(10) xor crc_in(11) xor crc_in(12) xor crc_in(13) xor crc_in(14) xor crc_in(15) xor data_in(01) xor data_in(02) xor data_in(03) xor data_in(04) xor data_in(05) xor data_in(06) xor data_in(07) xor data_in(08) xor data_in(09);
|
||||
crc_out(02) := crc_in(06) xor crc_in(07) xor data_in(00) xor data_in(01);
|
||||
crc_out(03) := crc_in(07) xor crc_in(08) xor data_in(01) xor data_in(02);
|
||||
crc_out(04) := crc_in(08) xor crc_in(09) xor data_in(02) xor data_in(03);
|
||||
crc_out(05) := crc_in(09) xor crc_in(10) xor data_in(03) xor data_in(04);
|
||||
crc_out(06) := crc_in(10) xor crc_in(11) xor data_in(04) xor data_in(05);
|
||||
crc_out(07) := crc_in(11) xor crc_in(12) xor data_in(05) xor data_in(06);
|
||||
crc_out(08) := crc_in(12) xor crc_in(13) xor data_in(06) xor data_in(07);
|
||||
crc_out(09) := crc_in(13) xor crc_in(14) xor data_in(07) xor data_in(08);
|
||||
crc_out(10) := crc_in(00) xor crc_in(14) xor crc_in(15) xor data_in(08) xor data_in(09);
|
||||
crc_out(11) := crc_in(01) xor crc_in(15) xor data_in(09);
|
||||
crc_out(12) := crc_in(02);
|
||||
crc_out(13) := crc_in(03);
|
||||
crc_out(14) := crc_in(04);
|
||||
crc_out(15) := crc_in(05) xor crc_in(06) xor crc_in(07) xor crc_in(08) xor crc_in(09) xor crc_in(10) xor crc_in(11) xor crc_in(12) xor crc_in(13) xor crc_in(14) xor crc_in(15) xor data_in(00) xor data_in(01) xor data_in(02) xor data_in(03) xor data_in(04) xor data_in(05) xor data_in(06) xor data_in(07) xor data_in(08) xor data_in(09);
|
||||
return std_logic_vector(crc_out);
|
||||
end function;
|
||||
|
||||
type print_remap_data_t is array (0 to 7) of std_logic_vector(9 downto 0);
|
||||
type head_pwm_data_t is array (0 to 7) of std_logic_vector(7 downto 0);
|
||||
type uart_readdata_t is array (0 to 1) of std_logic_vector(31 downto 0);
|
||||
|
|
@ -186,6 +211,8 @@ architecture rtl of core is
|
|||
type tr_errors_rdy_t is array (0 to 3) of std_logic_vector(2 downto 0);
|
||||
type link_bitslip_det_t is array (0 to 3) of std_logic_vector(2 downto 0);
|
||||
type link_align_t is array (0 to 3) of std_logic_vector(1 downto 0);
|
||||
type crc_reg_t is array (0 to 7) of std_logic_vector(15 downto 0);
|
||||
type ins_crc_t is array (0 to 7) of integer range 0 to 16;
|
||||
|
||||
constant TICKS_50US : integer := 50 * CLK_FREQ_MHZ;
|
||||
constant TICKS_10US : integer := 10 * CLK_FREQ_MHZ;
|
||||
|
|
@ -274,16 +301,14 @@ architecture rtl of core is
|
|||
|
||||
signal print_data_int : print_remap_data_t;
|
||||
|
||||
signal fire_req : std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
signal fire_req_fpm : std_logic_vector(SUB_HEADS*NUM_HEADS-1 downto 0);
|
||||
signal fire_req_fpm_int : std_logic_vector(NUM_HEADS-1 downto 0);
|
||||
signal fire_req : std_logic_vector(32*NUM_HEADS-1 downto 0);
|
||||
signal fire_req_fpm : std_logic_vector(32*NUM_HEADS-1 downto 0);
|
||||
signal fire_req_test : std_logic;
|
||||
signal fire_req_dly : fire_req_dly_t;
|
||||
|
||||
|
||||
signal timing_in_is_1 : std_logic;
|
||||
signal timing_rxp_dly : std_logic_vector(7 downto 0);
|
||||
signal fire_mgr_write : std_logic_vector(7 downto 0);
|
||||
signal fire_mgr_read : std_logic_vector(7 downto 0);
|
||||
signal fire_mgr_write : std_logic_vector(7 downto 0) := X"00";
|
||||
signal fire_mgr_read : std_logic_vector(7 downto 0) := X"00";
|
||||
signal fire_mgr_waitrequest : std_logic;
|
||||
signal fire_mgr_readdata : std_logic_vector(31 downto 0);
|
||||
signal fire_mgr_readdata_int : std_logic_vector(31 downto 0);
|
||||
|
|
@ -345,6 +370,11 @@ architecture rtl of core is
|
|||
signal tr_pattern : std_logic_vector (159 downto 0);
|
||||
signal tr_errors : std_logic_vector (47 downto 0);
|
||||
|
||||
signal crc_reg : crc_reg_t;
|
||||
signal crc_tx : crc_reg_t;
|
||||
signal ins_crc : ins_crc_t;
|
||||
signal crc_last : std_logic_vector( 7 downto 0);
|
||||
|
||||
signal lvds_tx_par : std_logic_vector (LVDS_TX_CHANS*TX_SERDES_RATIO - 1 downto 0);
|
||||
signal lvds_rx_par : std_logic_vector (LVDS_TX_CHANS/2*TX_SERDES_RATIO - 1 downto 0);
|
||||
|
||||
|
|
@ -409,30 +439,60 @@ begin
|
|||
end process;
|
||||
|
||||
tx_data_pr : process (clk_lvds_slow, reset_n)
|
||||
variable print_data : std_logic_vector(9 downto 0);
|
||||
|
||||
begin
|
||||
if reset_n = '0' then
|
||||
print_data_int(i) <= (others => '0');
|
||||
crc_reg(i) <= (others => '0');
|
||||
crc_tx(i) <= (others => '0');
|
||||
ins_crc(i) <= 0;
|
||||
crc_last(i) <= '0';
|
||||
elsif rising_edge(clk_lvds_slow) then
|
||||
crc_last(i) <= '0';
|
||||
|
||||
if print_valid_half(i) = '1' then
|
||||
print_data_int(i)(9 downto 6) <= '1' &
|
||||
print_data_half(i*3+2) &
|
||||
print_data_half(i*3+1) &
|
||||
print_data_half(i*3+0);
|
||||
print_data(9 downto 6) := '1' &
|
||||
print_data_half(i*3+2) &
|
||||
print_data_half(i*3+1) &
|
||||
print_data_half(i*3+0);
|
||||
else
|
||||
print_data_int(i)(9 downto 6) <= "0101";
|
||||
print_data(9 downto 6) := "0101";
|
||||
end if;
|
||||
|
||||
print_data_int(i)(5) <= print_latch(i);
|
||||
print_data_int(i)(4) <= print_load(i);
|
||||
print_data_int(i)(3) <= print_gsclk(i);
|
||||
print_data_int(i)(2) <= print_plstm2(i);
|
||||
print_data_int(i)(1) <= print_plstm1(i);
|
||||
print_data_int(i)(0) <= print_stb(i);
|
||||
print_data(5) := print_latch(i);
|
||||
print_data(4) := print_load(i);
|
||||
print_data(3) := print_gsclk(i);
|
||||
print_data(2) := print_plstm2(i);
|
||||
print_data(1) := print_plstm1(i);
|
||||
print_data(0) := print_stb(i);
|
||||
|
||||
if print_latch(i) = '0' and print_data_int(i)(5) = '1' and crc_last(i) = '0' and ins_crc(i) = 0 then
|
||||
ins_crc(i) <= 16;
|
||||
crc_reg(i) <= crc_calc(crc_reg(i), print_data);
|
||||
crc_tx(i) <= crc_calc(crc_reg(i), print_data);
|
||||
elsif ins_crc(i) /= 0 then
|
||||
ins_crc(i) <= ins_crc(i) - 1;
|
||||
print_data(5) := crc_tx(i)(15);
|
||||
if ins_crc(i) = 1 then
|
||||
crc_last(i) <= '1';
|
||||
end if;
|
||||
if ins_crc(i) = 16 then
|
||||
crc_reg(i) <= crc_calc(X"0000", print_data);
|
||||
else
|
||||
crc_reg(i) <= crc_calc(crc_reg(i), print_data);
|
||||
end if;
|
||||
crc_tx(i) <= crc_tx(i)(14 downto 0) & '0';
|
||||
else
|
||||
crc_reg(i) <= crc_calc(crc_reg(i), print_data);
|
||||
end if;
|
||||
|
||||
print_data_int(i) <= print_data;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Export the block signals to the LVDS transmitters
|
||||
lvds_tx_par(i*10+9 downto i*10) <= print_data_int(i);
|
||||
lvds_tx_par(i*10+9 downto i*10) <= print_data_int(i);
|
||||
|
||||
end generate;
|
||||
|
||||
|
|
@ -538,58 +598,6 @@ begin
|
|||
|
||||
disable_fire_reqs <= not pwr_seq_control_en(SIG_SEQ_CTRL_DISABLE_FIRE_REQS) and not en_test_pwr_ctrl;
|
||||
|
||||
-- -----------------------------------
|
||||
-- FPM combinatorial logic
|
||||
-- -----------------------------------
|
||||
|
||||
fire_pulse_mgr_write <= '1' when fire_mgr_write /= 8x"0" else '0';
|
||||
fire_pulse_mgr_read <= '1' when fire_mgr_read /= 8x"0" else '0';
|
||||
fire_pulse_mgr_active <= fire_pulse_mgr_write or fire_pulse_mgr_read;
|
||||
|
||||
-- The fire pulse manager does not give 0 when inactive read, so fix this here.
|
||||
fire_mgr_readdata <= fire_mgr_readdata_int when fire_mgr_waitrequest = '0' else (others => '0');
|
||||
|
||||
fpm_rx <= TIMING_TX_N when fpm_select_pof_niso = '1' else TIMING_RX_P;
|
||||
TIMING_RX_N <= TIMING_TX_P;
|
||||
|
||||
-- -----------------------------------
|
||||
-- Process to generate signal for
|
||||
-- injecting fire requests fpr test
|
||||
-- -----------------------------------
|
||||
|
||||
GEN_TEST_FIRE_REQ : if ENA_TEST_FP_GEN generate
|
||||
|
||||
TEST_FP_PROC : process(clk, reset_n) is
|
||||
begin
|
||||
if reset_n = '0' then
|
||||
fire_req_test <= '0';
|
||||
timing_in_is_1 <= '0';
|
||||
timing_rxp_dly <= (others => '0');
|
||||
elsif clk'event and clk = '1' then
|
||||
fire_req_test <= '0';
|
||||
timing_rxp_dly <= timing_rxp_dly(6 downto 0) & TIMING_RX_P;
|
||||
if timing_in_is_1 = '0' and timing_rxp_dly(7 downto 2) = "111111" then
|
||||
fire_req_test <= '1';
|
||||
timing_in_is_1 <= '1';
|
||||
end if;
|
||||
|
||||
if timing_in_is_1 = '1' and timing_rxp_dly(7 downto 2) = "000000" then
|
||||
timing_in_is_1 <= '0';
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
end process;
|
||||
|
||||
fire_req <= std_logic_vector(to_unsigned((2**(SUB_HEADS*NUM_HEADS)-1), SUB_HEADS*NUM_HEADS)) when (en_test_fp_logic and fire_req_test) else
|
||||
fire_req_fpm when (not en_test_fp_logic and not disable_fire_reqs) else
|
||||
std_logic_vector(to_unsigned(0, SUB_HEADS*NUM_HEADS));
|
||||
end generate;
|
||||
|
||||
GEN_NO_TEST_FIRE_REQ : if not ENA_TEST_FP_GEN generate
|
||||
fire_req <= fire_req_fpm when not disable_fire_reqs else std_logic_vector(to_unsigned(0, SUB_HEADS*NUM_HEADS));
|
||||
end generate;
|
||||
|
||||
-- -----------------------------------
|
||||
-- Process to make STM8 alerts sticky
|
||||
-- -----------------------------------
|
||||
|
|
@ -643,7 +651,7 @@ begin
|
|||
core_csr_decode_1 : entity work.core_csr_decode
|
||||
generic map (
|
||||
ADDR_DECODE_HI_BIT => 15,
|
||||
ADDR_DECODE_LO_BIT => 11
|
||||
ADDR_DECODE_LO_BIT => 10
|
||||
)
|
||||
port map (
|
||||
|
||||
|
|
@ -675,32 +683,29 @@ begin
|
|||
shutdown_monitor_0_read => shutdown_monitor_read,
|
||||
shutdown_monitor_0_readdata => shutdown_monitor_readdata,
|
||||
|
||||
fpm_ctrl_4_write => fire_mgr_write(0),
|
||||
fpm_ctrl_4_read => fire_mgr_read(0),
|
||||
fpm_ctrl_4_readdata => fire_mgr_readdata,
|
||||
fpm_diags_4_write => fire_mgr_write(1),
|
||||
fpm_diags_4_read => fire_mgr_read(1),
|
||||
fpm_diags_4_readdata => (others => '0'),
|
||||
fpm_event_log_4_write => fire_mgr_write(2),
|
||||
fpm_event_log_4_read => fire_mgr_read(2),
|
||||
fpm_event_log_4_readdata => (others => '0'),
|
||||
enc_pd_emul_1_write => fire_mgr_write(3),
|
||||
enc_pd_emul_1_read => fire_mgr_read(3),
|
||||
fpm_ctrl_6_write => fire_mgr_write(0),
|
||||
fpm_ctrl_6_read => fire_mgr_read(0),
|
||||
fpm_ctrl_6_readdata => fire_mgr_readdata,
|
||||
enc_pd_emul_1_write => fire_mgr_write(1),
|
||||
enc_pd_emul_1_read => fire_mgr_read(1),
|
||||
enc_pd_emul_1_readdata => (others => '0'),
|
||||
pulse_generator_2_0_write => fire_mgr_write(4),
|
||||
pulse_generator_2_0_read => fire_mgr_read(4),
|
||||
pulse_generator_2_0_readdata => (others => '0'),
|
||||
pulse_generator_2_1_write => fire_mgr_write(5),
|
||||
pulse_generator_2_1_read => fire_mgr_read(5),
|
||||
pulse_generator_2_1_readdata => (others => '0'),
|
||||
pulse_generator_2_2_write => fire_mgr_write(6),
|
||||
pulse_generator_2_2_read => fire_mgr_read(6),
|
||||
pulse_generator_2_2_readdata => (others => '0'),
|
||||
pulse_generator_2_3_write => fire_mgr_write(7),
|
||||
pulse_generator_2_3_read => fire_mgr_read(7),
|
||||
pulse_generator_2_3_readdata => (others => '0'),
|
||||
ems_0_write => fire_mgr_write(2),
|
||||
ems_0_read => fire_mgr_read(2),
|
||||
ems_0_readdata => (others => '0'),
|
||||
pulse_generator_3_0_write => fire_mgr_write(3),
|
||||
pulse_generator_3_0_read => fire_mgr_read(3),
|
||||
pulse_generator_3_0_readdata => (others => '0'),
|
||||
pulse_generator_3_1_write => fire_mgr_write(4),
|
||||
pulse_generator_3_1_read => fire_mgr_read(4),
|
||||
pulse_generator_3_1_readdata => (others => '0'),
|
||||
pulse_generator_3_2_write => fire_mgr_write(5),
|
||||
pulse_generator_3_2_read => fire_mgr_read(5),
|
||||
pulse_generator_3_2_readdata => (others => '0'),
|
||||
pulse_generator_3_3_write => fire_mgr_write(6),
|
||||
pulse_generator_3_3_read => fire_mgr_read(6),
|
||||
pulse_generator_3_3_readdata => (others => '0'),
|
||||
|
||||
avs_address => avs_csr_address_cl(15 downto 11),
|
||||
avs_address => avs_csr_address_cl(15 downto 10),
|
||||
avs_write => avs_csr_write_cl,
|
||||
avs_read => avs_csr_read_cl,
|
||||
avs_readdata => avs_csr_readdata_cl
|
||||
|
|
@ -736,7 +741,7 @@ begin
|
|||
-- -----------------------------------
|
||||
core_csr_regs_1 : entity work.core_csr_regs
|
||||
generic map (
|
||||
ADDR_DECODE_WIDTH => 5
|
||||
ADDR_DECODE_WIDTH => 6
|
||||
)
|
||||
port map (
|
||||
-- Clock and reset
|
||||
|
|
@ -785,7 +790,7 @@ begin
|
|||
tr_errors3 => tr_errors(47 downto 36),
|
||||
|
||||
-- Slave bus port
|
||||
avs_address => avs_csr_address_cl(4 downto 0),
|
||||
avs_address => avs_csr_address_cl(5 downto 0),
|
||||
avs_write => local_csr_write,
|
||||
avs_writedata => avs_csr_writedata_cl,
|
||||
avs_read => local_csr_read,
|
||||
|
|
@ -1187,63 +1192,99 @@ begin
|
|||
-- Fire pulse manager
|
||||
-- -----------------------------------
|
||||
|
||||
fire_pulse_manager_inst : entity work.fire_pulse_manager_4
|
||||
fire_pulse_manager_inst : entity work.fire_pulse_manager_6
|
||||
generic map (
|
||||
ADD_SMB_DIAG => false,
|
||||
ADD_EVENT_LOGGER => false,
|
||||
PULSE_DELAY_EQUAL_EN => false,
|
||||
TOF_COMP_EN => false,
|
||||
PIXEL_PITCH_CORR_EN => false
|
||||
)
|
||||
port map (
|
||||
clk => clk,
|
||||
rx_clk => clk_fpm_rx,
|
||||
reset_n => reset_n,
|
||||
|
||||
pof_rx => fpm_rx,
|
||||
pof_tx => TIMING_TX_P,
|
||||
|
||||
fire_pulse => fire_req_fpm_int, -- @suppress "Incorrect array size in assignment: expected 4 but was NUM_HEADS"
|
||||
|
||||
pof_iso_en => open,
|
||||
mon_pt => open,
|
||||
|
||||
ins_fpm_irq_0 => open,
|
||||
ins_fpm_irq_1 => open,
|
||||
ins_fpm_irq_2 => open,
|
||||
ins_fpm_irq_3 => open,
|
||||
|
||||
avs_address => avs_csr_address_cl(14 downto 0),
|
||||
avs_write => fire_pulse_mgr_write,
|
||||
avs_writedata => avs_csr_writedata_cl,
|
||||
avs_read => fire_pulse_mgr_read,
|
||||
avs_waitrequest => fire_mgr_waitrequest,
|
||||
avs_readdata => fire_mgr_readdata_int
|
||||
reset_n => reset_n,
|
||||
clk => clk,
|
||||
rx_clk => clk_fpm_rx,
|
||||
-- Datapath I/Os
|
||||
pof_rx => fpm_rx,
|
||||
pof_tx => TIMING_TX_P,
|
||||
pof_iso_en => open,
|
||||
seb_epd_mode_en => open,
|
||||
seb_epd_enc_p1 => '0',
|
||||
seb_epd_enc_p2 => '0',
|
||||
seb_epd_pd => '0',
|
||||
fire_pulse => fire_req_fpm,
|
||||
start_of_image => open,
|
||||
dp_dir_out => open,
|
||||
abs_pos_out => open,
|
||||
print_start => open,
|
||||
mon_pt => open,
|
||||
-- Interrupt Senders
|
||||
ins_fpm_irq_0 => open,
|
||||
ins_fpm_irq_1 => open,
|
||||
ins_fpm_irq_2 => open,
|
||||
ins_fpm_irq_3 => open,
|
||||
-- Avalon MM (Slave) Interface
|
||||
avs_address => avs_csr_address_cl(14 downto 0),
|
||||
avs_write => fire_pulse_mgr_write,
|
||||
avs_writedata => avs_csr_writedata_cl,
|
||||
avs_read => fire_pulse_mgr_read,
|
||||
avs_waitrequest => fire_mgr_waitrequest,
|
||||
avs_readdata => fire_mgr_readdata_int
|
||||
);
|
||||
|
||||
-- fire_req_fpm(0) <= fire_req_fpm_int(0);
|
||||
-- fire_req_fpm(2) <= fire_req_fpm_int(1);
|
||||
-- fire_req_fpm(4) <= fire_req_fpm_int(2);
|
||||
-- fire-_req_fpm(6) <= fire_req_fpm_int(3);
|
||||
|
||||
PROC_DELAY_FIREREQ : process (clk, reset_n)
|
||||
begin
|
||||
if reset_n = '0' then
|
||||
for i in 0 to NUM_HEADS-1 loop
|
||||
fire_req_dly(i) <= (others => '0');
|
||||
fire_req_fpm(i*2) <= '0';
|
||||
fire_req_fpm(i*2+1) <= '0';
|
||||
end loop;
|
||||
elsif clk'event and clk = '1' then
|
||||
for i in 0 to NUM_HEADS-1 loop
|
||||
fire_req_fpm(i*2+1) <= '0';
|
||||
fire_req_fpm(i*2) <= fire_req_fpm_int(i);
|
||||
-- -----------------------------------
|
||||
-- FPM combinatorial logic
|
||||
-- -----------------------------------
|
||||
|
||||
if fire_req_fpm_int(i) = '1' then
|
||||
fire_req_dly(i) <= (others => '1');
|
||||
fire_pulse_mgr_write <= '1' when fire_mgr_write /= 8x"0" else '0';
|
||||
fire_pulse_mgr_read <= '1' when fire_mgr_read /= 8x"0" else '0';
|
||||
fire_pulse_mgr_active <= fire_pulse_mgr_write or fire_pulse_mgr_read;
|
||||
|
||||
-- The fire pulse manager does not give 0 when inactive read, so fix this here.
|
||||
fire_mgr_readdata <= fire_mgr_readdata_int when fire_mgr_waitrequest = '0' else (others => '0');
|
||||
|
||||
fpm_rx <= TIMING_TX_N when fpm_select_pof_niso = '1' else TIMING_RX_P;
|
||||
TIMING_RX_N <= TIMING_TX_P;
|
||||
|
||||
-- -----------------------------------
|
||||
-- Process to generate signal for
|
||||
-- injecting fire requests fpr test
|
||||
-- -----------------------------------
|
||||
|
||||
GEN_TEST_FIRE_REQ : if ENA_TEST_FP_GEN generate
|
||||
|
||||
TEST_FP_PROC : process(clk, reset_n) is
|
||||
begin
|
||||
if reset_n = '0' then
|
||||
fire_req_test <= '0';
|
||||
timing_in_is_1 <= '0';
|
||||
timing_rxp_dly <= (others => '0');
|
||||
elsif clk'event and clk = '1' then
|
||||
fire_req_test <= '0';
|
||||
timing_rxp_dly <= timing_rxp_dly(6 downto 0) & TIMING_RX_P;
|
||||
if timing_in_is_1 = '0' and timing_rxp_dly(7 downto 2) = "111111" then
|
||||
fire_req_test <= '1';
|
||||
timing_in_is_1 <= '1';
|
||||
end if;
|
||||
|
||||
if unsigned(fire_req_dly(i)) /= 0 then
|
||||
fire_req_dly(i) <= std_logic_vector(unsigned(fire_req_dly(i)) - 1);
|
||||
if unsigned(fire_req_dly(i)) = 1 then
|
||||
fire_req_fpm(i*2+1) <= '1';
|
||||
end if;
|
||||
|
||||
if timing_in_is_1 = '1' and timing_rxp_dly(7 downto 2) = "000000" then
|
||||
timing_in_is_1 <= '0';
|
||||
end if;
|
||||
end loop;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end if;
|
||||
|
||||
end process;
|
||||
|
||||
fire_req <= (others => '1') when (en_test_fp_logic and fire_req_test) else
|
||||
fire_req_fpm when (not en_test_fp_logic and not disable_fire_reqs) else
|
||||
(others => '0');
|
||||
|
||||
end generate;
|
||||
|
||||
GEN_NO_TEST_FIRE_REQ : if not ENA_TEST_FP_GEN generate
|
||||
fire_req <= fire_req_fpm when not disable_fire_reqs else (others => '0');
|
||||
end generate;
|
||||
|
||||
|
||||
|
||||
end rtl;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# TCL File Generated by Component Editor 18.1
|
||||
# Sun May 03 13:16:55 BST 2020
|
||||
# Sat May 16 22:36:24 BST 2020
|
||||
# DO NOT MODIFY
|
||||
|
||||
|
||||
#
|
||||
# core "core" v1.0
|
||||
# 2020.05.03.13:16:54
|
||||
# 2020.05.16.22:36:24
|
||||
#
|
||||
#
|
||||
|
||||
|
|
@ -72,13 +72,10 @@ add_fileset_file fifo_delay_queue_1_ff.vhd VHDL PATH ../../generic_ip/generic_de
|
|||
add_fileset_file fifo_delay_queue_1.vhd VHDL PATH ../../generic_ip/generic_delay_queue/1/src/altera/fifo_delay_queue_1.vhd
|
||||
add_fileset_file generic_delay_queue_1_csr_regs_auto.vhd VHDL PATH ../../generic_ip/generic_delay_queue/1/src/generic_delay_queue_1_csr_regs_auto.vhd
|
||||
add_fileset_file generic_delay_queue_1.vhd VHDL PATH ../../generic_ip/generic_delay_queue/1/src/generic_delay_queue_1.vhd
|
||||
add_fileset_file pulse_generator_2_pkg.vhd VHDL PATH ../../generic_ip/pulse_generator/2/src/pulse_generator_2_pkg.vhd
|
||||
add_fileset_file sync_fifo.vhd VHDL PATH ../../generic_ip/common/0/src/altera/sync_fifo.vhd
|
||||
add_fileset_file dpram_sclk.vhd VHDL PATH ../../generic_ip/common/0/src/dpram_sclk.vhd
|
||||
add_fileset_file pulse_conditioning_2.vhd VHDL PATH ../../generic_ip/pulse_generator/2/src/pulse_conditioning_2.vhd
|
||||
add_fileset_file queue_and_delay.vhd VHDL PATH ../../generic_ip/common/0/src/queue_and_delay.vhd
|
||||
add_fileset_file simple_frac_div_2.vhd VHDL PATH ../../generic_ip/pulse_generator/2/src/simple_frac_div_2.vhd
|
||||
add_fileset_file pulse_generator_2.vhd VHDL PATH ../../generic_ip/pulse_generator/2/src/pulse_generator_2.vhd
|
||||
add_fileset_file enc_pd_emul_1_pkg.vhd VHDL PATH ../../generic_ip/enc_pd_emul/1/src/enc_pd_emul_1_pkg.vhd
|
||||
add_fileset_file enc_pd_emul_1.vhd VHDL PATH ../../generic_ip/enc_pd_emul/1/src/enc_pd_emul_1.vhd
|
||||
add_fileset_file preslicer_fifo_0.vhd VHDL PATH ../../generic_ip/preslicer/0/src/altera/preslicer_fifo_0.vhd
|
||||
|
|
@ -120,21 +117,14 @@ add_fileset_file constant_latency_if.vhd VHDL PATH constant_latency_if.vhd
|
|||
add_fileset_file cs_bus_itf.vhd VHDL PATH ../../generic_ip/common/0/src/cs_bus_itf.vhd
|
||||
add_fileset_file sync_wire.vhd VHDL PATH ../../generic_ip/common/0/src/sync_wire.vhd
|
||||
add_fileset_file sync_wire_rEdge.vhd VHDL PATH ../../generic_ip/common/0/src/sync_wire_rEdge.vhd
|
||||
add_fileset_file uart_rx.vhd VHDL PATH ../../generic_ip/common/0/src/uart_rx.vhd
|
||||
add_fileset_file uart_tx_0.vhd VHDL PATH ../../generic_ip/pof_protocol/0/src/uart_tx_0.vhd
|
||||
add_fileset_file pof_uart_rx_0.vhd VHDL PATH ../../generic_ip/pof_protocol/0/src/pof_uart_rx_0.vhd
|
||||
add_fileset_file pof_rx_0.vhd VHDL PATH ../../generic_ip/pof_protocol/0/src/pof_rx_0.vhd
|
||||
add_fileset_file pof_uart_regen_0.vhd VHDL PATH ../../generic_ip/pof_protocol/0/src/pof_uart_regen_0.vhd
|
||||
add_fileset_file pof_uart_rx_1.vhd VHDL PATH ../../generic_ip/pof_protocol/1/src/pof_uart_rx_1.vhd
|
||||
add_fileset_file pof_rx_1.vhd VHDL PATH ../../generic_ip/pof_protocol/1/src/pof_rx_1.vhd
|
||||
add_fileset_file pof_tx_0.vhd VHDL PATH ../../generic_ip/pof_protocol/0/src/pof_tx_0.vhd
|
||||
add_fileset_file pof_uart_regen_1.vhd VHDL PATH ../../generic_ip/pof_protocol/1/src/pof_uart_regen_1.vhd
|
||||
add_fileset_file event_logger_0_pkg.vhd VHDL PATH ../../generic_ip/event_logger/0/src/event_logger_0_pkg.vhd
|
||||
add_fileset_file event_logger_0.vhd VHDL PATH ../../generic_ip/event_logger/0/src/event_logger_0.vhd
|
||||
add_fileset_file simple_enc_vel_detect_4.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/4/src/simple_enc_vel_detect_4.vhd
|
||||
add_fileset_file smb_diagnostics_4.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/4/src/smb_diagnostics_4.vhd
|
||||
add_fileset_file fire_pulse_4_pkg.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/4/src/fire_pulse_4_pkg.vhd
|
||||
add_fileset_file fire_pulse_ctrl_4.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/4/src/fire_pulse_ctrl_4.vhd
|
||||
add_fileset_file fire_pulse_ext_4.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/4/src/fire_pulse_ext_4.vhd
|
||||
add_fileset_file fire_pulse_manager_4.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/4/src/fire_pulse_manager_4.vhd
|
||||
add_fileset_file top_pkg.vhd VHDL PATH top_pkg.vhd
|
||||
add_fileset_file core_pkg_auto.vhd VHDL PATH core_pkg_auto.vhd
|
||||
add_fileset_file core_csr_decode_auto.vhd VHDL PATH core_csr_decode_auto.vhd
|
||||
|
|
@ -145,6 +135,27 @@ add_fileset_file lvds_rx_des.vhd VHDL PATH lvds_rx_des.vhd
|
|||
add_fileset_file lvds_tx_ddio.vhd VHDL PATH altera/lvds_tx_ddio.vhd
|
||||
add_fileset_file lvds_tx_ser.vhd VHDL PATH lvds_tx_ser.vhd
|
||||
add_fileset_file lvds_link_ms.vhd VHDL PATH lvds_link_ms.vhd
|
||||
add_fileset_file event_logger_0_pkg.vhd VHDL PATH ../../generic_ip/event_logger/0/src/event_logger_0_pkg.vhd
|
||||
add_fileset_file event_logger_0.vhd VHDL PATH ../../generic_ip/event_logger/0/src/event_logger_0.vhd
|
||||
add_fileset_file seb_epd_led_gen_6.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/seb_epd_led_gen_6.vhd
|
||||
add_fileset_file simple_enc_vel_detect_6.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/simple_enc_vel_detect_6.vhd
|
||||
add_fileset_file smb_diagnostics_6.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/smb_diagnostics_6.vhd
|
||||
add_fileset_file generic_sequencer_16_pkg.vhd VHDL PATH ../../generic_ip/generic_sequencer/16/src/generic_sequencer_16_pkg.vhd
|
||||
add_fileset_file generic_seq_ram_16.vhd VHDL PATH ../../generic_ip/generic_sequencer/16/src/altera/generic_seq_ram_16.vhd
|
||||
add_fileset_file generic_sequencer_16.vhd VHDL PATH ../../generic_ip/generic_sequencer/16/src/generic_sequencer_16.vhd
|
||||
add_fileset_file pulse_generator_3_pkg.vhd VHDL PATH ../../generic_ip/pulse_generator/3/src/pulse_generator_3_pkg.vhd
|
||||
add_fileset_file simple_frac_div_3.vhd VHDL PATH ../../generic_ip/pulse_generator/3/src/simple_frac_div_3.vhd
|
||||
add_fileset_file pulse_generator_3.vhd VHDL PATH ../../generic_ip/pulse_generator/3/src/pulse_generator_3.vhd
|
||||
add_fileset_file digital_lpf.vhd VHDL PATH ../../generic_ip/common/0/src/digital_lpf.vhd
|
||||
add_fileset_file lut_divider_0.vhd VHDL PATH ../../generic_ip/encoder_multiply/0/src/lut_divider_0.vhd
|
||||
add_fileset_file encoder_speed_detect_0.vhd VHDL PATH ../../generic_ip/encoder_multiply/0/src/encoder_speed_detect_0.vhd
|
||||
add_fileset_file encoder_multiply_0.vhd VHDL PATH ../../generic_ip/encoder_multiply/0/src/encoder_multiply_0.vhd
|
||||
add_fileset_file ems_0_pkg.vhd VHDL PATH ../../generic_ip/ems/0/src/ems_0_pkg.vhd
|
||||
add_fileset_file ems_0.vhd VHDL PATH ../../generic_ip/ems/0/src/ems_0.vhd
|
||||
add_fileset_file fire_pulse_ctrl_6_pkg.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/fire_pulse_ctrl_6_pkg.vhd
|
||||
add_fileset_file fire_pulse_6_pkg.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/fire_pulse_6_pkg.vhd
|
||||
add_fileset_file fire_pulse_ctrl_6.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/fire_pulse_ctrl_6.vhd
|
||||
add_fileset_file fire_pulse_manager_6.vhd VHDL PATH ../../generic_ip/fire_pulse_manager/6/src/fire_pulse_manager_6.vhd
|
||||
add_fileset_file core.vhd VHDL PATH core.vhd TOP_LEVEL_FILE
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,13 @@
|
|||
"type" : "wp",
|
||||
"reset" : "0",
|
||||
"description" : "Clear latches"
|
||||
},
|
||||
"clk_cnt" : {
|
||||
"address" : "518",
|
||||
"width" : "32",
|
||||
"type" : "wp",
|
||||
"reset" : "0",
|
||||
"description" : "Clk cnt"
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
@ -46,6 +46,7 @@ architecture behaviour of print_data_rx is
|
|||
constant AVS_CSR_PRINT_RX_SEEN_LATCH_ADDR_INT : integer := 515;
|
||||
constant AVS_CSR_PRINT_RX_CLEAR_ADDR_INT : integer := 516;
|
||||
constant AVS_CSR_PRINT_LATCH_CLEAR_ADDR_INT : integer := 517;
|
||||
constant AVS_CSR_PRINT_RX_CLK_CNT_ADDR_INT : integer := 518;
|
||||
|
||||
signal all_on_count : integer;
|
||||
signal wav_sig : integer;
|
||||
|
|
@ -54,6 +55,8 @@ architecture behaviour of print_data_rx is
|
|||
signal seen_valid : std_logic;
|
||||
|
||||
signal clr_state : std_logic;
|
||||
signal clk_cnt : integer;
|
||||
signal clr_cnt : std_logic;
|
||||
signal wav_error : std_logic;
|
||||
|
||||
signal addrmod16 : integer;
|
||||
|
|
@ -68,16 +71,18 @@ begin
|
|||
addrmod32 <= to_integer(unsigned(avs_address(6 downto 0))) mod 32;
|
||||
addrmod64 <= to_integer(unsigned(avs_address(6 downto 0))) mod 64;
|
||||
|
||||
process(clk, rst_n)
|
||||
process(clk, rst_n, clr_cnt)
|
||||
variable latched_val : unsigned(2 downto 0);
|
||||
|
||||
begin
|
||||
if rst_n = '0' then
|
||||
|
||||
clk_cnt <= 0;
|
||||
all_on_count <= 0;
|
||||
clr_state <= '0';
|
||||
seen_latch <= '0';
|
||||
seen_valid <= '0';
|
||||
elsif clr_cnt = '1' then
|
||||
clk_cnt <= 0;
|
||||
elsif clk'event and clk = '1' then
|
||||
|
||||
-- Default values for avs_readdata, and clear_state
|
||||
|
|
@ -86,6 +91,7 @@ begin
|
|||
|
||||
-- On rising edge of print clock, shift in the data
|
||||
if print_valid = '1' and seen_valid = '0' then
|
||||
clk_cnt <= clk_cnt + 1;
|
||||
for i in 0 to MAX_OP_WIDTH*3-1 loop
|
||||
shift_regs(i) <= print_data(i) & shift_regs(i)(SHIFT_DEPTH-1 downto 1);
|
||||
end loop;
|
||||
|
|
@ -170,6 +176,8 @@ begin
|
|||
avs_readdata <= 31x"0" & wav_error;
|
||||
elsif avs_address(9 downto 0) = std_logic_vector(to_unsigned(AVS_CSR_PRINT_RX_SEEN_LATCH_ADDR_INT, 10)) then
|
||||
avs_readdata <= 31x"0" & seen_latch;
|
||||
elsif avs_address(9 downto 0) = std_logic_vector(to_unsigned(AVS_CSR_PRINT_RX_CLK_CNT_ADDR_INT, 10)) then
|
||||
avs_readdata <= std_logic_vector(to_unsigned(clk_cnt, 32));
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@ do compile.do
|
|||
set vsimargs [lrange $argv 3 end]
|
||||
|
||||
# Run the tests.
|
||||
vsim -quiet -pli VProc.so +nowarnTFMPC -L altera_mf_ver -L altera_mf -t 1ns tb -l sim.log\
|
||||
vsim -quiet -pli VProc.so +nowarnTFMPC -L altera_mf_ver -L altera_mf -t 1ps tb -l sim.log\
|
||||
[lindex $vsimargs 0] [lindex $vsimargs 1] [lindex $vsimargs 2] \
|
||||
[lindex $vsimargs 3] [lindex $vsimargs 4] [lindex $vsimargs 5] \
|
||||
[lindex $vsimargs 6] [lindex $vsimargs 7] [lindex $vsimargs 8]
|
||||
|
||||
set StdArithNoWarnings 1
|
||||
set NumericStdNoWarnings 1
|
||||
do wave.do
|
||||
run -all
|
||||
|
||||
#Exit the simulations
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ extern "C" {
|
|||
|
||||
#define MAINTESTNUM 0
|
||||
#define ALIVE_TEST_NUM 0x12345678
|
||||
#define ALIVE_TEST_OFFSET 0x1000
|
||||
#define ALIVE_TEST_OFFSET 0x2000
|
||||
|
||||
// --------------------------------------------------
|
||||
// STATIC VARIABLES
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ extern "C" {
|
|||
}
|
||||
|
||||
// Burst bus bits -- 9:0 start req delay,
|
||||
// 10 start request pulse0, 11 first pulse0, 12 last pulse0,
|
||||
// 13 start request pulse1, 14 first pulse1, 15 last pulse1
|
||||
// Vector bus bits -- 9:0 Wave seq start delay, 17:10 wave seq start addr,
|
||||
// 18 wave seq start bit0,
|
||||
// 19 wave seq start bit1
|
||||
// 10 first pulse, 11 last pulse
|
||||
// 12 start request0, 13 start request1
|
||||
// Vector bus bits -- 11:0 Wave seq start delay, 19:12 wave seq start addr,
|
||||
// 20 wave seq start bit0,
|
||||
// 21 wave seq start bit1
|
||||
const uint32_t runTest::PSEQ_PATTERN0 [] = {
|
||||
|
||||
0x60000002, // BUS_BURST : entries 2
|
||||
|
|
@ -96,6 +96,20 @@ const uint32_t runTest::WSEQ_PATTERN0 [] = {
|
|||
0x00000000
|
||||
};
|
||||
|
||||
// Define a default sequence for the FPM sequencer
|
||||
static uint32_t fpmSeq [] = {
|
||||
0x30000000, // VEC_SET now 0
|
||||
0x1000000F, // Trigger mask F
|
||||
0x30000000, // VEC_SET now 0
|
||||
0x20000001, // Trig wait 1
|
||||
0x30000294, // Vec set 0x2e794. Num stripes (bits 15:8) define the number of stripes. Update as required.
|
||||
0x30000200, // Vec set 0x2e700. Num stripes (bits 15:8) define the number of stripes. Update as required.
|
||||
0xC0000003
|
||||
};
|
||||
|
||||
// Define the length of the FPM sequence
|
||||
static uint32_t fpmSeqLen = 7;
|
||||
|
||||
const uint32_t runTest::STRIPE_1BPP0[] = {
|
||||
0xa42bd927, 0x24a8cc72, 0xb901c283, 0x32325f78, 0xc6fe6c62, 0xf3fb2a4d, 0x49e1644f, 0x6d962e42,
|
||||
0x1005cdc0, 0x7030d3ba, 0xa87f236a, 0xa8e1b1b5, 0x3c830c6b, 0x4d54dc5c, 0x4c40df37, 0x2d82bcf3,
|
||||
|
|
@ -163,19 +177,22 @@ int runTest::start(uint32_t* coreBaseAddr, int node)
|
|||
// Run the main tests
|
||||
|
||||
if (enable.e & avalonBus)
|
||||
error |= avalon_bus_test (pCore, node);
|
||||
error |= avalon_bus_test (pCore, node);
|
||||
|
||||
if (enable.e & waveSeq)
|
||||
error |= wave_seq_test (pCore, node);
|
||||
error |= wave_seq_test (pCore, node);
|
||||
|
||||
if (enable.e & uartAddr)
|
||||
error |= uart_addr_test (pCore, node);
|
||||
error |= uart_addr_test (pCore, node);
|
||||
|
||||
if (enable.e & subPixel)
|
||||
error |= sub_pixel_firing_test (pCore, node);
|
||||
|
||||
if (enable.e & dataCore)
|
||||
error |= data_core_test (pCore, node);
|
||||
error |= data_core_test (pCore, node);
|
||||
|
||||
if (enable.e & printStreamer)
|
||||
error |= print_streamer_test (pCore, node);
|
||||
error |= print_streamer_test (pCore, node);
|
||||
|
||||
if (enable.e & dataCore2Bpp)
|
||||
error |= data_core_multi_bpp_test (pCore, 2, node);
|
||||
|
|
@ -183,23 +200,24 @@ int runTest::start(uint32_t* coreBaseAddr, int node)
|
|||
if (enable.e & dataCore3Bpp)
|
||||
error |= data_core_multi_bpp_test (pCore, 3, node);
|
||||
|
||||
if (enable.e & fourHeads)
|
||||
error |= four_heads_test (pCore, node);
|
||||
if (enable.e & linkCrc)
|
||||
error |= link_crc_test (pCore, node);
|
||||
|
||||
if (enable.e & linkTrain)
|
||||
error |= link_train_test (pCore, node);
|
||||
|
||||
if (enable.e & shutdownMon)
|
||||
error |= shtdn_mon_test (pCore, node);
|
||||
error |= shtdn_mon_test (pCore, node);
|
||||
|
||||
if (enable.e & fpgaCfg)
|
||||
error |= fpga_cfg_test (pCore, node);
|
||||
error |= fpga_cfg_test (pCore, node);
|
||||
|
||||
if (enable.e & swimEntry)
|
||||
error |= swim_entry_test (pCore, node);
|
||||
error |= swim_entry_test (pCore, node);
|
||||
|
||||
if (enable.e & swimTxRx)
|
||||
error |= swim_txrx_test (pCore, node);
|
||||
error |= swim_txrx_test (pCore, node);
|
||||
|
||||
if (enable.e & linkTrain)
|
||||
error |= link_train_test (pCore, node);
|
||||
|
||||
if ((enable.e & all) != all)
|
||||
{
|
||||
|
|
@ -406,11 +424,11 @@ int runTest::avalon_bus_test (CCoreAuto* pCore, int node)
|
|||
uint32_t status;
|
||||
|
||||
CTestAuto* pTestBench = new CTestAuto((uint32_t*)(0));
|
||||
CFpmCtrl4Auto* pFpmCtrl = pCore->pFpmCtrl4;
|
||||
CPulseGenerator2Auto* pPulseGenerator0 = pCore->pPulseGenerator20;
|
||||
CPulseGenerator2Auto* pPulseGenerator1 = pCore->pPulseGenerator21;
|
||||
CPulseGenerator2Auto* pPulseGenerator2 = pCore->pPulseGenerator22;
|
||||
CPulseGenerator2Auto* pPulseGenerator3 = pCore->pPulseGenerator23;
|
||||
CFpmCtrl6Auto* pFpmCtrl = pCore->pFpmCtrl6;
|
||||
CPulseGenerator3Auto* pPulseGenerator0 = pCore->pPulseGenerator30;
|
||||
CPulseGenerator3Auto* pPulseGenerator1 = pCore->pPulseGenerator31;
|
||||
CPulseGenerator3Auto* pPulseGenerator2 = pCore->pPulseGenerator32;
|
||||
CPulseGenerator3Auto* pPulseGenerator3 = pCore->pPulseGenerator33;
|
||||
|
||||
VPrint("Starting Avalon bus tests\n");
|
||||
|
||||
|
|
@ -418,27 +436,14 @@ int runTest::avalon_bus_test (CCoreAuto* pCore, int node)
|
|||
|
||||
// Loop Write / Read CSR registers
|
||||
for (int i = 0; i < 16; i++) {
|
||||
pFpmCtrl->pFpmExtCtrl->SetFpmExtCtrl(0xaa551234 + i);
|
||||
pPulseGenerator0->pPdOffsetDir0->SetPdOffsetDir0(0xabcdef01 + i);
|
||||
pPulseGenerator0->pPdOffsetDir1->SetPdOffsetDir1(0x12345678 + i);
|
||||
pPulseGenerator1->pPdOffsetDir0->SetPdOffsetDir0(0x1abcdef0 + i);
|
||||
pPulseGenerator1->pPdOffsetDir1->SetPdOffsetDir1(0x81234567 + i);
|
||||
pFpmCtrl->pCoarseTimeInit->SetCoarseTimeInit(0xaa55aa55 + i);
|
||||
pPulseGenerator2->pPdOffsetDir0->SetPdOffsetDir0(0x01abcdef + i);
|
||||
pPulseGenerator2->pPdOffsetDir1->SetPdOffsetDir1(0x78123456 + i);
|
||||
pPulseGenerator3->pPdOffsetDir0->SetPdOffsetDir0(0xf01abcde + i);
|
||||
pPulseGenerator3->pPdOffsetDir1->SetPdOffsetDir1(0x67812345 + i);
|
||||
|
||||
uint32_t ret;
|
||||
|
||||
if ((ret = pFpmCtrl->pFpmExtCtrl->GetFpmExtCtrl()) != (0xaa551234 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
VPrint("**ERROR 601 : Avalon bus data failure loop %d (got = 0x%08x exp = 0x%08x).\n", i, ret, 0xaa551234 + i);
|
||||
foundError = true;
|
||||
error |= 1;
|
||||
}
|
||||
|
||||
if ((ret = pPulseGenerator0->pPdOffsetDir0->GetPdOffsetDir0()) != (0xabcdef01 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
|
|
@ -447,16 +452,6 @@ int runTest::avalon_bus_test (CCoreAuto* pCore, int node)
|
|||
error |= 1;
|
||||
}
|
||||
|
||||
#ifdef PDOFFSETDIR1_PRESET
|
||||
if ((ret = pPulseGenerator0->pPdOffsetDir1->GetPdOffsetDir1()) != (0x12345678 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
VPrint("**ERROR 603 : Avalon bus data failure loop %d (got = 0x%08x exp = 0x%08x).\n", i, ret, 0x12345678 + i);
|
||||
foundError = true;
|
||||
error |= 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ret = pPulseGenerator1->pPdOffsetDir0->GetPdOffsetDir0()) != (0x1abcdef0 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
|
|
@ -465,15 +460,6 @@ int runTest::avalon_bus_test (CCoreAuto* pCore, int node)
|
|||
error |= 1;
|
||||
}
|
||||
|
||||
#ifdef PDOFFSETDIR1_PRESET
|
||||
if ((ret = pPulseGenerator1->pPdOffsetDir1->GetPdOffsetDir1()) != (0x81234567 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
VPrint("**ERROR 605 : Avalon bus data failure loop %d (got = 0x%08x exp = 0x%08x).\n", i, ret, 0x81234567 + i);
|
||||
foundError = true;
|
||||
error |= 1;
|
||||
}
|
||||
#endif
|
||||
if ((ret = pFpmCtrl->pCoarseTimeInit->GetCoarseTimeInit()) != (0xaa55aa55 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
|
|
@ -490,16 +476,6 @@ int runTest::avalon_bus_test (CCoreAuto* pCore, int node)
|
|||
error |= 1;
|
||||
}
|
||||
|
||||
#ifdef PDOFFSETDIR1_PRESET
|
||||
if ((ret = pPulseGenerator2->pPdOffsetDir1->GetPdOffsetDir1()) != (0x78123456 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
VPrint("**ERROR 608 : Avalon bus data failure loop %d (got = 0x%08x exp = 0x%08x).\n", i, ret, 0x78123456 + i);
|
||||
foundError = true;
|
||||
error |= 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ret = pPulseGenerator3->pPdOffsetDir0->GetPdOffsetDir0()) != (0xf01abcde + i))
|
||||
{
|
||||
if (!foundError)
|
||||
|
|
@ -507,16 +483,6 @@ int runTest::avalon_bus_test (CCoreAuto* pCore, int node)
|
|||
foundError = true;
|
||||
error |= 1;
|
||||
}
|
||||
|
||||
#ifdef PDOFFSETDIR1_PRESET
|
||||
if ((ret = pPulseGenerator3->pPdOffsetDir1->GetPdOffsetDir1()) != (0x67812345 + i))
|
||||
{
|
||||
if (!foundError)
|
||||
VPrint("**ERROR 610 : Avalon bus data failure loop %d (got = 0x%08x exp = 0x%08x).\n", i, ret, 0x67812345 + i);
|
||||
foundError = true;
|
||||
error |= 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
@ -1103,6 +1069,9 @@ int runTest::data_core_test (CCoreAuto* pCore, int node)
|
|||
pPrintCtrl->pPrintUnit3->pGenericSequencer15Wav0->pVector->SetVector(waveVector);
|
||||
pPrintCtrl->pPrintUnit3->pGenericSequencer15Wav1->pVector->SetVector(waveVector);
|
||||
|
||||
CPrintRxAuto* pPrintRx[8] = { pTestBench->pPrintRxA, pTestBench->pPrintRxB, pTestBench->pPrintRxC, pTestBench->pPrintRxD,
|
||||
pTestBench->pPrintRxE, pTestBench->pPrintRxF, pTestBench->pPrintRxG, pTestBench->pPrintRxH };
|
||||
|
||||
bool fired_early = false;
|
||||
|
||||
// Send out two stripes
|
||||
|
|
@ -1110,15 +1079,13 @@ int runTest::data_core_test (CCoreAuto* pCore, int node)
|
|||
{
|
||||
|
||||
// Reset the state in the print data receiver prior to firing the sequence
|
||||
pTestBench->pPrintRxA->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxB->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxC->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxD->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxE->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxF->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxG->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxH->pLatchClear->SetLatchClear(1);
|
||||
|
||||
for (int shead = 0; shead < numHeads*subHeads; shead++) {
|
||||
pPrintRx[shead]->pClear->SetClear(1);
|
||||
pPrintRx[shead]->pLatchClear->SetLatchClear(1);
|
||||
pPrintRx[shead]->pSeenLatch->SetSeenLatch(1);
|
||||
}
|
||||
|
||||
|
||||
// Send fire request from CPU. On Second iteration will be early, while previous stripe still active (but not droppy).
|
||||
pPrintCtrl->pCpuFireReq->SetCpuFireReq(0);
|
||||
|
||||
|
|
@ -1128,24 +1095,19 @@ int runTest::data_core_test (CCoreAuto* pCore, int node)
|
|||
(pTestBench->pPrintRxE->pSeenLatch->GetSeenLatch() == 0) || (pTestBench->pPrintRxF->pSeenLatch->GetSeenLatch() == 0) ||
|
||||
(pTestBench->pPrintRxG->pSeenLatch->GetSeenLatch() == 0) || (pTestBench->pPrintRxH->pSeenLatch->GetSeenLatch() == 0))
|
||||
{
|
||||
// Send fire request from CPU in the middle of the sequence to cause a 'droppy'
|
||||
// situation. The middle stripe (deadbeef data) should be skipped.
|
||||
if (!fired_early) {
|
||||
VTick(500, node);
|
||||
pPrintCtrl->pCpuFireReq->SetCpuFireReq(0);
|
||||
fired_early = true;
|
||||
}
|
||||
// Send fire request from CPU in the middle of the sequence to cause a 'droppy'
|
||||
// situation. The middle stripe (deadbeef data) should be skipped.
|
||||
if (!fired_early) {
|
||||
VTick(500, node);
|
||||
pPrintCtrl->pCpuFireReq->SetCpuFireReq(0);
|
||||
fired_early = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear 'seen latch state'
|
||||
pTestBench->pPrintRxA->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxB->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxC->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxD->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxE->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxF->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxG->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxH->pSeenLatch->SetSeenLatch(1);
|
||||
for (int shead = 0; shead < numHeads*subHeads; shead++) {
|
||||
pPrintRx[shead]->pSeenLatch->SetSeenLatch(1);
|
||||
}
|
||||
|
||||
// Get the base addresses of the latches
|
||||
uint32_t* pRxLatchDataL[4];
|
||||
|
|
@ -1303,23 +1265,27 @@ int runTest::print_streamer_test (CCoreAuto* pCore, int node)
|
|||
}
|
||||
|
||||
// Reset the state in the print data receiver prior to firing the sequence
|
||||
pTestBench->pPrintRxA->pClear->SetClear(1);
|
||||
pTestBench->pPrintRxA->pLatchClear->SetLatchClear(1);
|
||||
|
||||
pTestBench->pPrintRxB->pClear->SetClear(1);
|
||||
pTestBench->pPrintRxB->pLatchClear->SetLatchClear(1);
|
||||
pTestBench->pPrintRxB->pClear->SetClear(1);
|
||||
pTestBench->pPrintRxB->pLatchClear->SetLatchClear(1);
|
||||
|
||||
// Send fire request from CPU
|
||||
pPrintCtrl->pCpuFireReq->SetCpuFireReq(0);
|
||||
|
||||
// Wait until latch seen at head
|
||||
while(pTestBench->pPrintRxA->pSeenLatch->GetSeenLatch() == 0)
|
||||
while((pTestBench->pPrintRxA->pSeenLatch->GetSeenLatch() == 0) || (pTestBench->pPrintRxA->pSeenLatch->GetSeenLatch() == 0))
|
||||
{
|
||||
//VTick(10);
|
||||
}
|
||||
|
||||
// Clear 'seen latch state'
|
||||
pTestBench->pPrintRxA->pSeenLatch->SetSeenLatch(1);
|
||||
pTestBench->pPrintRxB->pSeenLatch->SetSeenLatch(1);
|
||||
|
||||
// Get the base addresses of the latches
|
||||
uint32_t* pRxLatchData = (uint32_t*)pTestBench->pPrintRxA->GetCsrBaseAddr();
|
||||
uint32_t* pRxLatchDataL = (uint32_t*)pTestBench->pPrintRxA->GetCsrBaseAddr();
|
||||
uint32_t* pRxLatchDataR = (uint32_t*)pTestBench->pPrintRxB->GetCsrBaseAddr();
|
||||
|
||||
bool foundError = false;
|
||||
|
||||
|
|
@ -1329,7 +1295,10 @@ int runTest::print_streamer_test (CCoreAuto* pCore, int node)
|
|||
uint32_t data;
|
||||
|
||||
// Read the next latch value.
|
||||
csrReadMem((uint32_t)(pRxLatchData + idx), &data);
|
||||
if ((idx / (stripeSize1BppWords / 2)) % 2 == 0)
|
||||
csrReadMem((uint32_t)(pRxLatchDataL + (idx % (stripeSize1BppWords / 2))), &data);
|
||||
else
|
||||
csrReadMem((uint32_t)(pRxLatchDataR + (idx % (stripeSize1BppWords / 2))), &data);
|
||||
|
||||
uint32_t expValue = STRIPE_1BPP0[idx % 100];
|
||||
|
||||
|
|
@ -2093,6 +2062,167 @@ int runTest::four_heads_test (CCoreAuto* pCore, int node)
|
|||
return error;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// Sub pixel firing test
|
||||
// --------------------------------------------------
|
||||
int runTest::sub_pixel_firing_test (CCoreAuto* pCore, int node)
|
||||
{
|
||||
int error = NOERROR;
|
||||
CPrintCtrlAuto* pPrintCtrl = pCore->pPrintCtrl;
|
||||
CTestAuto* pTestBench = new CTestAuto((uint32_t*)(0));
|
||||
|
||||
// Calculate the size of a stripe in DWords
|
||||
uint32_t stripeSize1BppWords = (maxOpWidth*shiftDepth/32);
|
||||
|
||||
VPrint("Starting Sub Pixel Firing tests\n");
|
||||
|
||||
// Do the data path common setup to get to a known starting point
|
||||
error |= common_data_setup (pCore, node);
|
||||
|
||||
// reset the pixel buffer
|
||||
pPrintCtrl->pControl->SetClearPxBuf(0x3);
|
||||
|
||||
// For all heads
|
||||
for (int head = 0; head < numHeads; head++) {
|
||||
// Fill the TB memory with a pattern.
|
||||
for (int idx = 0; idx <= 2*stripeSize1BppWords; idx++)
|
||||
{
|
||||
uint32_t addr = MEM_BASE_ADDR + head * 4 * stripeSize1BppWords * 4 + idx*4;
|
||||
|
||||
directWriteMem (addr, STRIPE_1BPP0[(idx + head * stripeSize1BppWords) % 100] ^ (idx + head * stripeSize1BppWords), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Get a pointer to data streamers
|
||||
CDataStreamerAuto* pDs[4] = { pPrintCtrl->pPrintStreamer->pDataStreamer0,
|
||||
pPrintCtrl->pPrintStreamer->pDataStreamer1,
|
||||
pPrintCtrl->pPrintStreamer->pDataStreamer2,
|
||||
pPrintCtrl->pPrintStreamer->pDataStreamer3 };
|
||||
|
||||
for (int head = 0; head < numHeads; head++) {
|
||||
// Check the queue space is 16
|
||||
if (pDs[head]->pStatus->GetQueueSpace() != 16)
|
||||
{
|
||||
VPrint("**ERROR 502 : Initial queue status bad head : %d\n", head);
|
||||
error |= TEST_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a linked list of data streamer commands at an offset in memory
|
||||
uint32_t cmdListOffset = 0x6000;
|
||||
|
||||
for (int head = 0; head < numHeads; head++) {
|
||||
// Set a pointer to the start of the linked list
|
||||
uint32_t* memAddr = (uint32_t*)(MEM_BASE_ADDR + cmdListOffset + head * 0x100);
|
||||
|
||||
// This command is to loop once (i.e. execute twice)
|
||||
uint32_t loop = 1;
|
||||
|
||||
// Store RD_DATA_PADDR command for print streamer, Destination is head 0, size is 2 * 96 words
|
||||
// Note: writeDsCmd to memory uses direct method and auto-increments memAddr.
|
||||
writeDsCmd(memAddr, rdDataPaddr, headDest0, loop, stripeSize1BppWords/2, MEM_BASE_ADDR + head * 4 * stripeSize1BppWords * 4);
|
||||
|
||||
// Store RD_DATA_PADDR command for print streamer, Destination is head 0, size is 1 * 192 words, fetching from end of last command
|
||||
loop = 0;
|
||||
writeDsCmd(memAddr, rdDataPaddr, headDest0, loop, stripeSize1BppWords, MEM_BASE_ADDR + head * 4 * stripeSize1BppWords * 4);
|
||||
|
||||
// Send LD_CMD_Q_PADDR command to data streamer 0 to start reading linked list commands
|
||||
writeDsCmd(pDs[head], loadCmdQPaddr, cmdQueueDest, loop, 4, MEM_BASE_ADDR + cmdListOffset + head * 0x100);
|
||||
|
||||
// Wait for transfer to complete
|
||||
while(pDs[head]->pStatus->GetAutoCmdActive())
|
||||
{
|
||||
usleepSim(10);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the state in the print data receiver prior to firing the sequence
|
||||
CPrintRxAuto* pPrintRx[8] = { pTestBench->pPrintRxA, pTestBench->pPrintRxB, pTestBench->pPrintRxC, pTestBench->pPrintRxD,
|
||||
pTestBench->pPrintRxE, pTestBench->pPrintRxF, pTestBench->pPrintRxG, pTestBench->pPrintRxH };
|
||||
|
||||
for (int shead = 0; shead < numHeads*subHeads; shead++) {
|
||||
pPrintRx[shead]->pClear->SetClear(1);
|
||||
}
|
||||
|
||||
// Get the base addresses of the latches
|
||||
uint32_t* pRxLatchDataL[4];
|
||||
uint32_t* pRxLatchDataR[4];
|
||||
|
||||
pRxLatchDataL[0] = (uint32_t*)pTestBench->pPrintRxA->GetCsrBaseAddr();
|
||||
pRxLatchDataL[1] = (uint32_t*)pTestBench->pPrintRxC->GetCsrBaseAddr();
|
||||
pRxLatchDataL[2] = (uint32_t*)pTestBench->pPrintRxE->GetCsrBaseAddr();
|
||||
pRxLatchDataL[3] = (uint32_t*)pTestBench->pPrintRxG->GetCsrBaseAddr();
|
||||
pRxLatchDataR[0] = (uint32_t*)pTestBench->pPrintRxB->GetCsrBaseAddr();
|
||||
pRxLatchDataR[1] = (uint32_t*)pTestBench->pPrintRxD->GetCsrBaseAddr();
|
||||
pRxLatchDataR[2] = (uint32_t*)pTestBench->pPrintRxF->GetCsrBaseAddr();
|
||||
pRxLatchDataR[3] = (uint32_t*)pTestBench->pPrintRxH->GetCsrBaseAddr();
|
||||
|
||||
for (int shead = 0; shead < numHeads*subHeads; shead++) {
|
||||
// Reset the state in the print data receiver prior to firing the sequence
|
||||
pPrintRx[shead]->pLatchClear->SetLatchClear(1);
|
||||
}
|
||||
|
||||
// Configure the FPM for numStripes stripes, at a *pixel* rate of 20KHz
|
||||
// with a division ratio of 4, and four phases
|
||||
configFpmForEmulPulses (pCore,
|
||||
15.0, // Pixel frequency
|
||||
32.0, // divider ratio
|
||||
32, // Number of subpixel phases
|
||||
clkFreqMHz, // FPM logic clock frequency
|
||||
fpmSeq, // Sequence to load
|
||||
fpmSeqLen); // Length of the sequence
|
||||
|
||||
// Generate a product detect to set off the two stripes (as configured in the sequence), and wait a bit
|
||||
generatePDs (pCore,
|
||||
1, // Number of product detects to generate
|
||||
200000); // Time (in ns) to pause between PDs
|
||||
|
||||
VPrint("Configured and started FPM 6\n");
|
||||
|
||||
// Wait for the second stripe to arrive
|
||||
for (int shead = 0; shead < numHeads*subHeads; shead++) {
|
||||
while(pPrintRx[shead]->pClkCnt->GetClkCnt() != 1024);
|
||||
}
|
||||
|
||||
bool foundError = false;
|
||||
|
||||
// Check all sub heads
|
||||
for (int head = 0; head < numHeads; head++)
|
||||
// Check intermediate latch values after first wave data...
|
||||
for (int idx = 0; idx < stripeSize1BppWords; idx++)
|
||||
{
|
||||
uint32_t data;
|
||||
uint32_t exp_data;
|
||||
|
||||
// Read the next latch value.
|
||||
if ((idx / (stripeSize1BppWords / 2)) % 2 == 0)
|
||||
csrReadMem((uint32_t)(pRxLatchDataL[head] + (idx % (stripeSize1BppWords / 2))), &data);
|
||||
else
|
||||
csrReadMem((uint32_t)(pRxLatchDataR[head] + (idx % (stripeSize1BppWords / 2))), &data);
|
||||
|
||||
// Compare with expected result
|
||||
if (data != (exp_data = STRIPE_1BPP0[(head * stripeSize1BppWords + idx + stripeSize1BppWords * 2 * 0) % 100] ^ (idx + head * stripeSize1BppWords)))
|
||||
{
|
||||
if (!foundError)
|
||||
{
|
||||
VPrint("**ERROR 503 : Data core wave 0 latch value failure from sub head = %d idx = %d (data = 0x%08x exp = 0x%08x)\n",
|
||||
head * 2 + (idx >= stripeSize1BppWords/2 ? 1:0),
|
||||
idx,
|
||||
data,
|
||||
exp_data);
|
||||
foundError = true;
|
||||
}
|
||||
error |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for sequence to finish
|
||||
while (pPrintCtrl->pSeqStatusA->GetPrintSeqBusy())
|
||||
{
|
||||
usleepSim(10);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// Common setup method for data path tests
|
||||
// --------------------------------------------------
|
||||
|
|
@ -2237,7 +2367,7 @@ int runTest::link_train_test(CCoreAuto* pCore, int node)
|
|||
|
||||
CTestAuto* pTestBench = new CTestAuto((uint32_t*)(0));
|
||||
|
||||
VPrint(" Starting link training tests\n");
|
||||
VPrint("Starting link training tests\n");
|
||||
|
||||
// Write scratch register
|
||||
i2cWrite(I2C_ADDR_SCRATCH0, 0x55, pTestBench);
|
||||
|
|
@ -2313,6 +2443,79 @@ int runTest::link_train_test(CCoreAuto* pCore, int node)
|
|||
return error;
|
||||
}
|
||||
|
||||
int runTest::link_crc_test(CCoreAuto* pCore, int node)
|
||||
{
|
||||
uint32_t error = 0;
|
||||
uint32_t dataA, dataB, dataC, dataD;
|
||||
uint32_t errL, errR;
|
||||
|
||||
CTestAuto* pTestBench = new CTestAuto((uint32_t*)(0));
|
||||
|
||||
VPrint("Starting crc tests\n");
|
||||
|
||||
// Read link A/B errors registers
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L3, dataA, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L2, dataB, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L1, dataC, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L0, dataD, pTestBench);
|
||||
|
||||
errL = (dataA << 24) | (dataB << 16) | (dataC << 8) | (dataD << 0);
|
||||
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R3, dataA, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R2, dataB, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R1, dataC, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R0, dataD, pTestBench);
|
||||
|
||||
errR = (dataA << 24) | (dataB << 16) | (dataC << 8) | (dataD << 0);
|
||||
|
||||
if (errL != 0x01)
|
||||
{
|
||||
VPrint("**ERROR 1400: Bad cnt error number for Channel L. (got 0x%02x, exp 0x%02x)\n", errL, 0x01);
|
||||
error |= 1;
|
||||
}
|
||||
|
||||
if (errR != 0x01)
|
||||
{
|
||||
VPrint("**ERROR 1401: Bad cnt error number for Channel R. (got 0x%02x, exp 0x%02x)\n", errR, 0x01);
|
||||
error |= 1;
|
||||
}
|
||||
|
||||
VPrint(" Clearing errors...\n");
|
||||
|
||||
// Clear CRC counters
|
||||
i2cWrite(I2C_ADDR_CNT_ERR_L3, 0x00, pTestBench);
|
||||
i2cWrite(I2C_ADDR_CNT_ERR_R3, 0x00, pTestBench);
|
||||
|
||||
// Read link A/B errors registers
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L3, dataA, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L2, dataB, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L1, dataC, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_L0, dataD, pTestBench);
|
||||
|
||||
errL = (dataA << 24) | (dataB << 16) | (dataC << 8) | (dataD << 0);
|
||||
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R3, dataA, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R2, dataB, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R1, dataC, pTestBench);
|
||||
i2cRead(I2C_ADDR_CNT_ERR_R0, dataD, pTestBench);
|
||||
|
||||
errR = (dataA << 24) | (dataB << 16) | (dataC << 8) | (dataD << 0);
|
||||
|
||||
if (errL != 0x00)
|
||||
{
|
||||
VPrint("**ERROR 1402: Bad cnt error number for Channel L. (got 0x%02x, exp 0x%02x)\n", errL, 0x00);
|
||||
error |= 1;
|
||||
}
|
||||
|
||||
if (errR != 0x00)
|
||||
{
|
||||
VPrint("**ERROR 1403: Bad cnt error number for Channel R. (got 0x%02x, exp 0x%02x)\n", errR, 0x00);
|
||||
error |= 1;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// I2C write method
|
||||
// --------------------------------------------------
|
||||
|
|
@ -2372,4 +2575,63 @@ uint32_t runTest::i2cRead(uint32_t hmb_addr, uint32_t &data, CTestAuto* pTestBen
|
|||
data = rd_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Configure the FPM's pulse generator
|
||||
//
|
||||
int fpmConfig(CCoreAuto* pCore, double divRatio, uint32_t numSubPixPhases, uint32_t seq[], uint32_t seqLen)
|
||||
{
|
||||
|
||||
CPulseGenerator3Auto* pPulseGen[4] = { pCore->pPulseGenerator30, pCore->pPulseGenerator31, pCore->pPulseGenerator32, pCore->pPulseGenerator33 };
|
||||
|
||||
for (int ch = 0; ch < 4; ch++)
|
||||
{
|
||||
|
||||
// Program the sequence if a buffer pointer is provided and the length isn't zero.
|
||||
if (seq != NULL && seqLen != 0)
|
||||
{
|
||||
// Load the sequencer with default program
|
||||
uint32_t seqBaseAddr = (uint32_t)pPulseGen[ch]->GetCsrBaseAddr() + CSR_PULSE_GENERATOR_3_CHANNEL_CONTROLLER_SEQ;
|
||||
|
||||
for(int idx = 0; idx < seqLen; idx++)
|
||||
{
|
||||
csrWriteMem(seqBaseAddr + idx*4, seq[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
// Disable/Re-enable first the whole pulse_generator
|
||||
pPulseGen[ch]->pPulseGenControl->SetPulseGenControl(0);
|
||||
pPulseGen[ch]->pPulseGenControl->SetEnable(1);
|
||||
pPulseGen[ch]->pPulseGenControl->SetEnableOutput(1);
|
||||
|
||||
// Disable the Channel Controller sequencer
|
||||
pPulseGen[ch]->pChannelControllerControl->SetChannelControllerControl(0);
|
||||
|
||||
// Set the number of sub-pixel phases
|
||||
pPulseGen[ch]->pSubpixelPhaseNum->SetSubpixelPhaseNum(numSubPixPhases);
|
||||
|
||||
// Set the integer part of the div-ratio
|
||||
uint64_t ratio_int = ((divRatio/(double)numSubPixPhases) * (double)(1UL << 24));
|
||||
|
||||
pPulseGen[ch]->pDividerRatioInt->SetDividerRatioInt((uint32_t)(ratio_int >> 24));
|
||||
|
||||
// Set the fractional part of the div-ratio
|
||||
pPulseGen[ch]->pDividerRatioFraction->SetDividerRatioFraction((uint32_t)(ratio_int & ((1UL << 24)-1)));
|
||||
|
||||
// ----
|
||||
|
||||
// Disable/Enable the fractional divider
|
||||
pPulseGen[ch]->pFractionalDividerControl->SetFractionalDividerControl(0);
|
||||
pPulseGen[ch]->pFractionalDividerControl->SetFractionalDividerControl(CSR_PULSE_GENERATOR_3_FRACTIONAL_DIVIDER_CONTROL_ENABLE_MASK |
|
||||
CSR_PULSE_GENERATOR_3_FRACTIONAL_DIVIDER_CONTROL_UDP_MAX_POS_MASK |
|
||||
CSR_PULSE_GENERATOR_3_FRACTIONAL_DIVIDER_CONTROL_UDP_MIN_POS_MASK);
|
||||
|
||||
// enable the ch-ctrl sequencer
|
||||
pPulseGen[ch]->pGenericSequencer15Channel->pCtrl->SetSeqEnable(1);
|
||||
|
||||
|
||||
// Issue a start_req to the ch-ctrl sequencer
|
||||
pPulseGen[ch]->pChannelControllerControl->SetChannelControllerControl(1);
|
||||
}
|
||||
};
|
||||
|
|
@ -24,8 +24,10 @@ extern "C" {
|
|||
#include "runTestLocal.h"
|
||||
#include "streamerUtils.h"
|
||||
#include "swimUtils.h"
|
||||
#include "fpm6Utils.h"
|
||||
|
||||
class runTest : public streamerUtils, swimUtils
|
||||
|
||||
class runTest : public streamerUtils, swimUtils, fpm6Utils
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
@ -93,15 +95,16 @@ public:
|
|||
avalonBus = 0x00000008,
|
||||
fpgaCfg = 0x00000010,
|
||||
uartAddr = 0x00000020,
|
||||
dataCore = 0x00000040,
|
||||
printStreamer = 0x00000080,
|
||||
dataCore2Bpp = 0x00000100,
|
||||
dataCore3Bpp = 0x00000200,
|
||||
shutdownMon = 0x00000400,
|
||||
fourHeads = 0x00000800,
|
||||
subPixel = 0x00000040,
|
||||
dataCore = 0x00000080,
|
||||
printStreamer = 0x00000100,
|
||||
dataCore2Bpp = 0x00000200,
|
||||
dataCore3Bpp = 0x00000400,
|
||||
shutdownMon = 0x00000800,
|
||||
pwm = 0x00001000,
|
||||
linkTrain = 0x00002000,
|
||||
all = 0x00002000
|
||||
linkCrc = 0x00004000,
|
||||
all = 0x00007fff
|
||||
};
|
||||
|
||||
union enables_t
|
||||
|
|
@ -157,6 +160,8 @@ private:
|
|||
int pwm_test (CCoreAuto* pCore, int node);
|
||||
int common_data_setup (CCoreAuto* pCore, int node);
|
||||
int link_train_test (CCoreAuto* pCore, int node);
|
||||
int sub_pixel_firing_test (CCoreAuto* pCore, int node);
|
||||
int link_crc_test (CCoreAuto* pCore, int node);
|
||||
|
||||
inline uint32_t constructWaveVector(
|
||||
const bool stm8Trig,
|
||||
|
|
@ -198,6 +203,12 @@ private:
|
|||
uint32_t subHeads;
|
||||
uint32_t clkFreqMHz;
|
||||
uint32_t i2cFreqKHz;
|
||||
|
||||
// ------------------------------------
|
||||
// Configure the FPM's pulse generator
|
||||
//
|
||||
int fpmConfig(CCoreAuto* pCore, double divRatio, uint32_t numSubPixPhases, uint32_t seq[], uint32_t seqLen);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,15 @@
|
|||
#define I2C_ADDR_WD_CTRL 0x0010
|
||||
#define I2C_ADDR_WD_STATUS 0x0011
|
||||
|
||||
#define I2C_ADDR_CNT_ERR_L3 0x0012
|
||||
#define I2C_ADDR_CNT_ERR_L2 0x0013
|
||||
#define I2C_ADDR_CNT_ERR_L1 0x0014
|
||||
#define I2C_ADDR_CNT_ERR_L0 0x0015
|
||||
#define I2C_ADDR_CNT_ERR_R3 0x0016
|
||||
#define I2C_ADDR_CNT_ERR_R2 0x0017
|
||||
#define I2C_ADDR_CNT_ERR_R1 0x0018
|
||||
#define I2C_ADDR_CNT_ERR_R0 0x0019
|
||||
|
||||
#define TEST_VAL1 0x12345678
|
||||
#define TEST_VAL2 0xfedcba98
|
||||
#define TEST_VAL3 0xcafef00d
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
add wave sim:/tb/*
|
||||
add wave -r sim:/tb/mem_model_inst/*
|
||||
add wave -r sim:/tb/test_csr_decode_inst/*
|
||||
add wave -r sim:/tb/test_csr_regs_inst/*
|
||||
add wave -r sim:/tb/i2c_master_inst/*
|
||||
|
|
@ -12,3 +13,5 @@ add wave -r sim:/tb/GEN_PRINT_RCVR(6)/*
|
|||
add wave -r sim:/tb/GEN_PRINT_RCVR(7)/*
|
||||
add wave -r sim:/tb/GEN_HMB_FPGA_TOP(0)/hmb_fpga_top_inst/*
|
||||
add wave -r sim:/tb/core_inst/*
|
||||
add wave /tb/core_inst/core_seq_decode_1/*
|
||||
add wave /tb/core_inst/core_csr_decode_1/*
|
||||
Loading…
Add table
Add a link
Reference in a new issue