lowRISC / lowRISC/opentitan

[gpio, dpi] gpio write function is broken in hello_world verilator testbench

Open
#18,901 5 comments 0 reactions 0 assignees View on GitHub
Earlgrey-PROD Triaged Priority:P2
Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

### Description

Build and run verilator testbench with hello_world image

```
bazel-bin/hw/build.verilator_real/sim-verilator/Vchip_sim_tb \
--meminit=rom,bazel-out/k8-fastbuild-ST-2cc462681f62/bin/sw/device/lib/testing/test_rom/test_rom_sim_verilator.39.scr.vmem \
--meminit=flash,bazel-out/k8-fastbuild-ST-2cc462681f62/bin/sw/device/examples/hello_world/hello_world_sim_verilator.64.vmem \
--meminit=otp,bazel-bin/hw/ip/otp_ctrl/data/img_rma.24.vmem
```

Following the printout on stdout to toggle gpio, and nothing is shown in `gpio0-read` nor `uart0.log`

If I update https://github.com/lowRISC/opentitan/blob/e29688065756ed1d89641a3c46312357cf84c34e/sw/device/examples/demos.c#L46

to loop from GPIO 8 to GPIO 11 (matching the switch setting in hello_world.c), then

```
echo 'h01 h00' > gpio0-write
```

in uart0.log
```
I00006 demos.c:50] GPIO switch #8 changed to 1
I00007 demos.c:50] GPIO switch #9 changed to 1
```

Whereas setting gpio8 and gpio9 doesn't work at all

Contributor guide

Open the contributing guide

Research direction

Reproduce the hello_world Verilator testbench with the command in the issue, then compare the GPIO loop in demos.c at the referenced line with the switch settings in hello_world.c. Trace why gpio8 and gpio9 writes do not appear in gpio0-read or uart0.log. Done means the documented GPIO writes produce the expected output for those pins.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.