@@ -56,6 +56,23 @@ def __init__(self, *, sources: list[Path], includes: list[Path] = [], include_di
5656 self .include_dirs = list (include_dirs )
5757 self .offset = offset
5858
59+ @dataclass
60+ class BinaryData :
61+ """
62+ This holds the information needed for building software and providing the built outcome
63+ """
64+ offset : int
65+ filename : Path
66+ build_dir : Path
67+ type : Literal ["BinaryData" ] = "BinaryData"
68+
69+ def __init__ (self , * , filename : Path , offset = 0 ):
70+ self .build_dir = _ensure_chipflow_root () / 'build' / 'software'
71+ if Path (filename ).is_absolute ():
72+ self .filename = filename
73+ else :
74+ self .filename = self .build_dir / filename
75+ self .offset = offset
5976
6077_T_DataClass = TypeVar ('_T_DataClass' , bound = DataclassProtocol )
6178class Data (TypedDict , Generic [_T_DataClass ]):
@@ -204,8 +221,9 @@ def __chipflow_parameters__(self):
204221
205222def attach_data (external_interface : wiring .PureInterface , component : wiring .Component , data : DataclassProtocol ):
206223 data_dict : Data = {'data' :data }
207- setattr (component .signature , '__chipflow_data__' , data_dict )
208- amaranth_annotate (Data , DATA_SCHEMA , '__chipflow_data__' , decorate_object = True )(component .signature )
224+ if component is not None :
225+ setattr (component .signature , '__chipflow_data__' , data_dict )
226+ amaranth_annotate (Data , DATA_SCHEMA , '__chipflow_data__' , decorate_object = True )(component .signature )
209227 setattr (external_interface .signature , '__chipflow_data__' , data_dict )
210228 amaranth_annotate (Data , DATA_SCHEMA , '__chipflow_data__' , decorate_object = True )(external_interface .signature )
211229
0 commit comments