-
Notifications
You must be signed in to change notification settings - Fork 205
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
verilog language plugin #316
Conversation
f89907b
to
0bf5e30
Compare
92eb34c
to
c359f38
Compare
this is now functional and ready for merge. the travis thing has again stalled, so could someone retrigger the check please? |
At first, CMake build is broken. Qucs could be built but then crashes if it is executed. Autotools build has no visible problems. At second this PR is becoming a real "patchbomb". This solution is raw, and it' not time to merge it before release. Also see my arguments at #275 discussion thread. I strongly don't recommend to merge this PR. |
can you suggest what to do differently or better, i'd be happy to change it. let me see what i can do about the cmake crash... can you provide some details on your platform or a logfile? EDIT: rebuilt using cmake both with gcc and clang, could not reproduce the crash. thanks |
qucs/qucs/main.cpp
Outdated
@@ -876,7 +895,7 @@ int main(int argc, char *argv[]) | |||
} | |||
// create netlist from schematic | |||
if (netlist_flag) { | |||
return doNetlist(inputfile, outputfile); | |||
return doNetlist(inputfile, outputfile, netlang); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, it is better to put "netlang" as the property of the "Schematic" class object.
Schematic::getNetlist can return the netlist then.
You can get rid of "NetLang const*" in many functions. I am opting for keeping the function call changes minimal.
If there is something else in the future that may also affect the netlisting, we should not be passing that through functions.
no, a schematic is not of any language. just a schematic. simllarly, when dumping a schematic into pdf, there's no point in telling the schematic beforehand. but that brings me to the idea that the pdfWriter is actually a netlist plugin. similarly, the .sch-writer must also be a "netlister".... these are indentically structured as it seems. sure, "NetLang" is not general enough a name for this thing. can you think of a better name? |
Did not dig more but is there a "Netlister" class that takes in the schematic and generates the netlist based on its current language? As I see it, there should be 4 steps to implement a new simulator. The user changes the simulator that updates a global enum "simulator"; most possibly in "QucsSettings". The "Netlister" knows which "language" to use and which simulator to invoke, the "DataParser" knows which method to use to parse.
The enum can handle that. Modifying each function with There is an assumption here; one type of netlist and one type of data file per simulator dictated by a single enum value. |
probably there should be one, so it remains possible to exchange it. i can only recommend to take a look at the
dont confuse the netlister with what i called NetLang. NetLang only defines the language. the netlister merely visits the schematic elements. we should really try to work towards a singe netlister.
no. the progress monitor should not change. why would we need different progess minotors for different simulators? we should start with the simulator-options dialog, this is more obviously simulator independent.
huh, how would an enum propose a name for the netlister? let me propose one: how about
the functions that are language specific should not even be implemented as part of the language class. it would be okay to modify the netlister with bools or enums, but only in a sensible way (such as: "order alphabetically or by position" and "collapse wires" and "dive into prototypes"). this could be done more elegant simply by inheritance. (which ones do we actually need?) for example, collapsing the wires to nets is used for all spice simulators, it should obviously be implemented only once.
no such assumption applies. but i dont really know what you do here.
this is part of as a next step (after the merge debacle has settled...), we should finish the other NetLang (SchematicStreamLang?) classes and streamline the netlister/SchematicStreamer. |
Same here.
Because every simulator spits out the progress status in a different manner.
Each enum value will be tied to a specific netlisting language. Since, there is going to be a single netlisting class, the class will know about the language through this global value. This will help avoid modifying the functions and passing the net language as a parameter.
Have you added the description of language class and what it does? I assumed that netlister accepts net language as a parameter and does the whole job.
Well, let's skip it for a while or drink more coffee and read it again. 😉
What does it do and how does it connect to the other classes? In QEP:
Should be
I agree, but you missed the point; text output is slow and inefficient. Moreover: |
the progress bar only needs to know the current progress. the Simulator class runs the simulator (whichever way) and only needs to pass numbers to the progress bar. choosing a progress format shouldn't be rocket science, how about a short unsigned? (and more elaborate things if you intend to have more elaborate progress bars).
no. the netlister does not even need to know that we have a simulator at hand. we only need to specify the language. and no again, we need to pass a reference to a stream, not a string. so we actually have
no. i want to deliberately make it an implementation detail of the simulator class whether or not text files are used at all, this way you can start with the current approach (and just move code around) and then implement another simulator plugin that does the same, but efficient.
i will give it a try later this evening. i should also add an independent QEP (how about a PR?!) on the netlister base class. |
agree. For my typical simulations the fact that text output might be slower and take up more space than a binary format is inconsequential. Leave the choice of the simulator output format to the user. Text is nicer for post processing, usually. |
I generally use QEP in context.
So, if you are not consistent with the QEP, I have no way to read your mind.
By, that I meant the processor of the output from the simulator (during simulation); warnings, etc.
As above. Of course, as a start, we dump everything to a text box. Once again:
What does it do and how does it connect to the other classes?
"Netlister": "SchematicTranslator" I personally do not like the "language" thing at all.
Well, if you do not like to discuss the details; fine but I have never encountered this data type!
Go for a PR or these stories will never end. |
lucky you!
and
are essentially the same. except the second would permit multiple netlisters. i am still unsure if we really need/want multiples.
to me, "translator" feels misleading. a translation sounds like something lossless. netlisting looses information. so does printing into png/ps/png. if you "translate" a book, then what you get will also be a book. this does not hold for the netlister. hence, i prefer "serializer", which is more correct...
this is debatable. which class should in your opinion implement how an item is represented in the output stream?
ok. there's one PR. this. do you suggest any changes? |
does not work on appveyor. i think i need the platform dependent interface stuff prepared in #458... |
Here is a set of test schematic and commented netlist that should be processed by future SPICE netlister:
This schematic uses parametric equations, two simulations, and postprocessor equation (Eqn1). I see the following problem that makes automatic generation of such SPICE netlist difficult with you netlister:
Generic netlist may have at least four sections:
Qucsator has only third section. Other are empty. But SPICE has all four. Verilog-A has only 1 to 3. Currentlys we have the following scturcture of netlister algorithm:
But probably the following algorithm will be needed:
How do you suggest to solve these problems with netlist generation? |
Also here I post the list of unified devices supported by all simulators. They are:
These devices should be processed by every simulator. |
thanks could you please open a pr with those, together with a command and the expected reference output? i will help turning them into unit tests. will rebase this later (as soon as the other depencencies are merged). then we will see what it breaks. there will be no spice netlister in this PR, please open a new one. lets do things systematically, one at a time. |
i don't quite like the way directives and components are mixed up in the schematic container. i don't know what the best solution is. perhaps we should either allow plugins for netlisting, that will give us anything we need. alternatives are flags for filtering out stuff, or even store the schematic data in a more useful way (i.e. grouped). maybe we should open an issue... need to think about it see #689 |
netlisting should be trivial. so this is mostly cleaning up. - intruduce a base class for commands, so they are distingushable - sanitize command type names (remove leading dot). - don't print empty argument list in verilog netlist - print commands as comments in verilog
- help text - improve grammar - fix typo - extend (-l) - plugins - verilog plugin - extend dispatcher, also dispatch NetLang - verilog netLang implementation stub
this has undergone in a previous commit that introduces the Command class and cleans up type names.
need to untangle more
this is generally useful and necessary on mingw.
23325b3
to
69d780a
Compare
now part of refactor branch. turned into (optional) demo/test. |
this is based on the other PR, actually just one commit.
the verilog specific code does not touch the schematic code.