[chip, I2C, DV] Top level I2C host test#473
Conversation
fd42f2e to
0c033ce
Compare
dbb8d58 to
16ba0d4
Compare
4da05c4 to
d5d15ad
Compare
f33a9e9 to
3a25ff6
Compare
d5393fb to
a90365e
Compare
6d98478 to
e89e1dc
Compare
1911b12 to
8d476f5
Compare
|
Refer to the note about why |
1c9cec2 to
8987db7
Compare
@marnovandermaas suggested to skip verilator and FPGA images for |
elliotb-lowrisc
left a comment
There was a problem hiding this comment.
Generally looking decent to me. I have a few comments on making the SW test a bit clearer and in keeping with other tests
There was a problem hiding this comment.
I think we should rename this and the existing smoketest.c to better capture what they do. In this case, it is testing reading and writing to a memory-like I^2C device. The existing "smoketest" does similar, only to a temperature sensor I^2C device. I think having test names that capture whether the i2c block is operating in host/device mode and what it is attempting to communicate with would be much clearer.
| uvm_config_db#(virtual clk_rst_if)::set(null, "*", "sys_clk_if", sys_clk_if); | ||
| uvm_config_db#(virtual uart_if)::set(null, "*.env.m_uart_agent*", "vif", uart_if); | ||
| uvm_config_db#(virtual pins_if #(NUM_GPIOS))::set(null, "*.env", "gpio_vif", gpio_pins_if); | ||
| uvm_config_db#(virtual i2c_if)::set(null, "*.env.m_i2c_agent", "vif", i2c_if); |
There was a problem hiding this comment.
Probably best to add a wildcard as if a sub-component of i2c agent tries to get this handle it will fail. But it doesn't hurt us to give this possibility in case:
| uvm_config_db#(virtual i2c_if)::set(null, "*.env.m_i2c_agent", "vif", i2c_if); | |
| uvm_config_db#(virtual i2c_if)::set(null, "*.env.m_i2c_agent*", "vif", i2c_if); |
| // Set I2C agent config object for I2C agent | ||
| uvm_config_db#(i2c_agent_cfg)::set(this, "m_i2c_agent", "cfg", cfg.m_i2c_agent_cfg); | ||
|
|
||
| // Create I2C agent | ||
| m_i2c_agent = i2c_agent::type_id::create("m_i2c_agent", this); | ||
|
|
||
| // Instantiate UART agent | ||
| m_uart_agent = uart_agent::type_id::create("m_uart_agent", this); | ||
| uvm_config_db#(uart_agent_cfg)::set(this, "m_uart_agent*", "cfg", cfg.m_uart_agent_cfg); |
There was a problem hiding this comment.
Nit - for consistency:
| // Set I2C agent config object for I2C agent | |
| uvm_config_db#(i2c_agent_cfg)::set(this, "m_i2c_agent", "cfg", cfg.m_i2c_agent_cfg); | |
| // Create I2C agent | |
| m_i2c_agent = i2c_agent::type_id::create("m_i2c_agent", this); | |
| // Instantiate UART agent | |
| m_uart_agent = uart_agent::type_id::create("m_uart_agent", this); | |
| uvm_config_db#(uart_agent_cfg)::set(this, "m_uart_agent*", "cfg", cfg.m_uart_agent_cfg); | |
| // Instantiate UART agent | |
| m_uart_agent = uart_agent::type_id::create("m_uart_agent", this); | |
| uvm_config_db#(uart_agent_cfg)::set(this, "m_uart_agent*", "cfg", cfg.m_uart_agent_cfg); | |
| // Instantiate I2C agent | |
| m_i2c_agent = i2c_agent::type_id::create("m_i2c_agent", this); | |
| uvm_config_db#(i2c_agent_cfg)::set(this, "m_i2c_agent", "cfg", cfg.m_i2c_agent_cfg); |
| super.dut_init(reset_kind); | ||
| endtask | ||
|
|
||
| task top_chip_dv_i2c_host_tx_rx_vseq::body(); |
There was a problem hiding this comment.
You should add a call to the super in case there's something added there in the future:
super.body();
Also, for consistency, you can have these lines at the very beginning like we do for other vseqs:
`DV_WAIT(cfg.sw_test_status_vif.sw_test_status == SwTestStatusInTest);
`uvm_info(`gfn, "Starting I2C Host TX-RX test", UVM_LOW)48917e0 to
0823c30
Compare
|
SW comments addressed |
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Controller writes multiple bytes to the target's receiver and then reads multiple bytes from the same address. At the end of both read and write transfer, the test checks if the transfer was succesful. If yes, then the test compares all the read bytes with the data bytes that was sent as part of write transfer. Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
This vseq: ** reads the SW symbols to get the timing values ** calculates relevant timing parameter use by the agent to send Ack, Nack and Rdata. ** start the reactive sequence Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
| static bool host_tx_rx_test(i2c_t i2c, uint8_t addr, uint8_t num_bytes) | ||
| { | ||
| // Data bytes to send to the target's receiver. | ||
| uint8_t wr_data_bytes[num_bytes]; |
There was a problem hiding this comment.
I realise now that this here seems a bit ambiguous - num_bytes could refer to either the function parameter or the enum constant 😅, I think it would be best to prefix the enum values with test, e.g test_i2c_address, test_num_bytes, and just using those values directly in the function by changing the signature to be static bool host_tx_rx_test(i2c_t i2c)
| num_bytes = 0x8, | ||
| }; | ||
|
|
||
| static bool write_transfer(i2c_t i2c, uint8_t addr, const uint8_t *data, uint8_t num_wr_bytes) |
There was a problem hiding this comment.
Like the other functions in hal/i2c.h, maybe this should be num_bytes?
| // Below symbols are going to be read by top_chip_dv_i2c_host_tx_rx_vseq in order to calculate agent | ||
| // timing parameters. | ||
| // | ||
| // The values below are standard mode minimums |
There was a problem hiding this comment.
| // Below symbols are going to be read by top_chip_dv_i2c_host_tx_rx_vseq in order to calculate agent | |
| // timing parameters. | |
| // | |
| // The values below are standard mode minimums | |
| // The below symbols are used by top_chip_dv_i2c_host_tx_rx_vseq in order to calculate agent timing parameters. | |
| // The values are the minimums for standard mode. |
Close #507