The Final Code!
Now let's see what all of our hard work has produced:
design LED_Dice is
include "devices.phdl";
net +5V;
net GND;
net RR_junct; // Resistor-Resistor Junction
net[0:1] RC_junct; // Resistor-Capacitor Junction
net SD_junct; // Switch-Diode Junction
net DR_junct; // Diode-Resistor Junction
net 555_junct; // 555 Timer Junction
net CR_junct; // Collector-Resistor Junction
net BR_junct; // Base-Resistor Junction
net AR_junct; // AND-Resistor Junction
net[1:4] AND_in; // AND-inputs
net[1:7] RD; // Resistor-Diode Junctions
begin
inst mySW of PBSwitch is
on_a = +5V;
on_b = SD_junct;
off_a = open;
off_b = open;
end inst mySW;
inst myDiode of Diode is
a = SD_junct;
k = DR_junct;
refPrefix = "L";
end inst myDiode;
inst myBJT of BJT is
e = GND;
b = BR_junct;
c = CR_junct;
newattr refDes = "QA3";
end inst myBJT;
inst AGates of quad_AND_gate is
vcc = +5V;
gnd = GND;
in1[1:2] = AND_in[2:3];
in2[1:2] = AND_in[1,4];
out[1:2] = AR_junct & AND_in[1];
in1[3:4] = open;
in2[3:4] = open;
out[3:4] = open;
end inst AGates;
inst timer of 555_timer is
gnd = GND;
trigger = RC_junct[0];
out = 555_junct;
reset = DR_junct;
vcc = +5V;
discharge = RR_junct;
threshold = RC_junct;
control = open;
end inst timer;
inst cntr of Counter is
B = GND;
Qb = AND_in[2];
Qa = AND_in[4];
Down = +5V;
Up = 555_junct;
Qc = AND_in[3];
Qd = +5V;
gnd = GND;
D = GND;
C = GND;
_Load = CR_junct;
_Co = open;
_Bo = open;
clr = GND;
A = open;
vcc = +5V;
end inst cntr;
inst(1:2) caps of Capacitor is
combine.a = RC_junct;
each.b = GND;
end inst caps;
inst(1:2) 555_left_res of Resistor is
a = RR_junct;
combine.b = RC_junct[0] & +5V;
end inst 555_left_res;
inst(1:2) 555_right_res of Resistor is
a = RC_junct[1];
combine.b = DR_junct & GND;
end inst 555_right_res;
inst pullup_res of Resistor is
a = +5V;
b = CR_junct;
end inst pullup_res;
inst base_res of Resistor is
a = BR_junct;
b = AR_junct;
end inst base_res;
inst(1:7) LED_res of Resistor is
combine.a = RD;
each(1,2,6,7).b = AND_in[3];
each(4).b = AND_in[4];
each(3,5).b = AND_in[2];
end inst LED_res;
inst(1:7) dice_leds of LED is
k = GND;
combine.a = RD;
end inst dice_leds;
end design LED_Dice;
|