I have two questions about Assignment 4:
(1)The posted solution (drawaing and ecc.cir) shows that ParityError1 =
C1+C2+C3 but I think the correct answer should be ParityError1 = C1+C2+C4.
(2)My own program and the posted circuit.jar give identical solutions
when running againt the posted specification file ecc.cir, but the
result is wrong. With input c1=1, c2=1, c3=1, c4=0, the result is E1=1
E2=1 E3_D1=1 E4=1 E5_D2=1 E6_D3=1 E7_D4=1, this can't be right. Can you
post the script of a sample run of yours? That will really help me debug
my program.
Thanks for pointing out the error. As you point out, E1 = C1 xor C2 xor C4 (not C3). This error is in both the diagram and in ecc.cir (which is why the previously posted ecc.cir gives the wrong solution as you point out). I have posted the new ecc.cir and revised diagram.
I'm wondering if I could assume that there is no Gates between Batteries and Switches. (connect0 and connect1 of a SPDTSwitch are directly connected to a Battery.)
If you add a for loop that cycles through all SPDTSwitches right before the for loop that cycles through all Gates in computeLoop (look at the posted solution for Assignment 2), then you do not need to make that assumption. The SPDTSwitch simply sets the value of the Wire in common to be the value of the Wire in connect0 or connect1 (depending on the position of the switch).
I'm also wondering if "SPDTSwitch (1 or 2)" should be "SPDTSwitch (0 or 1)" in the specification: Modify your program with an outer loop that asks the user for the connect value of each SPDTSwitch (1 or 2), then runs the simulation and prints out all Wires as before and finally asks the user whether to repeat (see example transcript below).
Yes, thanks for pointing out the typo. I have corrected it on the assignment 4 page (I also corrected the assignment number on the page and deleted the paragraph on Visio).