cucapra / filament

Fearless hardware design
http://filamenthdl.com/
MIT License
159 stars 9 forks source link

Simplify signature monomorphization #281

Open gabizon103 opened 1 year ago

gabizon103 commented 1 year ago

In monomorphization, we have a function to monomorphize a component's signature because this needs to be done as we add things to the queue. Externals and non-external components call the same function, which is a little messy because they are handled differently. For non-externals, we rewrite and replace any parameterized expressions that show up (like in signature port widths, for example). For externals, we don't rewrite anything and maintain the parameters, so basically just copy everything over and insert relevant information into our maps. Separating out these two cases more explicitly would be good.

rachitnigam commented 1 year ago

I think there is a further opportunity to simplify things by merging the MonoSig and MonoDeferred structs. Since #310, a component is immediately monomorphized when we come across its instantiation which means there is no point in having a separation to have another struct with the deferral.