Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic Aware Conversions #1

Open
dan-fritchman opened this issue Mar 28, 2022 · 0 comments
Open

Semantic Aware Conversions #1

dan-fritchman opened this issue Mar 28, 2022 · 0 comments

Comments

@dan-fritchman
Copy link
Owner

dan-fritchman commented Mar 28, 2022

The data model in Netlist to date could generally be described as an abstract syntax tree. A netlist.Program consists of strongly-typed Statements and Entrys, which refer to each other through things like the identifier (Ident). At no point are these identifiers resolved to what they represent.

Recent use-cases for sake of netlist-dialect conversion indicate this will probably need some resolution, and more generally, some semantics and a more concrete tree. The primary semantic-requiring problem is that some dialects (ahem, Spectre) allow for naming primitive instances by an arbitrary identifier - while most embed the instance-type in its instance-name prefix.

For example both of these are valid spectre-format "programs":

model mything bsim4 
+ version=4.5
+ // Lots of parameters 
+ // ...

// Now make an instance of `mything`
any_instance_name_i_want (d g s b) mything // And any parameters

And:

subckt mything ( d g s b) 
+ // Parameters 
ends 

// Now make another instance of `mything`, which is now a `subckt`
any_instance_name_i_want (d g s b) mything // And any parameters

However in most SPICE-native netlist formats, a syntax-to-syntax conversion fails in one case or the other, particularly on the instance-name any_instance_name_i_want. Most SPICE dialects would require this to be called Many_instance_name_i_want_ if it is a primitive MOS transistor, and to be called Xany_instance_name_i_want_ if it is a sub-circuit instance. These prefixes essentially form the SPICE "type system".

Rolling this in would require resolving just what mything is at instantiation time. This will not always be possible to determine, without knowing the entire target netlist-program's content. Particularly the two cases above could be on different section definitions of the same library file, like so:

section=now_im_a_model 

model mything bsim4 
+ version=4.5
+ // Lots of parameters 

endsection 

section=now_im_a_subckt

subckt mything ( d g s b) 
+ // Parameters 
ends 

endsection

More generally, SPICE and Spectre use C-like "copy-paste the whole file here" style inclusion. So making these resolution-decisions will require some expected set of content in the remainder of the netlist-program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant