Conversation
|
I forgot that the core files are autogenerated :(( Failing lint |
7d06a9f to
6ddb362
Compare
martin-velay
left a comment
There was a problem hiding this comment.
I have some initial comments. It's a very good start though!
hw/vendor/lowrisc_ip/ip_templates/gpio/dv/env/gpio_env.core.tpl
Outdated
Show resolved
Hide resolved
d83b568 to
32c5f09
Compare
| endtask : drive_pattern | ||
|
|
||
| task top_chip_dv_gpio_base_vseq::wait_for_pattern(logic [NUM_GPIOS-1:0] exp_val); | ||
| `DV_SPINWAIT(wait(cfg.gpio_vif.pins ==? exp_val);, |
There was a problem hiding this comment.
Does the expected value can be x or z?
There was a problem hiding this comment.
No, because the start of gpio_test() enable the pulldown's. Are you asking this because of case equality?
There was a problem hiding this comment.
Yes it's related to this wildcard ==? equality. Is there a reason to have this sign?
There was a problem hiding this comment.
For this kind of comparison
for (int i = 0; i < NUM_GPIOS/4; i++) begin
wait_for_pattern({8'h?, 1 << i, 16'h????});
end
I want to compare the third quater of pins driven by software and ignore the rest.
There was a problem hiding this comment.
But as you know what the rest of the pins should look like, it doesn't harm to make the full check I guess.
| // | ||
| // Drive 1's in temperature pattern on the lower 8 pins. | ||
| for (int i = NUM_GPIOS/4; i < (NUM_GPIOS/4) * 2; i++) begin | ||
| drive_pattern(1, i, 1); |
There was a problem hiding this comment.
Is it enough to wait 1 clock for the SW to read the register?
There was a problem hiding this comment.
So, this is driving a pattern after a clock. From the SW side, the test expect the pattern that's been driven at the end.
In smoketest.c, it is structured as something like that:
for (int i = 0; i < GPIO_NUM_PINS/4; i++) {
drive(gpio, GPIO_REG_MASKED_OUT_LOWER, 1 << i);
if (i == ((GPIO_NUM_PINS/4)-1)) {
wait(gpio, 0xFF80);
}
}
So, first the C drives walking 1's on the first quater of pins. Meanwhile, vseq check if those quater pads have that pattern. Once that is happened, the vseq drives 1's in temperature sequence manner on the next quater after every cycle. So, the C is only able to see that pattern once all the 1's are written on the second quater. Does that make sense?
There was a problem hiding this comment.
Which means that we make some intermediate actions which are not checked? If yes, I guess it's OK as we do checks more in depth at block level. So if we don't check the intermediate values, I'd suggest to either check it, or drop the intermediate driving. WDYT?
There was a problem hiding this comment.
If I am dropping the driving part, it means we are not driving anything on the inputs. Okay, I'll tweak it so the SW will wait for every 1's.
hw/vendor/lowrisc_ip/ip_templates/gpio/dv/env/gpio_env.core.tpl
Outdated
Show resolved
Hide resolved
8a5da04 to
93f0c4e
Compare
|
HI @martin, Thanks for the detailed review. I realized yesterday that the comments I added in the test and vseq were way more difficult and I spent some time making it a bit easier to understanding. Do you mind take another look? Some of your comments are unresolved because either I asked for a go-ahead or a question in replies. |
| endtask : drive_pattern | ||
|
|
||
| task top_chip_dv_gpio_base_vseq::wait_for_pattern(logic [NUM_GPIOS-1:0] exp_val); | ||
| `DV_SPINWAIT(wait(cfg.gpio_vif.pins ==? exp_val);, |
There was a problem hiding this comment.
Yes it's related to this wildcard ==? equality. Is there a reason to have this sign?
| // | ||
| // Drive 1's in temperature pattern on the lower 8 pins. | ||
| for (int i = NUM_GPIOS/4; i < (NUM_GPIOS/4) * 2; i++) begin | ||
| drive_pattern(1, i, 1); |
There was a problem hiding this comment.
Which means that we make some intermediate actions which are not checked? If yes, I guess it's OK as we do checks more in depth at block level. So if we don't check the intermediate values, I'd suggest to either check it, or drop the intermediate driving. WDYT?
hw/vendor/lowrisc_ip/ip_templates/gpio/dv/env/gpio_env.core.tpl
Outdated
Show resolved
Hide resolved
4534ce8 to
5ade54b
Compare
525ccea to
e22f462
Compare
It is going to be useful in order to import GPIO related parameters in tb.sv Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
The smoketest.c and top_chip_dv_gpio_base_vseq works in pairs in a way that C drives W1's and W0's pattern on the outputs and vseq drives T1's and T0's pattern on the inputs. Both C and vseq waits for an expected pattern to arrive in order to drive the next pattern. Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
martin-velay
left a comment
There was a problem hiding this comment.
I feel that the choice of driving patterns on the quarters from the SW and DV at the same time and by crossing the quarters is hard to follow and I am not sure it brings something for a top-level test. I'd suggest to simplify but still driving and checking from both the SW and the DV sides. If you have a doubt we can have a call.
But we are almost there! 👌
|
|
||
| // Verifies GPIOs in partially output and input direction. The test distributes GPIOs as four equal | ||
| // quaters. The idea is to drive first quater of GPIOs as outputs and wait for a pattern to appear | ||
| // on the second quater of pins as inputs. Next, drive a pattern on the third quater and waits for a |
There was a problem hiding this comment.
This nit change should be applied in several places in this PR (not only in this file)
| // on the second quater of pins as inputs. Next, drive a pattern on the third quater and waits for a | |
| // on the second quarter of pins as inputs. Next, drive a pattern on the third quarter and waits for a |
|
|
||
| `uvm_info(`gfn, "Starting GPIOs outputs test", UVM_LOW) | ||
|
|
||
| // The SW first sets the first and third quater of GPIOs to 0's in order to walk 1's on them. |
There was a problem hiding this comment.
Here we wait for all 0s and not only on the 1st/3rd quarter, your comment is a bit confusing
There was a problem hiding this comment.
I think what I meant to say is that the SW writes 0's on the first and third quater but because we haven't drove anything in the pads inputs they must be zero. So we wait for all zeros
There was a problem hiding this comment.
Maybe the best answer is to remove the setting to 0's thing from both SW and vseq. I was thinking it is good to drive 0's and wait for 0's then because the function can be used somewhere else in a different context and to do W1's cleanly, we should initialize it with 0's.
|
|
||
| // Wait for some cycles so that the pads can transition from the current pin state to the next pin | ||
| // state | ||
| cfg.sys_clk_vif.wait_clks(wait_num_clks); |
There was a problem hiding this comment.
You drive the pins in a for loop and mention it to be a temperature fashion pattern but the wait_clks is outside of the for loop, so the temperature pattern won't be visible at all.
There was a problem hiding this comment.
What I meant was that I am driving the quarter pin by pin. But you are right, it is not going to be shown as temperature pattern.
WIP