-
Notifications
You must be signed in to change notification settings - Fork 10
[chip, gpio, dv] GPIO smoke test #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KinzaQamar
wants to merge
6
commits into
lowRISC:main
Choose a base branch
from
KinzaQamar:gpio_smoke
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0cd8f62
[Dependency] Added GPIO related dependency
KinzaQamar de48b69
[chip, gpio, dv] Connected GPIO ports into the tb
KinzaQamar 36da794
[chip, gpio, dv] Feeded the gpio_vif inside the chip_dv_env
KinzaQamar c879624
[chip, gpio, dv] Added gpio_base_vseq
KinzaQamar bf63dfa
[gpio, sw] Added functions to write all output and output_en pins
KinzaQamar f06d73b
[chip, gpio, dv] Added W1's, W0's, T1's and T0's testing for GPIOs
KinzaQamar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
hw/top_chip/dv/env/seq_lib/top_chip_dv_gpio_base_vseq.sv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| // Copyright lowRISC contributors (COSMIC project). | ||
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| class top_chip_dv_gpio_base_vseq extends top_chip_dv_base_vseq; | ||
| `uvm_object_utils(top_chip_dv_gpio_base_vseq) | ||
|
|
||
| // Standard SV/UVM methods | ||
| extern function new(string name=""); | ||
| extern task body(); | ||
|
|
||
| // Class specific methods | ||
| // | ||
| // Waits for the pattern to appear on the GPIOs | ||
| extern virtual task wait_for_pattern(logic [NUM_GPIOS-1:0] exp_val); | ||
|
|
||
| // Drives a pattern on the quarter GPIOs pins in input mode | ||
| extern virtual task drive_pattern(int unsigned wait_num_clks, | ||
| int unsigned pins_starting_quarter, | ||
| int unsigned pins_next_quarter, | ||
| bit state); | ||
| endclass : top_chip_dv_gpio_base_vseq | ||
|
|
||
| function top_chip_dv_gpio_base_vseq::new (string name = ""); | ||
| super.new(name); | ||
| endfunction : new | ||
|
|
||
| task top_chip_dv_gpio_base_vseq::body(); | ||
| super.body(); | ||
| `DV_WAIT(cfg.sw_test_status_vif.sw_test_status == SwTestStatusInTest); | ||
|
|
||
| // Checks the GPIOs in both input and output mode. SW writes walking 0's and walking 1's pattern | ||
| // on the first and third quarter of direct_out register and body() waits (for a reasonable | ||
| // amount of timeout) for that pattern to appear on the pads. Then it drives all 1's and all 0's | ||
| // on the other even quaters. | ||
| // | ||
| // Enable the pulldowns so that the pads are driving 0's rather than Z's when no external driver | ||
| // is connected | ||
| cfg.gpio_vif.set_pulldown_en('1); | ||
|
|
||
| // Current Current GPIOs pads state : 'h0 | ||
|
|
||
| `uvm_info(`gfn, "Starting GPIOs outputs test", UVM_LOW) | ||
|
|
||
| // Check for walking 1's pattern on the first quarter of pins. | ||
| for (int i = 0; i < NUM_GPIOS/4; i++) begin | ||
| wait_for_pattern({24'h0, 1 << i}); | ||
| end | ||
|
|
||
| // Current GPIOs pads state : 'h00000080 | ||
| // | ||
| // Drive all 1's on the second quarter of pins. | ||
| drive_pattern(2, 1, 2, 1); | ||
|
|
||
| // Current GPIOs pads state : 'h0000FF80 | ||
| // | ||
| // Check for walking 1's pattern on the third quarter of pins. | ||
| for (int i = 0; i < NUM_GPIOS/4; i++) begin | ||
| wait_for_pattern({8'h0, 1 << i, 16'hFF80}); | ||
| end | ||
|
|
||
| // Current GPIOs pads state : 'h0080FF80 | ||
| // | ||
| // Drive all 1's on the fourth quarter of pins. | ||
| drive_pattern(2, 3, 4, 1); | ||
|
|
||
| // Current GPIOs pads state : 'hFF80FF80 | ||
| // | ||
| // The SW first sets the first and third quarter of GPIOs to 1's in order to walk 0's on them. | ||
| // The second and fourth quarter of pads should contain all 1's by now. | ||
| // | ||
| // Wait and check for all 1s. | ||
| wait_for_pattern({NUM_GPIOS{1'b1}}); | ||
|
|
||
| // Current GPIOs pads state : 'hFFFFFFFF | ||
| // | ||
| // Check for walking 0's pattern on the first quarter of pins. | ||
| for (int i = 0; i < NUM_GPIOS/4; i++) begin | ||
| wait_for_pattern({24'hFF_FFFF, ~(1 << i)}); | ||
| end | ||
|
|
||
| // Current GPIOs pads state : 'hFFFFFF7F | ||
| // | ||
| // Drive all 0's on the second quarter of pins. | ||
| drive_pattern(2, 1, 2, 0); | ||
|
|
||
| // Current GPIOs pads state : 'hFFFF007F | ||
| // | ||
| // Check for walking 0's pattern on on the third quarter of pins. | ||
| for (int i = 0; i < NUM_GPIOS/4; i++) begin | ||
| wait_for_pattern({8'hFF, ~(1 << i), 16'h007F}); | ||
| end | ||
|
|
||
| // Current GPIOs pads state : 'hFF7F007F | ||
| // | ||
| // Drive all 0's on the fourth quarter of pins. | ||
| drive_pattern(2, 3, 4, 0); | ||
|
|
||
| // Current GPIOs pads state : 'h007F007F | ||
| endtask : body | ||
|
|
||
| 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);, | ||
| $sformatf("Timed out waiting for GPIOs == %0h", exp_val), | ||
| /*use default_spinwait_timeout_ns*/, | ||
| `gfn) | ||
| endtask : wait_for_pattern | ||
|
|
||
| task top_chip_dv_gpio_base_vseq::drive_pattern(int unsigned wait_num_clks, | ||
| int unsigned pins_starting_quarter, | ||
| int unsigned pins_next_quarter, | ||
| bit state); | ||
|
|
||
| int unsigned quarter_start = (NUM_GPIOS/4) * pins_starting_quarter; | ||
| int unsigned quarter_end = (NUM_GPIOS/4) * pins_next_quarter; | ||
|
|
||
| // 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); | ||
|
|
||
| // Drive state on the quarter of pins | ||
| for (int i = quarter_start; i < quarter_end; i++) begin | ||
| cfg.gpio_vif.drive_pin(i, state); | ||
| end | ||
| endtask : drive_pattern | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
|
|
||
| # | ||
| # Mnemonic Maps | ||
| # | ||
| mmap new -reuse -name {Boolean as Logic} -radix %b -contents {{%c=FALSE -edgepriority 1 -shape low} | ||
| {%c=TRUE -edgepriority 1 -shape high}} | ||
| mmap new -reuse -name {Example Map} -radix %x -contents {{%b=11???? -bgcolor orange -label REG:%x -linecolor yellow -shape bus} | ||
| {%x=1F -bgcolor red -label ERROR -linecolor white -shape EVENT} | ||
| {%x=2C -bgcolor red -label ERROR -linecolor white -shape EVENT} | ||
| {%x=* -label %x -linecolor gray -shape bus}} | ||
|
|
||
| array unset createdGroup | ||
| array set createdGroup {} | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.clk_i}]} | ||
| } ]] | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.rst_ni}]} | ||
| } ]] | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.cio_gpio_i[31:0]}]} | ||
| } ]] | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.cio_gpio_en_o[31:0]}]} | ||
| } ]] | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.cio_gpio_o[31:0]}]} | ||
| } ]] | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.tl_i}]} | ||
| } ]] | ||
| set id [waveform add -signals [subst { | ||
| {[format {tb.dut.u_gpio.tl_o}]} | ||
| } ]] | ||
|
|
||
| waveform xview limits 0 501700.823ns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.