mirror of
https://github.com/cmosher01/v6502cpp.git
synced 2024-06-03 10:29:35 +00:00
add trace of transistors
This commit is contained in:
parent
735259becc
commit
a4e04c3331
|
@ -9,6 +9,7 @@
|
||||||
#define CPU6502_H
|
#define CPU6502_H
|
||||||
|
|
||||||
#include "SegmentTypes.h"
|
#include "SegmentTypes.h"
|
||||||
|
#include "Trace.h"
|
||||||
|
|
||||||
class AddressBus;
|
class AddressBus;
|
||||||
class Trace;
|
class Trace;
|
||||||
|
@ -18,6 +19,9 @@ class Cpu6502 final {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Cpu6502(AddressBus& addressBus, Trace& trace, Common& common) : addressBus(addressBus), trace(trace), common(common) {
|
Cpu6502(AddressBus& addressBus, Trace& trace, Common& common) : addressBus(addressBus), trace(trace), common(common) {
|
||||||
|
#if 0
|
||||||
|
trace.dumpTransistors();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPins(const PinSettings& ps);
|
void setPins(const PinSettings& ps);
|
||||||
|
|
|
@ -22,7 +22,7 @@ class AddressBus;
|
||||||
class Emu6502 {
|
class Emu6502 {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Emu6502(std::istream& transistors, AddressBus& mem) : tn(transistors, segs, transes), c(tn), trace(segs, c), cpu(mem, trace, c), cpuhelper(cpu, c) {
|
Emu6502(std::istream& transistors, AddressBus& mem) : tn(transistors, segs, transes), c(tn), trace(segs, transes, c), cpu(mem, trace, c), cpuhelper(cpu, c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Emu6502() {
|
virtual ~Emu6502() {
|
||||||
|
|
|
@ -38,6 +38,10 @@ public:
|
||||||
return this->cache.end();
|
return this->cache.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map::size_type size() const {
|
||||||
|
return this->cache.size();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Map cache;
|
Map cache;
|
||||||
|
|
14
Trace.cpp
14
Trace.cpp
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
|
#include "TransCache.h"
|
||||||
#include "SegmentCache.h"
|
#include "SegmentCache.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
|
@ -87,3 +88,16 @@ void Trace::dumpRegisters() const {
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Trace::dumpTransistors() const {
|
||||||
|
/* count depletion-mode MOSFETs */
|
||||||
|
int cd(0);
|
||||||
|
for (auto sp : this->segs) {
|
||||||
|
Segment* seg = sp.second.get();
|
||||||
|
if (seg->dmos) {
|
||||||
|
++cd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "eMOSFETs: " << this->transes.size() << ", dMOSFETs: " << cd << std::endl;
|
||||||
|
}
|
||||||
|
|
5
Trace.h
5
Trace.h
|
@ -9,15 +9,17 @@
|
||||||
#define TRACE_H
|
#define TRACE_H
|
||||||
|
|
||||||
class SegmentCache;
|
class SegmentCache;
|
||||||
|
class TransCache;
|
||||||
class Common;
|
class Common;
|
||||||
|
|
||||||
class Trace final {
|
class Trace final {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Trace(const SegmentCache& segs, const Common& common) : segs(segs), common(common) {
|
Trace(const SegmentCache& segs, const TransCache& transes, const Common& common) : segs(segs), transes(transes), common(common) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpSegments() const;
|
void dumpSegments() const;
|
||||||
|
void dumpTransistors() const;
|
||||||
void dumpRegisters() const;
|
void dumpRegisters() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -26,6 +28,7 @@ private:
|
||||||
Trace& operator=(const Trace&) = delete;
|
Trace& operator=(const Trace&) = delete;
|
||||||
|
|
||||||
const SegmentCache& segs;
|
const SegmentCache& segs;
|
||||||
|
const TransCache& transes;
|
||||||
const Common& common;
|
const Common& common;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
16
TransCache.h
16
TransCache.h
|
@ -22,12 +22,26 @@ public:
|
||||||
|
|
||||||
void add(Segment* c1, Segment* gate, Segment* c2);
|
void add(Segment* c1, Segment* gate, Segment* c2);
|
||||||
|
|
||||||
|
typedef std::set<std::shared_ptr<Trans>> Set;
|
||||||
|
|
||||||
|
Set::const_iterator begin() const {
|
||||||
|
return this->cache.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
Set::const_iterator end() const {
|
||||||
|
return this->cache.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
Set::size_type size() const {
|
||||||
|
return this->cache.size();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TransCache(const TransCache&) = delete;
|
TransCache(const TransCache&) = delete;
|
||||||
TransCache& operator=(const TransCache&) = delete;
|
TransCache& operator=(const TransCache&) = delete;
|
||||||
|
|
||||||
std::set<std::shared_ptr<Trans>> cache;
|
Set cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TRANSCACHE_H */
|
#endif /* TRANSCACHE_H */
|
||||||
|
|
3
trans.h
3
trans.h
|
@ -25,6 +25,7 @@ private:
|
||||||
public:
|
public:
|
||||||
std::set<Trans*> gates;
|
std::set<Trans*> gates;
|
||||||
std::set<Trans*> c1c2s;
|
std::set<Trans*> c1c2s;
|
||||||
|
bool dmos;
|
||||||
bool vss;
|
bool vss;
|
||||||
bool vcc;
|
bool vcc;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Segment(const std::string& id) : id(id), vss(false), vcc(false), pull(id[0]=='+' ? Pull::UP : Pull::FLOAT), on(false) {
|
Segment(const std::string& id) : id(id), dmos(id[0]=='+'), vss(false), vcc(false), pull(dmos ? Pull::UP : Pull::FLOAT), on(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user