88
99from dataclasses import dataclass
1010from pprint import pformat
11- from typing import TYPE_CHECKING , List , Dict
11+ from typing import TYPE_CHECKING , List
1212
13- from amaranth import Module , Signal , Cat , ClockDomain , ClockSignal , ResetSignal
13+ from amaranth import Module , Signal , ClockDomain , ClockSignal , ResetSignal
1414
1515from amaranth .lib import wiring , io
1616from amaranth .lib .cdc import FFSynchronizer
1717from amaranth .lib .wiring import Component , In , PureInterface
1818
19- from amaranth .back import rtlil
19+ from amaranth .back import rtlil #type: ignore[reportAttributeAccessIssue]
2020from amaranth .hdl import Fragment
2121from amaranth .hdl ._ir import PortDirection
2222
@@ -63,7 +63,7 @@ def elaborate(self, platform):
6363 heartbeat_ctr = Signal (self .counter_size )
6464 getattr (m .d , self .clock_domain ).__iadd__ (heartbeat_ctr .eq (heartbeat_ctr + 1 ))
6565
66- heartbeat_buffer = io .Buffer ("o" , self .ports .heartbeat )
66+ heartbeat_buffer = io .Buffer (io . Direction . Output , self .ports .heartbeat )
6767 m .submodules .heartbeat_buffer = heartbeat_buffer
6868 m .d .comb += heartbeat_buffer .o .eq (heartbeat_ctr [- 1 ]) # type: ignore
6969 return m
@@ -240,10 +240,10 @@ def __init__(self,
240240 self ._ie = None
241241
242242 if self ._oe is not None :
243- self ._oe_n = Signal (self ._oe .width , name = f"{ self ._name } $oeb" )
243+ self ._oe_n = Signal (self ._oe .shape (). width , name = f"{ self ._name } $oeb" )
244244 self ._signals .append ((self ._oe_n , PortDirection .Output ))
245245 if self ._i is not None :
246- self ._ie = Signal (self ._i .width , name = f"{ self ._name } $inp_dis" )
246+ self ._ie = Signal (self ._i .shape (). width , name = f"{ self ._name } $inp_dis" )
247247 self ._signals .append ((self ._ie , PortDirection .Input ))
248248
249249 # Port Configuration
@@ -387,7 +387,7 @@ def elaborate(self, platform):
387387class SiliconPlatform :
388388 def __init__ (self , config : 'Config' ):
389389 if not config .chipflow .silicon :
390- raise ChipFlowError (f "I can't build for silicon without a [chipflow.silicon] section to guide me!" )
390+ raise ChipFlowError ("I can't build for silicon without a [chipflow.silicon] section to guide me!" )
391391 self ._config = config
392392 self ._ports = {}
393393 self ._files = {}
@@ -411,16 +411,16 @@ def instantiate_ports(self, m: Module):
411411 print (pformat (self ._ports ))
412412 for clock in pinlock .port_map .get_clocks ():
413413 assert 'clock_domain' in clock .iomodel
414- domain = name = clock .iomodel ['clock_domain' ]
414+ domain = clock .iomodel ['clock_domain' ]
415415 setattr (m .domains , domain , ClockDomain (name = domain ))
416- clk_buffer = io .Buffer ("i" , self ._ports [clock .port_name ])
416+ clk_buffer = io .Buffer (io . Direction . Input , self ._ports [clock .port_name ])
417417 setattr (m .submodules , "clk_buffer_" + domain , clk_buffer )
418418 m .d .comb += ClockSignal ().eq (clk_buffer .i ) #type: ignore[reportAttributeAccessIssue]
419419
420420 for reset in pinlock .port_map .get_resets ():
421421 assert 'clock_domain' in reset .iomodel
422- domain = name = reset .iomodel ['clock_domain' ]
423- rst_buffer = io .Buffer ("i" , self ._ports [reset .port_name ])
422+ domain = reset .iomodel ['clock_domain' ]
423+ rst_buffer = io .Buffer (io . Direction . Input , self ._ports [reset .port_name ])
424424 setattr (m .submodules , reset .port_name , rst_buffer )
425425 setattr (m .submodules , reset .port_name + "_sync" , FFSynchronizer (rst_buffer .i , ResetSignal ())) #type: ignore[reportAttributeAccessIssue]
426426
0 commit comments