1) added pin data file

2) modified mcp4631 to accept i2c_address
3) runtest moified with right i2c addres for the mcp4631 test bench
This commit is contained in:
David Rodriguez 2024-08-24 21:19:30 +01:00
commit 1449b2a699
5 changed files with 28 additions and 11 deletions

View file

@ -40,6 +40,7 @@ entity mcp4631 is
start_r_i2c : in std_logic;
i2c_master_rd_dv : out std_logic;
i2c_mcp4631_busy : out std_logic;
i2c_address : in std_logic_vector(7 downto 0);
wr_nbytes : in std_logic_vector(15 downto 0);
reg_mcp4631_in : in std_logic_vector(15 downto 0);
reg_mcp4631_out : out std_logic_vector(15 downto 0)
@ -150,14 +151,14 @@ I2C_process: process(clk, rst_n)
if (start_w_i2c = '1' and rd_cmd = '1') then
I2c_master_sate <= FRAME_DATA_W;
wr_data_in <= std_logic_vector(to_unsigned(ADDRESS_MCP4631,8));
wr_data_in <= i2c_address;
wr_i2c_mcp4631 <='1';
reg_mcp4631_int <= reg_mcp4631_in;
--frame_cnt_w <= std_logic_vector(to_unsigned(3,8)); --Maybe 4 Address+Command+(2*DataFrame)
i2c_mcp4631_busy <= '1';
elsif (start_r_i2c = '1' and rd_cmd = '1') then
I2c_master_sate <= FRAME_DATA_R;
wr_data_in <= std_logic_vector(to_unsigned((ADDRESS_MCP4631+1),8)); -- turn bit0 into 1 for a read
wr_data_in <= i2c_address(7 downto 1) & '1';
wr_i2c_mcp4631 <='1';
frame_cnt_r <= std_logic_vector(to_unsigned(3,8)); --Maybe 4 Address+Command+(2*DataFrame)
i2c_mcp4631_busy <= '1';

View file

@ -636,8 +636,8 @@ port map (
scl_out => scl_ms_out,
sda_in => sda_in,
sda_out => sda_ms_out,
wr_nbytes => wr_nbytes,
i2c_address => i2c_address,
wr_nbytes => wr_nbytes,
i2c_address => i2c_address,
start_w_i2c => start_w_mcp4631, -- reads from fifo
start_r_i2c => start_r_mcp4631,
i2c_master_rd_dv => i2c_m_dv,
@ -750,10 +750,10 @@ uart_inst: entity work.pei_debug_uart_0
when ADDR_GP_OUT => pulse_length <= wr_data_uart(pulse_length'range); -- create dedicated register later for the green led
when ADDR_EPROM_ADDR => eprom_addr <= wr_data_uart(eprom_addr'range);
when ADDR_EPROM_WR_DATA => eprom_wr_data <= wr_data_uart(eprom_wr_data'range);
when ADDR_STM8_W_NBYTES => wr_nbytes <= wr_data_uart(wr_nbytes'range);
when ADDR_STM8_W_NBYTES => wr_nbytes <= wr_data_uart(wr_nbytes'range);
when ADDR_MCP4631 => reg_mcp4631_in <= wr_data_uart(reg_mcp4631_in'range);
wr_uart <= '1';
when I2C_ADDR_STM8 => i2c_address <= wr_data_uart(7 downto 0);
when I2C_ADDR_STM8 => i2c_address <= wr_data_uart(7 downto 0);
when others => NULL;
end case;

View file

@ -0,0 +1,15 @@
c1_clk -> m15
c2_clk -> m6
c1_lat -> l15 -> dac_out36
c2_lat -> r4 -> dac_out3
d0 -> p8 -> dac_out10
d1 -> r7 -> dac_out8
d2 -> t7 -> dac_out7
d3 -> r6 -> dac_out5
d4 -> t6 -> dac_out6
d5 -> t5 -> dac_out0
d6 -> r5 -> dac_out1
d7 -> t4 -> dac_out2
two_col -> n9 -> dac_out34
head_sda -> r14 -> dac_out29
head_scl -> t15 -> dac_out28

View file

@ -2106,7 +2106,7 @@ int runTest::common_data_setup (CCoreAuto* pCore, bool checkSeq, unsigned patter
usleepSim(8);
uartStream("w0f00000058\0",pTestBench);
usleepSim(8);
uartStream("w0e00000002\0",pTestBench);
uartStream("w0e00000003\0",pTestBench);
usleepSim(8);
uartStream("w07000023FF\0",pTestBench);
usleepSim(8);
@ -2114,7 +2114,6 @@ int runTest::common_data_setup (CCoreAuto* pCore, bool checkSeq, unsigned patter
usleepSim(8);
uartStream("r01\0", pTestBench); // Read PEI Ver
uint32_t peiVersion = uartGetData(4, pTestBench); // receive 4 characters
VPrint("PEI is %08x Version %d\n", peiID, peiVersion);
usleepSim(8);
uartStream("r07\0", pTestBench); // Read PEI ID

View file

@ -41,9 +41,11 @@ add wave -noupdate /tb/pei_int/rd_uart
add wave -noupdate /tb/pei_uart_int/rx_data
add wave -noupdate /tb/pei_uart_int/tx_data
add wave -noupdate /tb/pei_int/i2c_mcp4631_busy
add wave -noupdate /tb/mcp4631_tb_inst/wr_data
add wave -noupdate /tb/pei_int/i2c_address
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {782412809 ps} 0} {{Cursor 2} {490057233 ps} 0}
quietly wave cursor active 1
WaveRestoreCursors {{Cursor 1} {782412809 ps} 0} {{Cursor 2} {391035495 ps} 0}
quietly wave cursor active 2
configure wave -namecolwidth 173
configure wave -valuecolwidth 81
configure wave -justifyvalue left
@ -58,4 +60,4 @@ configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ns
update
WaveRestoreZoom {246037472 ps} {436837236 ps}
WaveRestoreZoom {0 ps} {763199056 ps}