Skip to content

[chip, gpio, dv] GPIO smoke test#382

Draft
KinzaQamar wants to merge 8 commits intolowRISC:mainfrom
KinzaQamar:gpio_smoke
Draft

[chip, gpio, dv] GPIO smoke test#382
KinzaQamar wants to merge 8 commits intolowRISC:mainfrom
KinzaQamar:gpio_smoke

Conversation

@KinzaQamar
Copy link
Copy Markdown

@KinzaQamar KinzaQamar commented Mar 26, 2026

Merge #406 and #437 as dependencies

This PR added functionality to make the gpio smoketest working on the chip level.

Will close: #147

@KinzaQamar KinzaQamar requested a review from martin-velay March 26, 2026 10:37
@KinzaQamar
Copy link
Copy Markdown
Author

I forgot that the core files are autogenerated :(( Failing lint

@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 3 times, most recently from 7d06a9f to 6ddb362 Compare March 26, 2026 13:52
Copy link
Copy Markdown
Contributor

@martin-velay martin-velay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some initial comments. It's a very good start though!

@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 8 times, most recently from d83b568 to 32c5f09 Compare March 30, 2026 15:01
@KinzaQamar KinzaQamar marked this pull request as ready for review March 30, 2026 15:02
@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 4 times, most recently from 8a5da04 to 93f0c4e Compare March 31, 2026 23:23
@KinzaQamar
Copy link
Copy Markdown
Author

KinzaQamar commented Apr 1, 2026

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.

@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 4 times, most recently from 4534ce8 to 5ade54b Compare April 1, 2026 11:44
@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 2 times, most recently from 9720343 to e672964 Compare April 9, 2026 08:58
Copy link
Copy Markdown
Collaborator

@engdoreis engdoreis Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set(options FPGA SIM_VERILATOR)

# create artefacts
mocha_add_executable_artefacts(${NAME})

if(SIM)
Copy link
Copy Markdown
Collaborator

@engdoreis engdoreis Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(SIM)
if(SIM AND arg_SIM_VERILATOR)

@@ -6,14 +6,14 @@ set(LIBS hal runtime startup test_framework)

mocha_add_test(NAME test_framework_test SOURCES test_framework/smoketest.c LIBRARIES ${LIBS} FPGA)
Copy link
Copy Markdown
Collaborator

@engdoreis engdoreis Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same for the other tests below. Except the one that can't run in verilator.

Suggested change
mocha_add_test(NAME test_framework_test SOURCES test_framework/smoketest.c LIBRARIES ${LIBS} FPGA)
mocha_add_test(NAME test_framework_test SOURCES test_framework/smoketest.c LIBRARIES ${LIBS} FPGA SIM_VERILATOR)

@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 2 times, most recently from 1231460 to 4a50beb Compare April 9, 2026 11:26
KinzaQamar added a commit to KinzaQamar/mocha that referenced this pull request Apr 9, 2026
The motivation of this PR comes from lowRISC#382 which is adding a chip level
GPIO test for Xcelium. That test fails on verilator. The reason being
different tops used for both of the tools. For Xcelium, an interface
is connecting the UVM to the GPIO. The UVM have the control to drive
GPIOs inputs. In lowRISC#382, the SW waits for a specific pattern driven by
UVM to appear in `data_in` reg. If we run the exact test with the
verilator top, which is using GPIO DPI, then the abilty to drive the
inputs depends on a host SW infrastructure which is currently missing.
With the above context, the best way forward is to separate the GPIO
smoketest for both of the simulators for now to make the CI happy.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
KinzaQamar added a commit to KinzaQamar/mocha that referenced this pull request Apr 11, 2026
The motivation of this PR comes from lowRISC#382 which is adding a chip level
GPIO test for Xcelium. That test fails on verilator. The reason being
different tops used for both of the tools. For Xcelium, an interface
is connecting the UVM to the GPIO. The UVM have the control to drive
GPIOs inputs. In lowRISC#382, the SW waits for a specific pattern driven by
UVM to appear in `data_in` reg. If we run the exact test with the
verilator top, which is using GPIO DPI, then the abilty to drive the
inputs depends on a host SW infrastructure which is currently missing.
With the above context, the best way forward is to separate the GPIO
smoketest for both of the simulators for now to make the CI happy.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
KinzaQamar added a commit to KinzaQamar/mocha that referenced this pull request Apr 11, 2026
The motivation of this PR comes from lowRISC#382 which is adding a chip level
GPIO test for Xcelium. That test fails on verilator. The reason being
different tops used for both of the tools. For Xcelium, an interface
is connecting the UVM to the GPIO. The UVM have the control to drive
GPIOs inputs. In lowRISC#382, the SW waits for a specific pattern driven by
UVM to appear in `data_in` reg. If we run the exact test with the
verilator top, which is using GPIO DPI, then the abilty to drive the
inputs depends on a host SW infrastructure which is currently missing.
With the above context, the best way forward is to separate the GPIO
smoketest for both of the simulators for now to make the CI happy.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
KinzaQamar added a commit to KinzaQamar/mocha that referenced this pull request Apr 11, 2026
The motivation of this PR comes from lowRISC#382 which is adding a chip level
GPIO test for Xcelium. That test fails on verilator. The reason being
different tops used for both of the tools. For Xcelium, an interface
is connecting the UVM to the GPIO. The UVM have the control to drive
GPIOs inputs. In lowRISC#382, the SW waits for a specific pattern driven by
UVM to appear in `data_in` reg. If we run the exact test with the
verilator top, which is using GPIO DPI, then the abilty to drive the
inputs depends on a host SW infrastructure which is currently missing.
With the above context, the best way forward is to separate the GPIO
smoketest for both of the simulators for now to make the CI happy.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
@KinzaQamar KinzaQamar force-pushed the gpio_smoke branch 2 times, most recently from 7dad408 to 44b2ba3 Compare April 11, 2026 11:15
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
The motivation of this PR comes from lowRISC#382 which is adding a
chip level GPIO smoke test. That test fails on verilator.
Reason being different tops used for different platforms (
DVSim(Xcelium), Verilator, FPGA). For Xcelium, an interface
is connecting the UVM to the GPIO. UVM has the control to
drive GPIOs inputs. In lowRISC#382, SW waits for a specific pattern
driven by UVM to arrive in data_in reg. If we run the exact
test with the verilator top, which is using GPIO DPI, then
the abilty to drive inputs depends on a host SW
infrastructure which is currently missing.

Second problem is that we use cmake to build software images
for DVSim, verilator and FPGA. We run tests on FPGA and
Verilator in CI. If the build system develops an Xcelium
compatible image and feed that image to Verilator and FPGA
to execute the test in CI then the test will fail due to the
reason given in the first paragraph.

Hence, the best way forward is to make images only for the
compatible paltforms.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
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>
Since we are using UVM, we have the control to drive the GPIOs
inputs and hence can wait in SW for the driven pattern to
appear. This will hang forever in case of verilator top. That
is why two tests are required to be able to work on their
corresponding top. For more context: visit lowRISC#406.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Both SW and vseq works in pairs. The SW drives the pins in outputs and
set each pin in walking 1's fashion and waits for the pattern driven
by vseq. The vseq once seen all the W1's pattern on each pin will then
drive a pattern on GPIO inputs and SW waits for that pattern by
reading `data_in` reg.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPIO DV - Top-level basic register access

5 participants