Merge branch 'master' of https://gitlab.com/AluminumTank/radec
This commit is contained in:
commit
5229141506
@ -3,11 +3,16 @@
|
||||
using namespace std;
|
||||
|
||||
andGate::andGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2,
|
||||
wire* wire3) : e(eQueue), delay(d), in1(wire1), in2(wire2), out(wire3) {}
|
||||
|
||||
wire* wire3) {
|
||||
e = eQueue;
|
||||
delay = d;
|
||||
in1 = wire1;
|
||||
in2 = wire2;
|
||||
out = wire3;
|
||||
}
|
||||
int andGate::evaluate(int evTime) {
|
||||
int val1 = in1->getValue();
|
||||
int val2 = in2->getValue();
|
||||
int val1 = in1->getValue(evTime);
|
||||
int val2 = in2->getValue(evTime);
|
||||
if(val1 != -1 && val2 != -1) {
|
||||
return val1 && val2;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
#ifndef AND
|
||||
#define AND
|
||||
#include "gate.h"
|
||||
#include "event.h"
|
||||
#include "wire.h"
|
||||
|
||||
class andGate : public gate {
|
||||
public:
|
||||
|
@ -1,7 +1,11 @@
|
||||
#include "event.h"
|
||||
|
||||
event::event(int num, int value, int setTime, int wire, wire *output) : evNum(num), evValue(value),
|
||||
evTime(setTime), out(output) {}
|
||||
event::event(int num, int value, int setTime, wire * output){
|
||||
evNum = num;
|
||||
evValue = value;
|
||||
evTime = setTime;
|
||||
out = output;
|
||||
}
|
||||
|
||||
bool event::operator<(const event &e1) {
|
||||
if(evTime == e1.evTime) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef EVENT
|
||||
#define EVENT
|
||||
|
||||
using namespace std;
|
||||
#include "wire.h"
|
||||
|
||||
|
||||
class event {
|
||||
public:
|
||||
event(int num, int value, int setTime, wire * output);
|
||||
|
@ -1,5 +1,8 @@
|
||||
#ifndef NOR
|
||||
#define NOR
|
||||
#include "gate.h"
|
||||
#include "event.h"
|
||||
#include "wire.h"
|
||||
|
||||
class norGate : public gate {
|
||||
norGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2,
|
||||
|
@ -2,8 +2,13 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
notGate::notGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2)
|
||||
: e(eQueue), delay(gateDelay), in1(wire1), out(wire2) {}
|
||||
notGate::notGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2) {
|
||||
e = eQueue;
|
||||
delay = d;
|
||||
in1 = wire1;
|
||||
out = wire2;
|
||||
|
||||
}
|
||||
|
||||
void notGate::evaluate(int evTime) {
|
||||
int val = in1->getValue();
|
||||
|
@ -1,7 +1,10 @@
|
||||
#ifndef OR
|
||||
#define OR
|
||||
#include "gate.h"
|
||||
#include "event.h"
|
||||
#include "wire.h"
|
||||
|
||||
class xnorGate : public gate {
|
||||
class orGate : public gate {
|
||||
orGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2,
|
||||
wire* wire3);
|
||||
void evaluate(int evTime);
|
||||
|
@ -1,5 +1,8 @@
|
||||
#ifndef XNOR
|
||||
#define XNOR
|
||||
#include "gate.h"
|
||||
#include "event.h"
|
||||
#include "wire.h"
|
||||
|
||||
class xnorGate : public gate {
|
||||
xnorGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2,
|
||||
|
@ -3,8 +3,13 @@
|
||||
using namespace std;
|
||||
|
||||
xorGate::xorGate(priority_queue<event> *eQueue, int d, wire* wire1,
|
||||
wire* wire2, wire* wire3) : e(eQueue), delay(d), in1(wire1), in2(wire2),
|
||||
out(wire3);
|
||||
wire* wire2, wire* wire3) {
|
||||
e = eQueue;
|
||||
delay = d;
|
||||
in1 = wire1;
|
||||
in2 = wire2;
|
||||
out = wire3;
|
||||
}
|
||||
|
||||
void xorGate::evaluate(int evTime) {
|
||||
//TODO
|
||||
|
@ -1,5 +1,8 @@
|
||||
#ifndef XOR
|
||||
#define XOR
|
||||
#include "gate.h"
|
||||
#include "event.h"
|
||||
#include "wire.h"
|
||||
|
||||
class xorGate : public gate {
|
||||
xorGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2,
|
||||
|
Loading…
Reference in New Issue
Block a user