mirror of
https://github.com/trebonian/visual6502.git
synced 2025-01-02 06:29:41 +00:00
Z80: override chipsim getNodeValue() to better model charge sharing
This commit is contained in:
parent
5005774b1b
commit
f360557572
@ -24,6 +24,37 @@ presetLogLists=[
|
||||
['_int','_nmi', nodenamereset],
|
||||
];
|
||||
|
||||
// Override ChipSim getNodeValue() function to allow an estimate of capacitance
|
||||
// (number of connections) to be used when joining floating segments.
|
||||
|
||||
function getNodeValue(){
|
||||
// 1. deal with power connections first
|
||||
if(arrayContains(group, ngnd)) return false;
|
||||
if(arrayContains(group, npwr)) return true;
|
||||
// 2. deal with pullup/pulldowns next
|
||||
for(var i in group){
|
||||
var nn = group[i];
|
||||
var n = nodes[nn];
|
||||
if(n.pullup) return true;
|
||||
if(n.pulldown) return false;
|
||||
}
|
||||
// 3. resolve connected set of floating nodes
|
||||
// based on state of largest (by #connections) node
|
||||
// (previously this was any node with state true wins)
|
||||
var max_state = false;
|
||||
var max_connections = 0;
|
||||
for(var i in group){
|
||||
var nn = group[i];
|
||||
var n = nodes[nn];
|
||||
var connections = n.gates.length + n.c1c2s.length;
|
||||
if (connections > max_connections) {
|
||||
max_connections = connections;
|
||||
max_state = n.state;
|
||||
}
|
||||
}
|
||||
return max_state;
|
||||
}
|
||||
|
||||
function setupTransistors(){
|
||||
for(i in transdefs){
|
||||
var tdef = transdefs[i];
|
||||
|
Loading…
Reference in New Issue
Block a user