1) This commit does not run. It has the head_proc modified

This commit is contained in:
David Rodriguez 2024-08-26 14:44:44 +01:00
commit 81a4182c87
2 changed files with 132 additions and 383 deletions

View file

@ -84,101 +84,45 @@ set_instance_assignment -name IO_STANDARD LVDS -to lvds_d_in[3]
set_location_assignment PIN_P2 -to lvds_d_in[3]
set_location_assignment PIN_P1 -to "lvds_d_in[3](n)"
set_location_assignment PIN_L7 -to id1
set_location_assignment PIN_M6 -to id0
set_location_assignment PIN_M7 -to a1
set_location_assignment PIN_L8 -to a0
set_location_assignment PIN_N5 -to lvdsoe
set_location_assignment PIN_N3 -to xhot_n
set_location_assignment PIN_M15 -to c1_clk
set_location_assignment PIN_M6 -to c2_clk
set_location_assignment PIN_E15 -to clk25_in
set_location_assignment PIN_N2 -to alert_out -disable
set_location_assignment PIN_C1 -to cfg_wdata
set_location_assignment PIN_D2 -to cfg_ncs
set_location_assignment PIN_B12 -to dac_out[79]
set_location_assignment PIN_A14 -to dac_out[78]
set_location_assignment PIN_B14 -to dac_out[77]
set_location_assignment PIN_A12 -to dac_out[76]
set_location_assignment PIN_E10 -to dac_out[75]
set_location_assignment PIN_E9 -to dac_out[74]
set_location_assignment PIN_B13 -to dac_out[72]
set_location_assignment PIN_A15 -to dac_out[71]
set_location_assignment PIN_C14 -to dac_out[70]
set_location_assignment PIN_A11 -to dac_out[59]
set_location_assignment PIN_B11 -to dac_out[56]
set_location_assignment PIN_C9 -to dac_out[55]
set_location_assignment PIN_D12 -to dac_out[67]
set_location_assignment PIN_D14 -to dac_out[60]
set_location_assignment PIN_D9 -to dac_out[54]
set_location_assignment PIN_E11 -to dac_out[61]
set_location_assignment PIN_A3 -to dac_out[58]
set_location_assignment PIN_A4 -to dac_out[51]
set_location_assignment PIN_A5 -to dac_out[49]
set_location_assignment PIN_A6 -to dac_out[47]
set_location_assignment PIN_A7 -to dac_out[46]
set_location_assignment PIN_B3 -to dac_out[52]
set_location_assignment PIN_B4 -to dac_out[57]
set_location_assignment PIN_B5 -to dac_out[48]
set_location_assignment PIN_B6 -to dac_out[45]
set_location_assignment PIN_B7 -to dac_out[40]
set_location_assignment PIN_C8 -to dac_out[42]
set_location_assignment PIN_D3 -to dac_out[50]
set_location_assignment PIN_D6 -to dac_out[43]
set_location_assignment PIN_D8 -to dac_out[44]
set_location_assignment PIN_M8 -to dac_out[11]
set_location_assignment PIN_N8 -to dac_out[9]
set_location_assignment PIN_P8 -to dac_out[10]
set_location_assignment PIN_R3 -to dac_out[15]
set_location_assignment PIN_R4 -to dac_out[3]
set_location_assignment PIN_R5 -to dac_out[1]
set_location_assignment PIN_R6 -to dac_out[5]
set_location_assignment PIN_R7 -to dac_out[8]
set_location_assignment PIN_T4 -to dac_out[2]
set_location_assignment PIN_T5 -to dac_out[0]
set_location_assignment PIN_T6 -to dac_out[6]
set_location_assignment PIN_T7 -to dac_out[7]
set_location_assignment PIN_K9 -to dac_out[17]
set_location_assignment PIN_L10 -to dac_out[12]
set_location_assignment PIN_L9 -to dac_out[18]
set_location_assignment PIN_N11 -to dac_out[35]
set_location_assignment PIN_N9 -to dac_out[34]
set_location_assignment PIN_P14 -to dac_out[31]
set_location_assignment PIN_R11 -to dac_out[24]
set_location_assignment PIN_R12 -to dac_out[21]
set_location_assignment PIN_R13 -to dac_out[26]
set_location_assignment PIN_R14 -to dac_out[29]
set_location_assignment PIN_T10 -to dac_out[23]
set_location_assignment PIN_T11 -to dac_out[22]
set_location_assignment PIN_T13 -to dac_out[25]
set_location_assignment PIN_T14 -to dac_out[27]
set_location_assignment PIN_T15 -to dac_out[28]
set_location_assignment PIN_K15 -to dac_out[19]
set_location_assignment PIN_K16 -to dac_out[16]
set_location_assignment PIN_L13 -to dac_out[20]
set_location_assignment PIN_L16 -to dac_out[13]
set_location_assignment PIN_N14 -to dac_out[33]
set_location_assignment PIN_N15 -to dac_out[38]
set_location_assignment PIN_N16 -to dac_out[32]
set_location_assignment PIN_P15 -to dac_out[37]
set_location_assignment PIN_R16 -to dac_out[30]
set_location_assignment PIN_T3 -to dac_out[4]
set_location_assignment PIN_P6 -to dac_out[14]
set_location_assignment PIN_L14 -to dac_out[39]
set_location_assignment PIN_L15 -to dac_out[36]
set_location_assignment PIN_F13 -to dac_out[62]
set_location_assignment PIN_F14 -to dac_out[63]
set_location_assignment PIN_A13 -to dac_out[73]
set_location_assignment PIN_C11 -to dac_out[53]
set_location_assignment PIN_C6 -to dac_out[41]
set_location_assignment PIN_C15 -to dac_out[69]
set_location_assignment PIN_C16 -to dac_out[68]
set_location_assignment PIN_D15 -to dac_out[65]
set_location_assignment PIN_D16 -to dac_out[66]
set_location_assignment PIN_F15 -to dac_out[64]
set_location_assignment PIN_J15 -to debug_out[5]
set_location_assignment PIN_J16 -to debug_out[4]
set_location_assignment PIN_G11 -to debug_out[3]
set_location_assignment PIN_F9 -to debug_out[2]
set_location_assignment PIN_J12 -to debug_out[1]
set_location_assignment PIN_N9 -to two_col
set_location_assignment PIN_L15 -to head_lat[0]
set_location_assignment PIN_R4 -to head_lat[1]
set_location_assignment PIN_P8 -to head_data[0]
set_location_assignment PIN_R5 -to head_data[6]
set_location_assignment PIN_R6 -to head_data[3]
set_location_assignment PIN_R7 -to head_data[1]
set_location_assignment PIN_T4 -to head_data[7]
set_location_assignment PIN_T5 -to head_data[5]
set_location_assignment PIN_T6 -to head_data[4]
set_location_assignment PIN_T7 -to head_data[2]
set_location_assignment PIN_G15 -to v_en[1]
set_location_assignment PIN_G16 -to v_en[2]
set_location_assignment PIN_E6 -to v_en[0]
set_location_assignment PIN_F8 -to v_en[3]
set_location_assignment PIN_K5 -to stm8_alert_in[0]
set_location_assignment PIN_P16 -to sda_fpga
set_location_assignment PIN_B16 -to scl_fpga
set_location_assignment PIN_C3 -to shutdn
set_location_assignment PIN_K10 -to wf_sel[0]
set_location_assignment PIN_R10 -to wf_sel[1]
set_location_assignment PIN_T12 -to wf_sel[2]
set_location_assignment PIN_A9 -to temp_alert_in
set_location_assignment PIN_E2 -to stm8_alert_in[1]
set_location_assignment PIN_E8 -to dbg_ser_out
set_location_assignment PIN_E7 -to dbg_ser_in
set_location_assignment PIN_A10 -to nled_g
set_location_assignment PIN_D11 -to nled_r
set_location_assignment PIN_B10 -to nled_y
@ -198,26 +142,10 @@ set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall
set_location_assignment PIN_G15 -to v_en[1]
set_location_assignment PIN_G16 -to v_en[2]
set_location_assignment PIN_E6 -to v_en[0]
set_location_assignment PIN_F8 -to v_en[3]
set_location_assignment PIN_K5 -to stm8_alert_in[0]
set_location_assignment PIN_P16 -to sda_fpga
set_location_assignment PIN_B16 -to scl_fpga
set_location_assignment PIN_C3 -to shutdn
set_location_assignment PIN_K10 -to wf_sel[0]
set_location_assignment PIN_R10 -to wf_sel[1]
set_location_assignment PIN_T12 -to wf_sel[2]
set_location_assignment PIN_A9 -to temp_alert_in
set_location_assignment PIN_E2 -to stm8_alert_in[1]
set_location_assignment PIN_E8 -to dbg_ser_out
set_location_assignment PIN_E7 -to dbg_ser_in
set_global_assignment -name VHDL_INPUT_VERSION VHDL_2008
set_global_assignment -name VHDL_SHOW_LMF_MAPPING_MESSAGES OFF
set_global_assignment -name ENABLE_SIGNALTAP ON
set_global_assignment -name USE_SIGNALTAP_FILE output_files/stpI2C.stp
@ -245,4 +173,6 @@ set_global_assignment -name SOURCE_FILE db/pei_fpga_top.cmp.rdb
set_global_assignment -name SIGNALTAP_FILE stp1.stp
set_global_assignment -name SIGNALTAP_FILE output_files/stpI2C.stp
set_global_assignment -name CDF_FILE output_files/pei_fpga_top_cdf.cdf
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_global_assignment -name QIP_FILE head_data.qip
set_global_assignment -name QIP_FILE head_datain.qip

