From MAILER-DAEMON Wed Dec 12 09:35:29 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TinPF-0003aJ-54 for mharc-gnucap-devel@gnu.org; Wed, 12 Dec 2012 09:35:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TinP6-0003Cf-JF for gnucap-devel@gnu.org; Wed, 12 Dec 2012 09:35:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TinP0-0008MW-SN for gnucap-devel@gnu.org; Wed, 12 Dec 2012 09:35:20 -0500 Received: from ist.d-labs.de ([213.239.218.44]:60639 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TinP0-0008MQ-Mg for gnucap-devel@gnu.org; Wed, 12 Dec 2012 09:35:14 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id E977E7F804; Wed, 12 Dec 2012 15:35:11 +0100 (CET) Date: Wed, 12 Dec 2012 15:35:11 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121212143511.GA21336@d-labs.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: [Gnucap-devel] 2 bugs X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2012 14:35:27 -0000 hi Al. Savants LANG_GEDA uses get_line on a CS initialized by a (one line) string. this is not necessary, but i think valid. so get_line must be extended to throw Exception_End_Of_Input in that case. currently it runs into assert(_file==stdin) unless _file, which is bad. when typing > verilog > module foo(); > endmodule; > foo a(1,2); > list the 3rd assertion in COMPONENT::port_value(int i)const is hit. compiled with -DNDEBUG it outputs [..] foo #() a (.?????(1),.?????(2)); so either this is correct, or the instanciation of a should fail. regards felix From MAILER-DAEMON Wed Dec 12 12:57:31 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TiqYl-0000e6-Bd for mharc-gnucap-devel@gnu.org; Wed, 12 Dec 2012 12:57:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiqYe-0000cr-A8 for gnucap-devel@gnu.org; Wed, 12 Dec 2012 12:57:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiqYX-0006QX-KR for gnucap-devel@gnu.org; Wed, 12 Dec 2012 12:57:24 -0500 Received: from smtpout08-01.prod.mesa1.secureserver.net ([64.202.165.119]:42840 helo=smtpout08.prod.mesa1.secureserver.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TiqYX-0006Ob-Bb for gnucap-devel@gnu.org; Wed, 12 Dec 2012 12:57:17 -0500 Received: (qmail 8291 invoked from network); 12 Dec 2012 17:57:07 -0000 Received: from unknown (24.148.114.161) by smtpout08.prod.mesa1.secureserver.net (64.202.165.119) with ESMTP; 12 Dec 2012 17:57:07 -0000 From: al davis To: gnucap-devel@gnu.org Date: Wed, 12 Dec 2012 12:57:06 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) References: <20121212143511.GA21336@d-labs.de> In-Reply-To: <20121212143511.GA21336@d-labs.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212121257.06614.ad211@freeelectron.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 64.202.165.119 Subject: Re: [Gnucap-devel] 2 bugs X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2012 17:57:30 -0000 On Wednesday 12 December 2012, Felix Salfelder wrote: > when typing > > > verilog > > module foo(); > > endmodule; > > foo a(1,2); > > list > > the 3rd assertion in COMPONENT::port_value(int i)const is > hit. compiled with -DNDEBUG it outputs > [..] > foo #() a (.?????(1),.?????(2)); > so either this is correct, or the instanciation of a should > fail. instanciation of a should fail. From MAILER-DAEMON Wed Dec 12 13:14:07 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Tiqop-0001wl-6g for mharc-gnucap-devel@gnu.org; Wed, 12 Dec 2012 13:14:07 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiqoh-0001vB-GM for gnucap-devel@gnu.org; Wed, 12 Dec 2012 13:14:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tiqod-0002hH-Hz for gnucap-devel@gnu.org; Wed, 12 Dec 2012 13:13:59 -0500 Received: from ist.d-labs.de ([213.239.218.44]:34420 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiqod-0002hA-BZ for gnucap-devel@gnu.org; Wed, 12 Dec 2012 13:13:55 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id 7C21F7F804; Wed, 12 Dec 2012 19:13:53 +0100 (CET) Date: Wed, 12 Dec 2012 19:13:53 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121212181353.GA30755@d-labs.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: [Gnucap-devel] another assertion 'bug' X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2012 18:14:05 -0000 Hi Al. DEV_SUBCKT::expand() calls assert(model && model == _parent); if i read the code right, Savant instanciates "!_" subcircuits and then changes the dev_type to the 'device' attribute. i see nothing wrong with that.... but what is correct, the assertion or set_dev_type? regards felix From MAILER-DAEMON Thu Dec 13 06:43:29 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Tj7CL-0001Xa-9N for mharc-gnucap-devel@gnu.org; Thu, 13 Dec 2012 06:43:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj7CE-0001VV-TC for gnucap-devel@gnu.org; Thu, 13 Dec 2012 06:43:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tj7CA-0001GN-EH for gnucap-devel@gnu.org; Thu, 13 Dec 2012 06:43:22 -0500 Received: from p3plsmtpa06-05.prod.phx3.secureserver.net ([173.201.192.106]:47572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj7CA-0001GB-3a for gnucap-devel@gnu.org; Thu, 13 Dec 2012 06:43:18 -0500 Received: from floyd.localnet ([24.148.114.161]) by p3plsmtpa06-05.prod.phx3.secureserver.net with id azjG1k0073V00DC01zjGrw; Thu, 13 Dec 2012 04:43:16 -0700 From: al davis To: gnucap-devel@gnu.org Date: Thu, 13 Dec 2012 06:43:15 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) References: <20121212181353.GA30755@d-labs.de> In-Reply-To: <20121212181353.GA30755@d-labs.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212130643.15834.ad211@freeelectron.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 173.201.192.106 Subject: Re: [Gnucap-devel] another assertion 'bug' X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 11:43:28 -0000 On Wednesday 12 December 2012, Felix Salfelder wrote: > DEV_SUBCKT::expand() calls > assert(model && model == _parent); > > if i read the code right, Savant instanciates "!_" > subcircuits and then changes the dev_type to the 'device' > attribute. i see nothing wrong with that.... (not reading Savant's code) That is half correct. It is correct, in parsing, to set_dev_type to the 'device' attribute, but incorrect to make them all subcircuits. The correct procedure is to use the 'device' attribute to determine what kind of device to instanciate, not necessarily a subckt. It might be, for example, a resistor. The dev_type is not an arbitrary string. What is valid there depends on what the base device is. It's the first field in Verilog. For those cases where it is a subcircuit (type X in Spice) the correct dev_type is the name associated with the subcircuit. For those cases where it is a device like a diode that in Spice would have a .model card, it's the name associated with that .model card. So, looking at that code in DEV_SUBCKT::expand() ================ const CARD* model = find_looking_out(c->modelname()); if (!_parent) { if(!dynamic_cast(model)) { throw Exception_Type_Mismatch(long_label(), c->modelname(), "subckt"); }else{ _parent = prechecked_cast(model); } }else{ assert(model && model == _parent); } ================ The _parent is the .subckt in spice, or the module in verilog. That block of code establishes an association between an instanciation and its parent. Before this, all we know is that there is a parent subcircuit somewhere. Expand finds it and makes a shallow copy of it. That is .. it copies the device bodies, but may or may not copy the commons. It may instead just link to them. The true part .. if (!_parent) .... (read that "if no parent") .. finds it and sets the link. This is always the case the first time it is called. The else part, which really does nothing, happens when expand is called again. There is no need to repeat the lookup when it is already known, except to check it for validity. If all is well, it will always be the same as it was the first time. On looking at it today, I see that the code is wasteful in that it looks up again when it is not needed. This is important because find_looking_out is slow. That needs to be fixed, but it is not relevant to this. All uses of find_looking_out, and find_looking_out itself need to be examined and reworked for efficiency. In this case, the code should be changed to: /*--------------------------------------------------------------------------*/ void DEV_SUBCKT::expand() { BASE_SUBCKT::expand(); COMMON_SUBCKT* c = prechecked_cast(mutable_common()); assert(c); if (!_parent) { const CARD* model = find_looking_out(c->modelname()); if(!dynamic_cast(model)) { throw Exception_Type_Mismatch(long_label(), c->modelname(), "subckt"); }else{ _parent = prechecked_cast(model); } }else{ assert(find_looking_out(c->modelname()) == _parent); } assert(_parent->subckt()); assert(_parent->subckt()->params()); PARAM_LIST* pl = const_cast(_parent->subckt()->params()); assert(pl); c->_params.set_try_again(pl); renew_subckt(_parent, this, scope(), &(c->_params)); subckt()->expand(); } /*--------------------------------------------------------------------------*/ But this change is for efficiency, nothing to do with the problem at hand. Back to the original question ... If I understand correctly, the problem is that he always starts with a subckt. The correct way is for find_type_in_string to find the device attribute, which specifies the type. From MAILER-DAEMON Thu Dec 13 07:31:49 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Tj7x7-0008N6-Q2 for mharc-gnucap-devel@gnu.org; Thu, 13 Dec 2012 07:31:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj7x5-0008Mf-J0 for gnucap-devel@gnu.org; Thu, 13 Dec 2012 07:31:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tj7wx-0005ml-MK for gnucap-devel@gnu.org; Thu, 13 Dec 2012 07:31:47 -0500 Received: from ist.d-labs.de ([213.239.218.44]:38841 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj7wx-0005lY-G4 for gnucap-devel@gnu.org; Thu, 13 Dec 2012 07:31:39 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id 578F47F8DA; Thu, 13 Dec 2012 13:31:38 +0100 (CET) Date: Thu, 13 Dec 2012 13:31:38 +0100 From: Felix Salfelder To: al davis Message-ID: <20121213123138.GC30755@d-labs.de> References: <20121212181353.GA30755@d-labs.de> <201212130643.15834.ad211@freeelectron.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201212130643.15834.ad211@freeelectron.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Cc: gnucap-devel@gnu.org Subject: Re: [Gnucap-devel] another assertion 'bug' X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 12:31:48 -0000 On Thu, Dec 13, 2012 at 06:43:15AM -0500, al davis wrote: > It is correct, in parsing, to set_dev_type to the 'device' > attribute, but incorrect to make them all subcircuits. i've worked this out some more. i think the following is desirable: - if there is a device attribute and (some_dispatcher[device] || find_looking_out(device)), use that device - else, instanciate a fake sckt that collects the parameters. this wont simulate, but set_dev_type makes the list command happy. unfortunately savant's find_type_in_string has no access to the body of the device. for example find_type_in_string on C 1 2 3 4 some-symbol.sym { device=some-other } will not know about some-other. so (my approach, not changing the parser much) looks a bit more involved: - instanciate a fake-sckt - if the symbol has a device attribute the device_dispatcher knows (and it matches the pincount whatsoever) use that device as type - otherwise instanciate that fake-sckt and set-dev-type the first case is simple, but doesnt allow the user override the device attribute (*). in the second case, a device is instanciated and potentially set_type to some-other. this way the user may override the device attribute if a subckt matching the pins is present. > The correct procedure is to use the 'device' attribute to > determine what kind of device to instanciate, not necessarily a > subckt. It might be, for example, a resistor. i'm not sure whether (*) is bad. but it is a place to start. for translation, this should be not an issue. for simulation, i've got some other problems to solve first. > In this case, the code should be changed to: > assert(find_looking_out(c->modelname()) == _parent); > [..] this looks much better. > Back to the original question ... If I understand correctly, > the problem is that he always starts with a subckt. The correct > way is for find_type_in_string to find the device attribute, > which specifies the type. you do. yes, my code approximates this: if(_componentmod){ // read: "do _!-fake-sckt first" type = "C"; // C is a command that declares the fake-sckt }else{ type = _componentname; // name of the fake-sckt string X, basename; cmd>>X>>" ">>X>>" ">>X>>" ">>X>>" ">>X>>" ">>basename; GEDA_SYMBOL sym = _symbol[basename]; if(sym.has_key("device")){ if (CARD* c = device_dispatcher[sym["device"]]){ COMPONENT* d = prechecked_cast(c); if ( d->max_nodes() >= sym.pincount() && d->min_nodes() <= sym.pincount()){ type = sym["device"]; } } } else if(sym.has_key("net")){ if (CARD* c = device_dispatcher["rail"]){ COMPONENT* d = prechecked_cast(c); if ( d->max_nodes() >= sym.pincount() && d->min_nodes() <= sym.pincount()){ type = "rail"; // something like this is needed to // connect GND nets and the like } } } } regards felix From MAILER-DAEMON Thu Dec 13 19:41:27 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TjJLD-0000WE-9X for mharc-gnucap-devel@gnu.org; Thu, 13 Dec 2012 19:41:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjJLA-0000TT-0g for gnucap-devel@gnu.org; Thu, 13 Dec 2012 19:41:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjJL8-0005Zy-RH for gnucap-devel@gnu.org; Thu, 13 Dec 2012 19:41:23 -0500 Received: from p3plsmtpa01-08.prod.phx3.secureserver.net ([72.167.82.88]:35332) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TjJL8-0005YG-Jb for gnucap-devel@gnu.org; Thu, 13 Dec 2012 19:41:22 -0500 Received: (qmail 2683 invoked from network); 14 Dec 2012 00:41:12 -0000 Received: from unknown (24.148.114.161) by p3plsmtpa01-08.prod.phx3.secureserver.net (72.167.82.88) with ESMTP; 14 Dec 2012 00:41:12 -0000 From: al davis To: gnucap-devel@gnu.org Date: Thu, 13 Dec 2012 19:41:10 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) References: <20121212181353.GA30755@d-labs.de> <201212130643.15834.ad211@freeelectron.net> <20121213123138.GC30755@d-labs.de> In-Reply-To: <20121213123138.GC30755@d-labs.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212131941.10933.ad211@freeelectron.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 72.167.82.88 Subject: Re: [Gnucap-devel] another assertion 'bug' X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2012 00:41:25 -0000 On Thursday 13 December 2012, Felix Salfelder wrote: > On Thu, Dec 13, 2012 at 06:43:15AM -0500, al davis wrote: > > It is correct, in parsing, to set_dev_type to the 'device' > > attribute, but incorrect to make them all subcircuits. > > i've worked this out some more. i think the following is > desirable: - if there is a device attribute and > (some_dispatcher[device] || find_looking_out(device)), use > that device > - else, instanciate a fake sckt that collects the parameters. > this wont simulate, but set_dev_type makes the list command > happy. > > unfortunately savant's find_type_in_string has no access to > the body of the device. for example find_type_in_string on > > C 1 2 3 4 some-symbol.sym > { > device=some-other > } > > will not know about some-other. That's a problem. The best way to deal with this is to read that whole block into memory so it can be scanned. Actually, this is the only way I would consider. With anything else you will be fighting it all the way through. I have considered a mod to the CS class to be able to redefine what a "line" is. There are many places where that would help. > so (my approach, not changing the parser much) looks a bit > more involved: > > - instanciate a fake-sckt > - if the symbol has a device attribute the device_dispatcher > knows (and it matches the pincount whatsoever) use that > device as type - otherwise instanciate that fake-sckt and > set-dev-type > > the first case is simple, but doesnt allow the user override > the device attribute (*). in the second case, a device is > instanciated and potentially set_type to some-other. this > way the user may override the device attribute if a subckt > matching the pins is present. That won't work .. wrong type for simulation. .. wrong data structures, wrong virtuals ... A variant would be to make a subckt/module with one device inside. That adds a lot of overhead. Another variant would be to do that, then deflate it later, like what is done in bm_ expressions. It is simpler to just read the whole object first, so you can scan for the type. It's no accident that Verilog put the type first. Compare the parsing of verilog format vs spectre format, which puts the type in the middle. From MAILER-DAEMON Fri Dec 14 05:29:38 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TjSWQ-0005Io-73 for mharc-gnucap-devel@gnu.org; Fri, 14 Dec 2012 05:29:38 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjSWN-0005Ic-Qa for gnucap-devel@gnu.org; Fri, 14 Dec 2012 05:29:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjSWM-0007Xd-SM for gnucap-devel@gnu.org; Fri, 14 Dec 2012 05:29:35 -0500 Received: from ist.d-labs.de ([213.239.218.44]:45341 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjSWM-0007WS-Lh for gnucap-devel@gnu.org; Fri, 14 Dec 2012 05:29:34 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id E673C7F804; Fri, 14 Dec 2012 11:29:31 +0100 (CET) Date: Fri, 14 Dec 2012 11:29:31 +0100 From: Felix Salfelder To: al davis Message-ID: <20121214102931.GE30755@d-labs.de> References: <20121212181353.GA30755@d-labs.de> <201212130643.15834.ad211@freeelectron.net> <20121213123138.GC30755@d-labs.de> <201212131941.10933.ad211@freeelectron.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201212131941.10933.ad211@freeelectron.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Cc: gnucap-devel@gnu.org Subject: Re: [Gnucap-devel] another assertion 'bug' X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2012 10:29:36 -0000 hi Al. On Thu, Dec 13, 2012 at 07:41:10PM -0500, al davis wrote: > I have considered a mod to the CS class to be able to redefine > what a "line" is. There are many places where that would help. > > [..] > > It is simpler to just read the whole object first, so you can > scan for the type. sure, agreed. i dont need device attribute overrides, before the other things work. please notify me about the CS mod when you get there :) regards felix From MAILER-DAEMON Sat Dec 15 04:50:56 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TjoOW-0006ox-Ml for mharc-gnucap-devel@gnu.org; Sat, 15 Dec 2012 04:50:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjoOR-0006oq-0q for gnucap-devel@gnu.org; Sat, 15 Dec 2012 04:50:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjoOM-0002OB-7G for gnucap-devel@gnu.org; Sat, 15 Dec 2012 04:50:50 -0500 Received: from ist.d-labs.de ([213.239.218.44]:49749 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjoOM-0002MG-1D for gnucap-devel@gnu.org; Sat, 15 Dec 2012 04:50:46 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id C2EDA7F804; Sat, 15 Dec 2012 10:50:43 +0100 (CET) Date: Sat, 15 Dec 2012 10:50:43 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121215095043.GF30755@d-labs.de> References: <20121212181353.GA30755@d-labs.de> <201212130643.15834.ad211@freeelectron.net> <20121213123138.GC30755@d-labs.de> <201212131941.10933.ad211@freeelectron.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201212131941.10933.ad211@freeelectron.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: [Gnucap-devel] lang_geda: node order/sckt declaration. X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2012 09:50:55 -0000 Hi Al. the following makes trouble: i'm trying to read in a .sch file as a subckt. think of an invocation > geda-sckt my_schematic.sch i have implemented a DEV_PORT that handles the external connections. in particular a plugin is responsible for how those ports are supposed to look like. i see no reason, why the user should know about the number or names of connections, expecially when (s)he is about to do > verilog > list > my_schematic.v afterwards. semantically, "geda-sckt" is a sort of "include", which is not supposed to know (from the user), how many ports potential subcircuits have. now consider: CARD_LIST::map_sckt_nodes does for (i=1; i <= model->net_nodes(); ++i) { [...] map[i] = [..] } (the lower part of) map is used later on to map the e_()'s of the node_t's of subdevices to the number of the node allocated already. my understanding is, that this requires the external nodes to be numbered up from 1. here the node number originates from how_many() in NODE_MAP::new_node, which is called when nodes inside of a subckt-declaration are parsed. in particular, external nodes need to be registered first (which is not possible here). in order to make the above "geda-sckt" command work one would either have to - change CARD_LIST::map_sckt_nodes. something like map[theactualnumber] = [...] is this the only code where the positional number must equal the user_number? - align the nodenumbers after parsing the .sch (which is a huge mess -- but could finally work out). is there anything else? regards felix From MAILER-DAEMON Sat Dec 15 10:07:34 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TjtKw-0003dR-RE for mharc-gnucap-devel@gnu.org; Sat, 15 Dec 2012 10:07:34 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjtKu-0003dL-9e for gnucap-devel@gnu.org; Sat, 15 Dec 2012 10:07:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjtKt-0000iF-Ea for gnucap-devel@gnu.org; Sat, 15 Dec 2012 10:07:32 -0500 Received: from ist.d-labs.de ([213.239.218.44]:51280 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjtKt-0000i3-7q for gnucap-devel@gnu.org; Sat, 15 Dec 2012 10:07:31 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id 95FC47F82D; Sat, 15 Dec 2012 16:07:28 +0100 (CET) Date: Sat, 15 Dec 2012 16:07:28 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121215150728.GG30755@d-labs.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: [Gnucap-devel] node_t::map X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2012 15:07:33 -0000 Hi Al. as it seems, the call _n[i].n_()->set_user_number(_n[j].e_()) from DEV::expand collapses the nodes i and j. afaics (as of now) in node_t::map, e_() equals t_(). node_t::map sets _m = to_internal(t_()); to make collapses work, e_() should be used here. (if this is wrong, please tell me how i'm supposed to collapse nodes) regards felix From MAILER-DAEMON Sat Dec 15 19:33:58 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Tk2B4-00053u-6J for mharc-gnucap-devel@gnu.org; Sat, 15 Dec 2012 19:33:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tk2B2-00053Y-6V for gnucap-devel@gnu.org; Sat, 15 Dec 2012 19:33:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tk2B1-0001Ae-98 for gnucap-devel@gnu.org; Sat, 15 Dec 2012 19:33:56 -0500 Received: from m1plsmtpa01-05.prod.mesa1.secureserver.net ([64.202.165.10]:53851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tk2B1-00019N-0i for gnucap-devel@gnu.org; Sat, 15 Dec 2012 19:33:55 -0500 Received: from floyd.localnet ([24.148.114.161]) by m1plsmtpa01-05.prod.mesa1.secureserver.net with id c0Zl1k0063V00DC010ZlD8; Sat, 15 Dec 2012 17:33:45 -0700 From: al davis To: gnucap-devel@gnu.org Date: Sat, 15 Dec 2012 19:33:44 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) References: <20121215150728.GG30755@d-labs.de> In-Reply-To: <20121215150728.GG30755@d-labs.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201212151933.44242.ad211@freeelectron.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 64.202.165.10 Subject: Re: [Gnucap-devel] node_t::map X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 00:33:57 -0000 On Saturday 15 December 2012, Felix Salfelder wrote: > as it seems, the call > _n[i].n_()->set_user_number(_n[j].e_()) > from DEV::expand collapses the nodes i and j. No. It is set in alloc_hold_vectors. Don't tamper with it. > afaics (as of now) in node_t::map, e_() equals t_(). > node_t::map sets _m = to_internal(t_()); > to make collapses work, e_() should be used here. > (if this is wrong, please tell me how i'm supposed to > collapse nodes) I think what you want is: //============ _n[i] = _n[j]; //============ This is old code, originally written in "C", still really in "C". Think of node_t as a pointer, or like "NODE*". node_t should really be a NODE::iterator. A "NODE" is the actual node. It stores info, and exists once for each, all in the _nstat array. Think of that "user_number" as an un-pointer, kind of like the "&" takes the address. Making the whole _nstat array all LOGIC_NODE is really wasteful. and a throwback to the old C code. It is wasteful in the sense that analog only nodes carry digital baggage and digital only nodes carry analog baggage, just in case it is discovered later that you really need a mixed node. A side benefit of this is that you can put analog probes on a digital node or digital probes on an analog node, and get an answer. From MAILER-DAEMON Sun Dec 16 06:09:43 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TkC6J-0007bu-Hk for mharc-gnucap-devel@gnu.org; Sun, 16 Dec 2012 06:09:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkC6G-0007bc-Hl for gnucap-devel@gnu.org; Sun, 16 Dec 2012 06:09:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkC6F-0005FE-CC for gnucap-devel@gnu.org; Sun, 16 Dec 2012 06:09:40 -0500 Received: from ist.d-labs.de ([213.239.218.44]:55552 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkC6F-0005F2-6q for gnucap-devel@gnu.org; Sun, 16 Dec 2012 06:09:39 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id 7A1FD7F81D; Sun, 16 Dec 2012 12:09:37 +0100 (CET) Date: Sun, 16 Dec 2012 12:09:37 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121216110937.GH30755@d-labs.de> References: <20121215150728.GG30755@d-labs.de> <201212151933.44242.ad211@freeelectron.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201212151933.44242.ad211@freeelectron.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: Re: [Gnucap-devel] node_t::map X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 11:09:41 -0000 Hi Al. On Sat, Dec 15, 2012 at 07:33:44PM -0500, al davis wrote: > On Saturday 15 December 2012, Felix Salfelder wrote: > > as it seems, the call > > _n[i].n_()->set_user_number(_n[j].e_()) > > from DEV::expand collapses the nodes i and j. > > No. > > [..] > > I think what you want is: > //============ > _n[i] = _n[j]; > //============ hmmm. not really. if i do this in, say, NET::expand, it will just connect that net to the same node twice (does it?) > This is old code, originally written in "C", still really in > "C". > > Think of node_t as a pointer, or like "NODE*". node_t should > really be a NODE::iterator. in a way, i did. a node_t is a "pointer" to the NODE (*n_()), which i tried to collapse. (don't worry, it doesn't yet work the way i hoped ;) > A "NODE" is the actual node. It stores info, and exists once > for each, all in the _nstat array. > > Think of that "user_number" as an un-pointer, kind of like the > "&" takes the address. as it seems that is consistant with "user_number is the pointer to the node/NODE/.. that actually should be used in the end". > Making the whole _nstat array all LOGIC_NODE is really wasteful. > and a throwback to the old C code. It is wasteful in the sense > that analog only nodes carry digital baggage and digital only > nodes carry analog baggage, just in case it is discovered later > that you really need a mixed node. A side benefit of this is > that you can put analog probes on a digital node or digital > probes on an analog node, and get an answer. a bit off topic: hmm, currently node_t holds int _m to point to the node voltage, probably another int should point to the logic value? i don't see node_t replaced by NODE::iterators. woudnt that move NODE* magic like polymorphism and pointer calculation to simulation time? (havent tried, just a thought) regards felix From MAILER-DAEMON Mon Dec 17 20:15:39 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TklmV-0004e3-CZ for mharc-gnucap-devel@gnu.org; Mon, 17 Dec 2012 20:15:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TklmP-0004dk-QL for gnucap-devel@gnu.org; Mon, 17 Dec 2012 20:15:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TklmL-00039f-Ms for gnucap-devel@gnu.org; Mon, 17 Dec 2012 20:15:33 -0500 Received: from ist.d-labs.de ([213.239.218.44]:37072 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TklmL-00039S-GU for gnucap-devel@gnu.org; Mon, 17 Dec 2012 20:15:29 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id 004CA7F806; Tue, 18 Dec 2012 02:15:25 +0100 (CET) Date: Tue, 18 Dec 2012 02:15:25 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121218011525.GA27373@d-labs.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: [Gnucap-devel] gnucap-geda status X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2012 01:15:38 -0000 Hi there. ive worked on the lang-geda plugin [1] a bit: - make net device simulatable (by collapsing nodes) - derived devices for ports and rails - a command that converts a schematic file into a module declaration - parser simplifications, easy (but incomplete) .sym access - a (yet small) library of devices for symbols - a build system - trivial unit tests (simulating small netlists) - a tiny script that helps converting netlists. - list TODOs and BUGS... i did not manage to make simulation work with gnucap 0.36. mostly because - gnucap .36 expects port declarations before the module body is parsed - collapsing nodes needs changes to the backend (imo). (the non-simulation part should work nevertheless) i have experimentally changed some parts of the gnucap code in the geda branch in [2] to support - equivalence classes of NODEs (needed for collapse) - out of order port declarations (needed while parsing port devices) - probes for nodes in subcircuits (a side effect/relic) i guess in the long run the gnucap NODE code needs to be rearranged. none of the proposed code is perfect, just displaying some of the issues. feel free to improve/comment. have fun felix PS: Savant, would you mind replacing the repo on github by [1]? [1] git://tool.em.cs.uni-frankfurt.de/git/gnucap-geda [2] git://tool.em.cs.uni-frankfurt.de/git/gnucap From MAILER-DAEMON Mon Dec 24 14:32:40 2012 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TnDlQ-000546-2v for mharc-gnucap-devel@gnu.org; Mon, 24 Dec 2012 14:32:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnDlN-00052R-GX for gnucap-devel@gnu.org; Mon, 24 Dec 2012 14:32:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnDlM-0005L2-KM for gnucap-devel@gnu.org; Mon, 24 Dec 2012 14:32:37 -0500 Received: from ist.d-labs.de ([213.239.218.44]:55098 helo=mx01.d-labs.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnDlM-0005Ks-Dz for gnucap-devel@gnu.org; Mon, 24 Dec 2012 14:32:36 -0500 Received: by mx01.d-labs.de (Postfix, from userid 1006) id 2A81A7F8CC; Mon, 24 Dec 2012 20:32:34 +0100 (CET) Date: Mon, 24 Dec 2012 20:32:34 +0100 From: Felix Salfelder To: gnucap-devel@gnu.org Message-ID: <20121224193233.GF17668@d-labs.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.239.218.44 Subject: [Gnucap-devel] bug X-BeenThere: gnucap-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2012 19:32:38 -0000 Hi Al. in MODEL_SEMI_RESISTOR::MODEL_SEMI_RESISTOR(const MODEL_SEMI_RESISTOR& p) :MODEL_SEMI_BASE( ), _rsh(p._rsh) ^the p is missing this breaks things like .model resmod RES .subckt s .. R1 1 2 resmod .ends X1 .. s, because the model is copied to the scope of X1 via clone (or something like that). regards felix