@@ -8,6 +8,8 @@ class top_chip_dv_gpio_base_vseq extends top_chip_dv_base_vseq;
88 // Standard SV/UVM methods
99 extern function new (string name = " " );
1010 extern task body ();
11+ extern virtual task gpio_output_test ();
12+ extern virtual task gpio_input_test ();
1113endclass : top_chip_dv_gpio_base_vseq
1214
1315function top_chip_dv_gpio_base_vseq::new (string name = " " );
@@ -17,5 +19,77 @@ endfunction : new
1719task top_chip_dv_gpio_base_vseq::body ();
1820 super .body ();
1921 `DV_WAIT (cfg.sw_test_status_vif.sw_test_status == SwTestStatusInTest);
20- // TODO
22+ gpio_output_test ();
23+ gpio_input_test ();
2124endtask : body
25+
26+ task top_chip_dv_gpio_base_vseq::gpio_output_test ();
27+ // Disable GPIOs from being driven as chip inputs.
28+ cfg.gpio_vif.drive_en ({ NUM_GPIOS { 1'b0 }} );
29+
30+ `uvm_info (`gfn , " Starting GPIO output test" , UVM_LOW )
31+
32+ // Wait and check all 0s.
33+ `DV_SPINWAIT (wait (cfg.gpio_vif.pins === { NUM_GPIOS { 1'b0 }} );,
34+ $sformatf (" Timed out waiting for GPIOs == %0h " , { NUM_GPIOS { 1'b0 }} ),
35+ /* use default_spinwait_timeout_ns*/ ,
36+ `gfn )
37+
38+ // Check for W1 pattern on the GPIO output pins.
39+ for (int i = 0 ; i < NUM_GPIOS ; i++ ) begin
40+ logic [NUM_GPIOS - 1 : 0 ] exp_gpios = 1 << i;
41+ `DV_SPINWAIT (wait (cfg.gpio_vif.pins === exp_gpios);,
42+ $sformatf (" Timed out waiting for GPIOs == %0h " , exp_gpios),
43+ /* use default_spinwait_timeout_ns*/ ,
44+ `gfn )
45+ end
46+
47+ // Wait and check all 1s.
48+ `DV_SPINWAIT (wait (cfg.gpio_vif.pins === { NUM_GPIOS { 1'b1 }} );,
49+ $sformatf (" Timed out waiting for GPIOs == %0h " , { NUM_GPIOS { 1'b1 }} ),
50+ /* use default_spinwait_timeout_ns*/ ,
51+ `gfn )
52+
53+ // Check for W0 pattern on the GPIO output pins.
54+ for (int i = 0 ; i < NUM_GPIOS ; i++ ) begin
55+ logic [NUM_GPIOS - 1 : 0 ] exp_gpios = ~ (1 << i);
56+ `DV_SPINWAIT (wait (cfg.gpio_vif.pins === exp_gpios);,
57+ $sformatf (" Timed out waiting for GPIOs == %0h " , exp_gpios),
58+ /* use default_spinwait_timeout_ns*/ ,
59+ `gfn )
60+ end
61+ endtask : gpio_output_test
62+
63+ task top_chip_dv_gpio_base_vseq::gpio_input_test ();
64+ // Wait and check all zs - this indicates it is safe to drive GPIOs as inputs.
65+ `DV_SPINWAIT (wait (cfg.gpio_vif.pins === { NUM_GPIOS { 1'bZ }} );,
66+ $sformatf (" Timed out waiting for GPIOs == %0h " , { NUM_GPIOS { 1'bZ }} ),
67+ /* use default_spinwait_timeout_ns*/ ,
68+ `gfn )
69+
70+ cfg.peri_clk_vif.wait_clks (1 );
71+
72+ cfg.gpio_vif.drive ({ NUM_GPIOS { 1'b0 }} );
73+
74+ cfg.peri_clk_vif.wait_clks (1 );
75+
76+ `uvm_info (`gfn , " Starting GPIO input test" , UVM_LOW )
77+
78+ // Drive W1 pattern
79+ for (int i = 0 ; i < NUM_GPIOS ; i++ ) begin
80+ cfg.gpio_vif.drive (1 << i);
81+ cfg.peri_clk_vif.wait_clks (1 );
82+ end
83+
84+ cfg.gpio_vif.drive ({ NUM_GPIOS { 1'b1 }} );
85+
86+ cfg.peri_clk_vif.wait_clks (1 );
87+
88+ `uvm_info (`gfn , " Starting GPIO input test" , UVM_LOW )
89+
90+ // Drive W0 pattern
91+ for (int i = 0 ; i < NUM_GPIOS ; i++ ) begin
92+ cfg.gpio_vif.drive (~ (1 << i));
93+ cfg.peri_clk_vif.wait_clks (1 );
94+ end
95+ endtask : gpio_input_test
0 commit comments