View file

@ -35,312 +35,131 @@ use work.pkg_functions_pei.all;
entity head_data_proc is
port (
rx_locked : in std_logic;
rx_data : in std_logic_vector (27 downto 0);
rx_data : in std_logic_vector (7 downto 0);
rx_clk : in std_logic;
rst_n : in std_logic;
cmd_reset : in std_logic;
clk_sys : in std_logic;
--decoded outputs
signature : out std_logic_vector (31 downto 0);
latch_pulse : out std_logic; -- indicates signature is valid and a latch has occurred
chA : out std_logic;
chB : out std_logic;
chC : out std_logic;
sp_table_comA : out std_logic_vector(15 downto 0);
sp_table_comB : out std_logic_vector(15 downto 0);
sp_table_comC : out std_logic_vector(15 downto 0)
latch_pulse : out std_logic -- indicates signature is valid and a latch has occurred
);
end entity head_data_proc;
architecture struct of head_data_proc is
type array_t is array (natural range <>) of std_logic_vector;
signal t_command : std_logic_vector(3 downto 0);
type command_type is (IDLE,DATA,COMMAND_HEAD, COMMAND_DATA1,COMMAND_DATA2,COMMAND_DATA3,COMMAND_DATA4, ERROR_COM,ERROR_DATA);
type t_modules_shift is array (0 to 5) of std_logic_vector(5 downto 0);
signal command_op_s : command_type;
signal command_shift_reg : array_t (5 downto 0)(5 downto 0);
signal data_command : array_t (5 downto 0)(1 downto 0);
signal rx_remap,data_pkt : std_logic_vector(27 downto 0);
signal rx_shift_reg : std_logic_vector(55 downto 0);
signal sftw_reset : std_logic;
signal chA_int, chB_int, chC_int : std_logic;
entity head_datain is
port
(
datain : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
inclock : IN STD_LOGIC ;
dataout_h : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
dataout_l : OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
);
end head_datain;
type array_t is array (1 downto 0) of std_logic_vector(7 downto 0);
signal rx_data_h : std_logic_vector(7 downto 0);
signal rx_data_l : std_logic_vector(7 downto 0);
signal rx_data_h_int : array_t;
signal rx_dats
-------------- test signals -----
signal latch,latch_d,nchg : std_logic;
signal latch_int : std_logic;
signal sig : std_logic_vector(31 downto 0);
signal sigLatched : std_logic_vector(31 downto 0);
signal sp_table_comA_int : std_logic_vector(15 downto 0);
signal sp_table_comB_int : std_logic_vector(15 downto 0);
signal sp_table_comC_int : std_logic_vector(15 downto 0);
signal d1_dataline : std_logic;
signal d2_dataline : std_logic;
signal d3_dataline : std_logic;
signal d4_dataline : std_logic;
begin
chA <= chA_int;--chA_int;
chB <= chB_int;
chC <= nchg;
head_datain_inst : head_datain port map
(
datain => rx_data,
inclock => rx_clk,
dataout_h => rx_data_h_in,
dataout_l => rx_data_l_in
);
latch_pulse <= latch_int;
signature <= sigLatched;
rx_remap <= REMAPD3000VEC(rx_data);
data_pkt <= rx_shift_reg(47 downto 20);
rx_data
cdc_data_p : process(crx_clk)
variable counter : integer;
begin
if rising_edge(rx_clk) then
rx_data_h_int(0) <= rx_data_h_in;
rx_data_h_int(1) <= rx_data_h_int(0);
rx_data_h_int(2) <= rx_data_h_int(1);
HEAD_PACK_DELAY: process (rx_clk, rst_n, rx_locked) -- add reset. It adds letancy
begin
if (rst_n = '0' or rx_locked = '0') then
rx_shift_reg <= (others => '0');
elsif (rx_clk'event and rx_clk = '1') then
rx_shift_reg( 55 downto 0) <= rx_shift_reg(27 downto 0) & rx_remap;
end if;
end process;
COMMAND_OP_P: process (rx_clk, rst_n, rx_locked)
begin
if (rst_n = '0' or rx_locked = '0') then
command_shift_reg <=(others => (others =>'0'));
t_command <= (others => '0');
elsif (rx_clk'event and rx_clk = '1') then
case command_op_s is
when IDLE =>
if data_pkt(DE1)= '1' and data_pkt(DE2) = '1' then
command_op_s <= DATA;
t_command <= (others => '0');
elsif data_pkt = commandvec then
command_op_s <= COMMAND_HEAD;
else
command_op_s <= IDLE;
end if;
when DATA =>
if data_pkt = commandvec then --command sent just after a data_packet
command_op_s <= COMMAND_HEAD;
elsif data_pkt(DE1)= '1' and data_pkt(DE2) = '1' then
command_op_s <= DATA;
else
command_op_s <= ERROR_DATA;
end if;
when COMMAND_HEAD=>
if data_pkt = commandvec then
command_op_s <= COMMAND_DATA1;
else
command_op_s <= ERROR_COM;
end if;
when COMMAND_DATA1 => --load shift register
if data_pkt(DE1)= '0' and data_pkt(DE2) = '0' then
for i in 0 to 5 loop
command_shift_reg(i)(5 downto 4) <= command_shift_reg(i)(3 downto 2);
command_shift_reg(i)(3 downto 2) <= command_shift_reg(i)(1 downto 0);
command_shift_reg(i)(1 downto 0) <= data_command(i); -- load the 2 bits of the command
end loop;
command_op_s <= COMMAND_DATA2;
else
command_op_s <= ERROR_COM;
end if;
when COMMAND_DATA2 => --load shift register
if data_pkt(DE1)= '0' and data_pkt(DE2) = '0' then
t_command <= command_shift_reg(0)(1 downto 0) & data_command(0);
for i in 0 to 5 loop
command_shift_reg(i)(5 downto 4) <= command_shift_reg(i)(3 downto 2);
command_shift_reg(i)(3 downto 2) <= command_shift_reg(i)(1 downto 0);
command_shift_reg(i)(1 downto 0) <= data_command(i); -- load the 2 bits of the command
end loop;
if t_command="0111" then --software reset command of T1 row. Assuming all rows have the same value
command_op_s <= COMMAND_DATA3;
else
command_op_s <= IDLE;
end if;
else
command_op_s <= ERROR_COM;
t_command <= (others =>'0');
end if;
when COMMAND_DATA3 => -- I am not creating a command for this case
if data_pkt(DE1)= '0' and data_pkt(DE2) = '0' then
for i in 0 to 5 loop
command_shift_reg(i)(5 downto 4) <= command_shift_reg(i)(3 downto 2);
command_shift_reg(i)(3 downto 2) <= command_shift_reg(i)(1 downto 0);
command_shift_reg(i)(1 downto 0) <= data_command(i); -- load the 2 bits of the command
end loop;
if t_command="0111" then --software reset command of T1 row. Assuming all rows have the same value
command_op_s <= COMMAND_DATA4;
else
command_op_s <= IDLE;
end if;
else
command_op_s <= ERROR_COM;
end if;
when COMMAND_DATA4 => -- I am not creating a command for this case
if data_pkt(DE1) = '0' and data_pkt(DE2) = '0' then
for i in 0 to 5 loop
command_shift_reg(i)(5 downto 4) <= command_shift_reg(i)(3 downto 2);
command_shift_reg(i)(3 downto 2) <= command_shift_reg(i)(1 downto 0);
command_shift_reg(i)(1 downto 0) <= data_command(i); -- load the 2 bits of the command
end loop;
if t_command= "0111" then --software reset command of T1 row. Assuming all rows have the same value
command_op_s <= IDLE;
t_command <= command_shift_reg(0)(3 downto 0); --the resgister should have a value of 1000
else
command_op_s <= IDLE;
end if;
else
command_op_s <= ERROR_COM;
end if;
when ERROR_COM =>
command_op_s <= IDLE;
when ERROR_DATA =>
command_op_s <= IDLE;
end case;
end if;
rx_data_l_int(0) <= rx_data_l_in;
rx_data_l_int(1) <= rx_data_l_int(0);
rx_data_l_int(2) <= rx_data_l_int(1);
latch_pulse_int(0) <= latch_pulse;
latch_pulse_int(1) <= latch_pulse_int(0);
latch_pulse_int(2) <= latch_pulse_int(1);
counter_rx := counter + 1;
pulse_sync <='0';
if (counter_rx=2) then --use lacth
counter := 0;
pulse_sync <='1';
end if;
end if;
end process;
cdc_head_clk: process(clk_sys) -- printhead clock is more than 5 time slower than clk_sys
begin
if rising_edge(clk_sys) then
pulse_sync_sys_d1 <= pulse_sync;
pulse_sync_sys_d2 <= pulse_sync_sys_d1;
latch_pulse_sys_d1 <= latch_pulse_int(2);
latch_pulse_sys_d2 <= latch_pulse_sys_d1;
data_pulse <='0';
if (pulse_sync_sys_d1 <='1' and pulse_sync_sys_d2='0' ) then
data_sign <= (others =>'0', (15 downto 8) => rx_data_h_int(2), (7 downto 0) => rx_data_l_int(2));
data_pulse <='1';
end if;
rset_sig <='0';
if (latch_pulse_d2 ='0' and latch_pulse_d1 ='1') then
reset_sig <='1';
end if;
end if;
end process;
SIGNATURE_P : process(all)
variable fb :std_logic;
begin
if (rx_clk'event and rx_clk = '1') then
latch_int <= '0';
if latch = '1' and latch_d = '0' then
latch_int <= '1';
sigLatched <= sig;
sig <= (others => '0');
elsif (data_pkt(DE1) = '1' and data_pkt(DE2) = '1') then
fb := sig(30) xor sig(27);
sig <= (sig(30 downto 0) & fb) xor ("0000" & data_pkt(27 downto 0)); --32 bit a zero has been padded to the left
end if;
end if;
if (rst_n = '0' or rx_locked = '0') then
sigLatched <= (others => '0');
if (rx_clk'event and rx_clk = '1') then
if (reset_sig = '1') then
sigLatched <= sig;
sig <= (others => '0');
elsif (data_pulse = '1' ) then
fb := sig(30) xor sig(15);
sig <= (sig(30 downto 0) & fb) xor (others => '0' , (15 downto 0) => data_sign); --32 bit a zero has been padded to the left
end if;
end if;
if (rst_n = '0' or rx_locked = '0') then
sigLatched <= (others => '0');
sig <= (others => '0');
end if;
end process;
--The commands are decoded by using a combination of DI2 and DI2. Notice in the manual that the 2 MSB of
--input data for all the commands is the same. The last two bits of the DI1 and DI2 patterns are used to decode the
-- command. Notice at the end of the code how the data_command signal is constracted from the data pack.
NCH_P : process(rx_clk, rst_n, rx_locked) --nCH command
begin
if (rx_clk'event and rx_clk = '1') then
case t_command is
when "1011" => nchg <= '0'; -- command SON
when "0010" => nchg <= '0'; -- command SOLN
when "0000" => nchg <= '1'; -- command EOLN
when "1001" => nchg <= '1'; -- command EON
when others => nchg <= nchg;
end case;
end if;
if (rst_n = '0' or rx_locked = '0') then
nchg <= '0';
end if;
end process;
DECODE_P : process(rx_clk, rst_n, rx_locked) --latch
begin
if (rx_clk'event and rx_clk = '1') then
latch_d <= latch;
case t_command is
when "0010" => latch <= '1'; -- command SOLN
when "1010" => latch <= '1'; -- command SOL
--when "0000" => latch <= '0'; -- command EOLN
when "1000" => latch <= '0'; -- command EOL
when "1111" => chA_int <= '1'; -- command SOABC
when "1101" => chA_int <= '0'; -- command EOABC
when "1110" => chB_int <= '1'; -- command SOB
when "1100" => chB_int <= '0'; -- command EOA
when "0110" => chC_int <= '1'; -- command SOC
when "0100" => chC_int <= '0'; -- command SOC
when others =>
latch <= latch;
chA_int <= chA_int;
chB_int <= chB_int;
chC_int <= chC_int;
end case;
end if;
if (rst_n = '0' or rx_locked = '0') then
latch <= '0';
latch_d <= '0';
end if;
end process;
SP_data_p : process(rx_clk, rst_n)
begin
if(rx_clk'event and rx_clk = '1') then
if latch = '1' and latch_d = '0' then
sp_table_comA <= sp_table_comA_int;
sp_table_comB <= sp_table_comB_int;
sp_table_comC <= sp_table_comC_int;
--clear internal registers
sp_table_comA_int <= (others => '0');
sp_table_comB_int <= (others => '0');
sp_table_comC_int <= (others => '0');
elsif (data_pkt(DE1) = '1' and data_pkt(DE2) = '1') then
sp_table_comA_int <= sp_table_comA_int(14 downto 0) & data_pkt(DI1T5);
sp_table_comB_int <= sp_table_comB_int(14 downto 0) & data_pkt(DI2T5);
sp_table_comC_int <= sp_table_comC_int(14 downto 0) & data_pkt(DI3T5);
end if;
end if;
if (rst_n ='0' or rx_locked = '0' or cmd_reset = '1') then
sp_table_comA_int <= (others => '0');
sp_table_comB_int <= (others => '0');
sp_table_comC_int <= (others => '0');
sp_table_comA <= (others => '0');
sp_table_comB <= (others => '0');
sp_table_comC <= (others => '0');
end if;
end process;
--type type_command_list is (LATSTART, LATEND,NCHGSTART, NCHEND, LATNCHGSTART, LATNCHGEND, CHASTART, CHAEND, CHBSTART, CHBEND, CHCSTART, CHCEND, CHALLSTART, CHALLEND,SWREST,IDLE);
--Mapping of rows to command DI2 DI1
data_command(0) <= data_pkt(DI2T1) & data_pkt(DI1T1); --T1
data_command(1) <= data_pkt(DI2T2) & data_pkt(DI1T2); --T2
data_command(2) <= data_pkt(DI2T3) & data_pkt(DI1T3); --T3
data_command(3) <= data_pkt(DI2T4) & data_pkt(DI1T4); --T4
data_command(4) <= data_pkt(DI2T5) & data_pkt(DI1T5); --T5
data_command(5) <= data_pkt(DI2T6) & data_pkt(DI1T6); --T6
---Register created to validate data streaming with modelsim
d1_dataline <= data_pkt(DI1T1);
d2_dataline <= data_pkt(DI2T1);
d3_dataline <= data_pkt(DI3T1);
d4_dataline <= data_pkt(DI4T1);
end architecture struct;