File tree Expand file tree Collapse file tree 1 file changed +0
-38
lines changed Expand file tree Collapse file tree 1 file changed +0
-38
lines changed Original file line number Diff line number Diff line change 3131logger = logging .getLogger (__name__ )
3232
3333
34- def make_hashable (cls ):
35- def __hash__ (self ):
36- return hash (id (self ))
37-
38- def __eq__ (self , obj ):
39- return id (self ) == id (obj )
40-
41- cls .__hash__ = __hash__
42- cls .__eq__ = __eq__
43- return cls
44-
45-
46- HeartbeatSignature = wiring .Signature ({"heartbeat_i" : In (1 )})
47-
48-
49- @make_hashable
50- @dataclass
51- class Heartbeat (Component ):
52- clock_domain : str = "sync"
53- counter_size : int = 23
54- name : str = "heartbeat"
55-
56- def __init__ (self , ports ):
57- super ().__init__ (HeartbeatSignature )
58- self .ports = ports
59-
60- def elaborate (self , platform ):
61- m = Module ()
62- # Heartbeat LED (to confirm clock/reset alive)
63- heartbeat_ctr = Signal (self .counter_size )
64- getattr (m .d , self .clock_domain ).__iadd__ (heartbeat_ctr .eq (heartbeat_ctr + 1 ))
65-
66- heartbeat_buffer = io .Buffer (io .Direction .Output , self .ports .heartbeat )
67- m .submodules .heartbeat_buffer = heartbeat_buffer
68- m .d .comb += heartbeat_buffer .o .eq (heartbeat_ctr [- 1 ]) # type: ignore
69- return m
70-
71-
7234class SiliconPlatformPort (io .PortLike , Generic [Pin ]):
7335 def __init__ (self ,
7436 name : str ,
You can’t perform that action at this time.
0 commit comments