trace-4: fanout as subckt attached to each node. - gnucap.git - Gnu Circuit Analysis Package

index : gnucap.git
Gnu Circuit Analysis Package
summary refs log tree commit diff
diff options
context:
space:
mode:
authoral davis <ad211@freeelectron.net>2025年10月30日 00:00:00 +0000
committerFelix Salfelder <felix@salfelder.org>2025年10月30日 00:00:00 +0000
commita1564c9d52cd71b3b797e9b52d1401d8f3500b22 (patch)
treef6fe97dab9a1e1125603e827d489d71669972b01
parent1ffcbaee92e4ab3e032e63480feada0ad2a7c3f3 (diff)
downloadgnucap-a1564c9d52cd71b3b797e9b52d1401d8f3500b22.tar.gz
trace-4: fanout as subckt attached to each node.
(squashed)
Diffstat
-rw-r--r--include/e_card.h 1
-rw-r--r--include/e_cardlist.h 1
-rw-r--r--include/e_node.h 2
-rw-r--r--include/e_subckt.h 1
-rw-r--r--lib/d_subckt.cc 2
-rw-r--r--lib/e_card.cc 24
-rw-r--r--lib/e_cardlist.cc 9
-rw-r--r--lib/e_node.cc 22
-rw-r--r--lib/u_sim_data.cc 1
9 files changed, 56 insertions, 7 deletions
diff --git a/include/e_card.h b/include/e_card.h
index 99a675c9..81fd55ee 100644
--- a/include/e_card.h
+++ b/include/e_card.h
@@ -74,6 +74,7 @@ public: // "elaborate"
virtual void expand_first() {}
virtual void expand() {}
virtual void expand_last() {}
+ virtual void make_fanout();
virtual void precalc_last() {}
virtual void map_nodes() {}
virtual CARD* deflate() {itested(); return this;}
diff --git a/include/e_cardlist.h b/include/e_cardlist.h
index 75307a93..fac46893 100644
--- a/include/e_cardlist.h
+++ b/include/e_cardlist.h
@@ -120,6 +120,7 @@ public:
CARD_LIST& precalc_first();
CARD_LIST& expand();
CARD_LIST& precalc_last();
+ CARD_LIST& make_fanout();
CARD_LIST& map_nodes();
CARD_LIST& tr_iwant_matrix();
CARD_LIST& tr_begin();
diff --git a/include/e_node.h b/include/e_node.h
index f4f396ef..52b9cb91 100644
--- a/include/e_node.h
+++ b/include/e_node.h
@@ -48,7 +48,7 @@ public:
explicit NODE(const NODE* p); // u_nodemap.cc:49 (deep copy)
explicit NODE(const std::string& s, int idx=0)
: CARD(s) {(void)idx; assert(!idx);}
- ~NODE() {}
+ ~NODE();
CARD* clone()const override {untested(); return new NODE(*this);}
diff --git a/include/e_subckt.h b/include/e_subckt.h
index b450f488..38bd913f 100644
--- a/include/e_subckt.h
+++ b/include/e_subckt.h
@@ -49,6 +49,7 @@ protected: // override virtual
//void expand() //COMPONENT
void precalc_last()override;
//void map_nodes();
+ void make_fanout()override {assert(subckt()); subckt()->make_fanout();}
void tr_begin()override {assert(subckt()); subckt()->tr_begin();}
void tr_restore()override {assert(subckt()); subckt()->tr_restore();}
void dc_advance()override {assert(subckt()); subckt()->dc_advance();}
diff --git a/lib/d_subckt.cc b/lib/d_subckt.cc
index 1bb41daf..c658106f 100644
--- a/lib/d_subckt.cc
+++ b/lib/d_subckt.cc
@@ -150,6 +150,7 @@ private: // no-ops for prototype
void precalc_first()override {}
void expand()override {}
void precalc_last()override {}
+ void make_fanout()override {}
void map_nodes()override {}
void tr_begin()override {}
void tr_load()override {}
@@ -199,6 +200,7 @@ private: // no-ops for prototype
void precalc_first()override {}
void expand()override {}
void precalc_last()override {}
+ void make_fanout()override {}
void map_nodes()override {}
void tr_begin()override {}
void tr_load()override {}
diff --git a/lib/e_card.cc b/lib/e_card.cc
index 3f5ea4cf..9178a7d3 100644
--- a/lib/e_card.cc
+++ b/lib/e_card.cc
@@ -22,6 +22,7 @@
* Base class for "cards" in the circuit description file
*/
//testing=script 2014年07月04日
+#include "e_logicnode.h"
#include "e_card.h"
#include "u_xprobe.h"
#include "u_prblst.h"
@@ -87,6 +88,29 @@ const std::string CARD::long_label()const
return buffer;
}
/*--------------------------------------------------------------------------*/
+//#include "trace_on.h"
+void CARD:: make_fanout()
+{
+ if (is_device()) {
+ for (int ii = 0; ii < net_nodes(); ++ii) {
+ if (!n_(ii).is_grounded()) {
+ if (!n_(ii)->subckt()) {
+ n_(ii)->new_subckt();
+ assert(n_(ii)->subckt());
+ }else{
+ }
+ assert(n_(ii)->subckt());
+ n_(ii)->subckt()->push_back(this);
+ trace3(long_label(),ii, n_(ii).m_(), n_(ii)->subckt()->size());
+ }else{
+ trace2(long_label(),ii, n_(ii).m_());
+ }
+ }
+ }else{
+ }
+}
+//#include "trace_off.h"
+/*--------------------------------------------------------------------------*/
/* connects_to: does this part connect to this node?
* input: a node
* returns: how many times this part connects to it.
diff --git a/lib/e_cardlist.cc b/lib/e_cardlist.cc
index 5a7ef30e..5275b4d9 100644
--- a/lib/e_cardlist.cc
+++ b/lib/e_cardlist.cc
@@ -222,6 +222,15 @@ CARD_LIST& CARD_LIST::expand()
return *this;
}
/*--------------------------------------------------------------------------*/
+CARD_LIST& CARD_LIST::make_fanout()
+{
+ for (iterator ci=begin(); ci!=end(); ++ci) {
+ trace_func_comp();
+ (**ci).make_fanout();
+ }
+ return *this;
+}
+/*--------------------------------------------------------------------------*/
CARD_LIST& CARD_LIST::precalc_first()
{
for (iterator ci=begin(); ci!=end(); ++ci) {
diff --git a/lib/e_node.cc b/lib/e_node.cc
index 5784489c..d3fcbfc7 100644
--- a/lib/e_node.cc
+++ b/lib/e_node.cc
@@ -52,6 +52,16 @@ node_t::node_t(node_t& p)
}
}
/*--------------------------------------------------------------------------*/
+NODE::~NODE()
+{
+ if(subckt()){
+ for(auto&i : *subckt()){
+ i = nullptr;
+ }
+ }else{
+ }
+}
+/*--------------------------------------------------------------------------*/
node_t::node_t(const node_t& p)
:_nnn(p._nnn),
_link(p._link),
@@ -162,15 +172,15 @@ LOGIC_NODE& node_t::data()const
{
if(auto d = dynamic_cast<LOGIC_NODE*>(_nnn)){
return *d;
- }else if(auto e = dynamic_cast<LOGIC_NODE*>(root()._nnn)){ untested();
+ }else if(auto e = dynamic_cast<LOGIC_NODE*>(root()._nnn)){
return *e;
}else if(_index==0 || _nnn == &ground_node){
// BUG. ground is not a logic node, but asking for one.
// d_cccs.2.ckt
static LOGIC_NODE logic_ground(0);
return logic_ground;
- }else{ untested();
- unreachable();
+ }else{// untested();
+ //unreachable();
static LOGIC_NODE logic_ground(0);
return logic_ground;
}
@@ -390,11 +400,11 @@ void node_t::set_to_ground(CARD* Owner)
/*--------------------------------------------------------------------------*/
bool node_t::is_grounded() const
{
- if(_m==0){itested();
- assert(_nnn == &ground_node);
+ if(_m==0){
+ //assert(_nnn == &ground_node);
return true;
}else{
- assert(_nnn != &ground_node);
+ //assert(_nnn != &ground_node);
}
if(&root()==this){
diff --git a/lib/u_sim_data.cc b/lib/u_sim_data.cc
index 615d26bf..3ca48e92 100644
--- a/lib/u_sim_data.cc
+++ b/lib/u_sim_data.cc
@@ -304,6 +304,7 @@ void SIM_DATA::init(CARD_LIST* scope)
map_toplevel_nodes(scope);
scope->expand();
alloc_hold_vectors(scope);
+ scope->make_fanout();
map__nodes(scope);
scope->map_nodes();
_aa.reinit(_total_nodes);
generated by cgit v1.2.3 (git 2.39.1) at 2025年11月25日 03:31:07 +0000

AltStyle によって変換されたページ (->オリジナル) /