33# SPDX-License-Identifier: BSD-2-Clause
44
55import unittest
6+ import warnings
7+
68from amaranth import *
79from amaranth .sim import *
10+ from amaranth .hdl import UnusedElaboratable
811
912from chipflow_digital_ip .io import GPIOPeripheral
1013
@@ -24,11 +27,18 @@ def test_init(self):
2427
2528 def test_init_wrong_pin_count (self ):
2629 with self .assertRaisesRegex (TypeError ,
27- r"Pin count must be a positive integer, not ' foo' " ):
30+ r"Pin count must be a positive integer, not foo" ):
2831 GPIOPeripheral (pin_count = "foo" , addr_width = 2 , data_width = 8 )
29- with self .assertRaisesRegex (TypeError ,
30- r"Pin count must be a positive integer, not 0" ):
32+ with self .assertRaisesRegex (ValueError ,
33+ r"Pin pin_count must be a postive integrer less than 32, not -1" ):
34+ GPIOPeripheral (pin_count = - 1 , addr_width = 2 , data_width = 8 )
35+ with self .assertRaisesRegex (ValueError ,
36+ r"Pin pin_count must be a postive integrer less than 32, not 0" ):
3137 GPIOPeripheral (pin_count = 0 , addr_width = 2 , data_width = 8 )
38+ with self .assertRaisesRegex (ValueError ,
39+ r"Pin pin_count must be a postive integrer less than 32, not 33" ):
40+ GPIOPeripheral (pin_count = 33 , addr_width = 2 , data_width = 8 )
41+
3242
3343 def test_init_wrong_input_stages (self ):
3444 with self .assertRaisesRegex (TypeError ,
@@ -53,6 +63,9 @@ def test_smoke_test(self):
5363 """
5464 Smoke test GPIO. We assume that amaranth-soc GPIO tests are fully testing functionality.
5565 """
66+
67+ warnings .simplefilter (action = "ignore" , category = UnusedElaboratable )
68+
5669 dut = GPIOPeripheral (pin_count = 4 , addr_width = 2 , data_width = 8 )
5770
5871 mode_addr = 0x0
0 commit comments