Improve reading the source code sequence by extra comments:
While searching for 'Parsing the circuit', the sequence of major functions is revealed.
This commit is contained in:
parent
7ab6c6f4af
commit
cec426292f
|
|
@ -530,7 +530,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
char *dir_name = ngdirname(filename ? filename : ".");
|
||||
|
||||
startTime = seconds();
|
||||
/* inp_source() called with fp: load from file, */
|
||||
/* Parsing the circuit 2.
|
||||
This is the next major step:
|
||||
inp_source() called with fp: load circuit netlist from file, */
|
||||
/* called with *fp == NULL and intfile: we want to load circuit from circarray */
|
||||
if (fp || intfile) {
|
||||
deck = inp_readall(fp, dir_name, filename, comfile, intfile, &expr_w_temper);
|
||||
|
|
@ -931,7 +933,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
}
|
||||
}
|
||||
|
||||
/* Now expand subcircuit macros and substitute numparams.*/
|
||||
/* Parsing the circuit 4.
|
||||
This is the next major step:
|
||||
Expand subcircuit macros and substitute numparams.*/
|
||||
if (!cp_getvar("nosubckt", CP_BOOL, NULL, 0))
|
||||
if ((deck->nextcard = inp_subcktexpand(deck->nextcard)) == NULL) {
|
||||
line_free(realdeck, TRUE);
|
||||
|
|
@ -1084,7 +1088,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
if (newcompat.hs || newcompat.spe)
|
||||
rem_unused_mos_models(deck->nextcard);
|
||||
#endif
|
||||
/* now load deck into ft_curckt -- the current circuit. */
|
||||
/* Parsing the circuit 5.
|
||||
This is the next major step:
|
||||
load deck into ft_curckt -- the current circuit. */
|
||||
if(inp_dodeck(deck, tt, wl_first, FALSE, options, filename) != 0)
|
||||
return 1;
|
||||
|
||||
|
|
@ -1411,6 +1417,10 @@ inp_dodeck(
|
|||
*---------------------------------------------------*/
|
||||
if (!noparse) {
|
||||
startTime = seconds();
|
||||
/* Parsing the circuit 6.
|
||||
This is the next major step:
|
||||
Input a single deck, and return a pointer to the circuit.
|
||||
Parse all models and instances */
|
||||
ckt = if_inpdeck(deck, &tab);
|
||||
ft_curckt->FTEstats->FTESTATnetParseTime = seconds() - startTime;
|
||||
/* if .probe, rename the current measurement node vcurr_ */
|
||||
|
|
|
|||
|
|
@ -1054,6 +1054,10 @@ struct card *inp_readall(FILE *fp, const char *dir_name, const char* file_name,
|
|||
/* set the members of the compatibility structure */
|
||||
set_compat_mode();
|
||||
|
||||
/* Parsing the circuit 3.
|
||||
This is the next major step:
|
||||
Reading the netlist line by line, handle .include and .lib,
|
||||
line continuation and upper/lower casing */
|
||||
rv = inp_read(fp, 0, dir_name, file_name, comfile, intfile);
|
||||
cc = rv.cc;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,8 +93,9 @@ static int finddev(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel *
|
|||
/* espice fix integration */
|
||||
static int finddev_special(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel **modptr, int *device_or_model);
|
||||
|
||||
/* Input a single deck, and return a pointer to the circuit. */
|
||||
|
||||
/* Input a single deck, and return a pointer to the circuit.
|
||||
Parse all models in function INPpas1, instances (devices) in INPpas2,
|
||||
consider initial conditions (INPpas3), and shunt capacitors (INPpas4). */
|
||||
CKTcircuit *
|
||||
if_inpdeck(struct card *deck, INPtables **tab)
|
||||
{
|
||||
|
|
@ -162,16 +163,23 @@ if_inpdeck(struct card *deck, INPtables **tab)
|
|||
|
||||
ft_curckt->ci_curTask = ft_curckt->ci_defTask;
|
||||
|
||||
/* Parse the .model lines. Enter the model into the global model table modtab. */
|
||||
modtab = NULL;
|
||||
modtabhash = NULL;
|
||||
/* Parse .model lines, put them into 'tab' */
|
||||
/* Parsing the circuit 7.
|
||||
This is the next major step:
|
||||
Parse the .model lines.
|
||||
Enter the model into the global model table modtab
|
||||
and into the corresponding hash table modtabhash.
|
||||
The role of 'tab' is unclear (not used any more?). */
|
||||
INPpas1(ckt, deck->nextcard, *tab);
|
||||
/* store the new model table in the current circuit */
|
||||
/* store the new model tables in the current circuit */
|
||||
ft_curckt->ci_modtab = modtab;
|
||||
ft_curckt->ci_modtabhash = modtabhash;
|
||||
|
||||
/* Scan through the instance lines and parse the circuit. */
|
||||
/* Parsing the circuit 8.
|
||||
This is the next major step:
|
||||
Scan through the instance lines and parse the circuit.
|
||||
Set up the circuit matrix. */
|
||||
INPpas2(ckt, deck->nextcard, *tab, ft_curckt->ci_defTask);
|
||||
#ifdef XSPICE
|
||||
if (!Evtcheck_nodes(ckt, *tab)) {
|
||||
|
|
|
|||
|
|
@ -1490,7 +1490,10 @@ int main(int argc, char **argv)
|
|||
gotone = FALSE; // Re-use
|
||||
|
||||
if (tempfile && (!err || !ft_batchmode)) {
|
||||
/* Copy the input file name for becoming another file search path */
|
||||
/* Parsing the circuit 1.
|
||||
This is the next major step:
|
||||
Source the input file, then parse the data and create the circuit.
|
||||
Copy the input file name for becoming another file search path */
|
||||
if (inp_spsource(tempfile, FALSE, dname, FALSE) != 0) {
|
||||
fprintf(stderr, " Simulation interrupted due to error!\n\n");
|
||||
if (ft_stricterror || (oflag && !cp_getvar("interactive", CP_BOOL, NULL, 0)))
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inppas1.h"
|
||||
|
||||
/*
|
||||
* The first pass of the circuit parser just looks for '.model' lines
|
||||
*/
|
||||
|
||||
The first pass of the circuit parser just looks for '.model' lines,
|
||||
and sticks model into model table tab. */
|
||||
void INPpas1(CKTcircuit *ckt, struct card *deck, INPtables * tab)
|
||||
{
|
||||
struct card *current;
|
||||
|
|
|
|||
|
|
@ -1340,7 +1340,9 @@ wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR
|
|||
/* Wait until everything is settled */
|
||||
WaitForIdle();
|
||||
|
||||
/* Go to main() */
|
||||
/* Parsing the command line.
|
||||
This is the next major step:
|
||||
Go to main() for reading the start command line and preparing the simulator. */
|
||||
nReturnCode = xmain(argc, argv);
|
||||
|
||||
THE_END:
|
||||
|
|
|
|||
Loading…
Reference in New Issue