/*
 * control.cpp - Unidad de control
 * 'Ultima modificaci'on: 03-03-2002
 *
 * Antonio G'omez Muriana (correo@senco.net)
 * Miguel Montero G'amez
*/


#include "sdlc++/defs.h"
#include "sdlc++/gates.h"
#include "sdlc++/latches.h"
#include "sdlc++/flip-flops.h"
#include "control.h"


CONTROL::CONTROL() {
	q1a = q2a = VCC;
	q1b = q2b = GND;
}


void CONTROL::run(WIRE &ck, WIRE &E, WIRE &m, WIRE &z) {
	p1.run(d1, ck, q1a, q1b);
	p2.run(d2, ck, q2a, q2b);
	no.run(nz, z);
	a1.run(w1, q1b, q2a);
	a2.run(w2, 3, q1a, q2b, nz);
	o.run(d1, w1, w2);
	a3.run(d2, q1b, q2b);
	E = q1a;
	m = q1b;
}