@@ -502,7 +502,7 @@ def get_clocks(self) -> List[Port]:
502502 for cn , i in c .items ():
503503 for ni , p in i .items ():
504504 if p .type == "clock" :
505- ret .append (i )
505+ ret .append (p )
506506 return ret
507507
508508 def get_resets (self ) -> List [Port ]:
@@ -511,7 +511,7 @@ def get_resets(self) -> List[Port]:
511511 for cn , i in c .items ():
512512 for ni , p in i .items ():
513513 if p .type == "reset" :
514- ret .append (i )
514+ ret .append (p )
515515 return ret
516516
517517
@@ -616,12 +616,12 @@ def _allocate_bringup(self, config: 'Config') -> Component:
616616 d : Interface = { 'sync-clk' : Port (type = 'clock' ,
617617 pins = [self .bringup_pins .core_clock ],
618618 port_name = 'sync-clk' ,
619- iomodel = IOModel (width = 1 , direction = io .Direction .Input )
619+ iomodel = IOModel (width = 1 , direction = io .Direction .Input , clock_domain_o = "sync" )
620620 ),
621621 'sync-rst' : Port (type = 'reset' ,
622622 pins = [self .bringup_pins .core_reset ],
623623 port_name = 'sync-rst' ,
624- iomodel = IOModel (width = 1 , direction = io .Direction .Input )
624+ iomodel = IOModel (width = 1 , direction = io .Direction .Input , clock_domain_o = "sync" )
625625 )
626626 }
627627 assert config .chipflow .silicon
@@ -630,7 +630,7 @@ def _allocate_bringup(self, config: 'Config') -> Component:
630630 d ['heartbeat' ] = Port (type = 'heartbeat' ,
631631 pins = [self .bringup_pins .core_heartbeat ],
632632 port_name = 'heartbeat' ,
633- iomodel = IOModel (width = 1 , direction = io .Direction .Output )
633+ iomodel = IOModel (width = 1 , direction = io .Direction .Output , clock_domain_i = "sync" )
634634 )
635635 #TODO: JTAG
636636 return {'bringup_pins' : d }
@@ -1068,9 +1068,13 @@ def load_pinlock():
10681068 chipflow_root = _ensure_chipflow_root ()
10691069 lockfile = pathlib .Path (chipflow_root , 'pins.lock' )
10701070 if lockfile .exists ():
1071- json = lockfile .read_text ()
1072- return LockFile .model_validate_json (json )
1073- raise ChipFlowError ("Lockfile pins.lock not found. Run `chipflow pin lock`" )
1071+ try :
1072+ json = lockfile .read_text ()
1073+ return LockFile .model_validate_json (json )
1074+ except pydantic .ValidationError :
1075+ raise ChipFlowError ("Lockfile `pins.lock` is misformed. Please remove and rerun chipflow pin lock`" )
1076+
1077+ raise ChipFlowError ("Lockfile `pins.lock` not found. Run `chipflow pin lock`" )
10741078
10751079
10761080def top_components (config ):
@@ -1084,6 +1088,8 @@ def top_components(config):
10841088 param = name .split ('.' )[1 ]
10851089 logger .debug (f"Config { param } = { conf } found for { name } " )
10861090 component_configs [param ] = conf
1091+ if name .startswith ('_' ):
1092+ raise ChipFlowError (f"Top components cannot start with '_': { name } " )
10871093
10881094 # Second pass: instantiate components
10891095 for name , ref in config .chipflow .top .items ():
0 commit comments