[top-i2c,dv] Added chip level I2C Device TX_RX test#633
Conversation
dafa77b to
c434d75
Compare
fbf55a9 to
13af90e
Compare
d5e3010 to
74cf3b0
Compare
74cf3b0 to
0646a31
Compare
engdoreis
left a comment
There was a problem hiding this comment.
I left a suggestion, otherwise it LGTM.
| VOLATILE_WRITE(i2c->txdata, txdata); | ||
| } | ||
|
|
||
| void i2c_clear_cmd_complete(i2c_t i2c) |
There was a problem hiding this comment.
I suggest making a function to clear interrupts that take the interrupt as argument like uart:
mocha/sw/device/lib/hal/uart.c
Line 36 in 3b3b9e2
There was a problem hiding this comment.
Do you mean something like that:
void i2c_clear_intr_state(i2c_t i2c, uint32_t state)
{
VOLATILE_WRITE(i2c->intr_state, state);
}
There was a problem hiding this comment.
Yes, but 'state' would be an enum with the interrupts. It should also accept more then one interrupt per call.
3e897ea to
eb7d381
Compare
| sw_sys_clk_period_ns[0]); | ||
| fall_cycles = round_up_divide({sw_fall_time_ns[1], sw_fall_time_ns[0]}, | ||
| sw_sys_clk_period_ns[0]); | ||
| endtask |
There was a problem hiding this comment.
Nit: most of your new methods are long enough to justify the fact to add the label, I feel it hard to read without it.
| @@ -37,23 +69,42 @@ function int unsigned top_chip_dv_i2c_tx_rx_vseq::round_up_divide(int unsigned a | |||
| endfunction | |||
|
|
|||
| function void top_chip_dv_i2c_tx_rx_vseq::configure_agent_timing(); | |||
There was a problem hiding this comment.
I think these changes also have an impact on top_chip_dv_i2c_host_tx_rx_vseq. Isn't it an issue?
There was a problem hiding this comment.
I don't think that host_tx_rx_test gets affected. I've took these calculations from i2c_base_vseq function get_timing_values(). They look sensible to reason.
There was a problem hiding this comment.
Oh, sorry. I think I didn't answer this question well. These parameters are used to add delays which should depend on the speed of the I2C bus and not on host / device part. So, whatever the speed is just calculate the timing parameter the same way
| // De-allocate the xfer item in order to send a new transfer | ||
| xfer = null; |
There was a problem hiding this comment.
This is dead code and can be dropped
| const uint16_t setup_start_time_ns = 4700; | ||
| const uint16_t hold_start_time_ns = 4000; | ||
| const uint16_t setup_stop_time_ns = 4000; | ||
| const uint16_t hold_stop_time_ns = 4700; |
There was a problem hiding this comment.
Nit: hold_stop_time_ns is actually bus-free time (tBUF) per the I2C spec, not a hold time on the stop condition — same concept as bus_free_time_cycles in i2c_timing_params_t (i2c.h). Same naming carries through to sw_hold_stop_time_ns/stop_hold_cycles in top_chip_dv_i2c_tx_rx_vseq.sv and the backdoor-read in top_chip_dv_i2c_device_tx_rx_vseq.sv. Could you either rename to bus_free_time_ns/bus_free_cycles for consistency, or add a short comment noting it maps to tBUF?
There was a problem hiding this comment.
Thanks Martin. Your consistency comments always helps. You are right here. I've also noticed the in i2c.h, the field of the struct should name as bus_free_cycles but I'll do this in a separate PR
9c8cb36 to
eddbdd0
Compare
eddbdd0 to
72e77cf
Compare
…vice Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
f4fb13a to
3a94487
Compare
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
3a94487 to
ca5122a
Compare
A reviewer on lowRISC#633 commented about inconsistency in the naming of tBUF timing parameter accross different places. That made me look at the name of the bus_free_time_cycles field in the i2c_timing_params_t struct and I realized that it is also inconsistent. Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Added a host Vseq and device SW. The host will initiate read / write transfer. The device SW waits for the transfers to finish and compare the data bytes in each transfer at the end