finish the program and fix when a wire goes undefined
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
CIRCUIT DrivesTwo
 | 
					CIRCUIT DrivesTwo
 | 
				
			||||||
INPUT   A    1DrivesTwo
 | 
					INPUT   A    1
 | 
				
			||||||
OUTPUT  B    3
 | 
					OUTPUT  B    3
 | 
				
			||||||
OUTPUT  C    4
 | 
					OUTPUT  C    4
 | 
				
			||||||
NOT     2ns  1   3
 | 
					NOT     2ns  1   3
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								Radec/Radec/ff.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Radec/Radec/ff.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					CIRCUIT flipflop1
 | 
				
			||||||
 | 
					INPUT   R    1
 | 
				
			||||||
 | 
					INPUT   S    2
 | 
				
			||||||
 | 
					OUTPUT  O    3
 | 
				
			||||||
 | 
					NOR     2ns  2   3   4
 | 
				
			||||||
 | 
					NOR     2ns  1   4   3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								Radec/Radec/ff_v.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Radec/Radec/ff_v.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					VECTOR flipflop1
 | 
				
			||||||
 | 
					INPUT R  0  1
 | 
				
			||||||
 | 
					INPUT S  0  1
 | 
				
			||||||
 | 
					INPUT R  1  0
 | 
				
			||||||
 | 
					INPUT S  1  0
 | 
				
			||||||
 | 
					INPUT S  2  1
 | 
				
			||||||
 | 
					INPUT S  3  0
 | 
				
			||||||
 | 
					INPUT S  5  1
 | 
				
			||||||
 | 
					INPUT S  6  0
 | 
				
			||||||
 | 
					INPUT R  9  1
 | 
				
			||||||
 | 
					INPUT R 10  0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
CIRCUIT DrivesTwo
 | 
					CIRCUIT DrivesTwo
 | 
				
			||||||
INPUT   A    1DrivesTwo
 | 
					INPUT   A    1
 | 
				
			||||||
OUTPUT  B    3
 | 
					OUTPUT  B    3
 | 
				
			||||||
OUTPUT  C    4
 | 
					OUTPUT  C    4
 | 
				
			||||||
NOT     2ns  1   3
 | 
					NOT     2ns  1   3
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,6 @@ NandGate::NandGate(int d, Wire * wire1, Wire * wire2, Wire * wire3)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Event NandGate::evaluate(int evTime)
 | 
					Event NandGate::evaluate(int evTime)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	cout << evTime << " " << in1->getValue(evTime) << " " << in2->getValue(evTime) << endl;
 | 
					 | 
				
			||||||
	if (in1->getValue(evTime) == 0 || in2->getValue(evTime) == 0) {
 | 
						if (in1->getValue(evTime) == 0 || in2->getValue(evTime) == 0) {
 | 
				
			||||||
		return Event(1, evTime + delay, out);
 | 
							return Event(1, evTime + delay, out);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,8 +110,8 @@ bool Simulation::parseVector(string fileName) {
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	string tmpString;
 | 
						string tmpString, valInt;
 | 
				
			||||||
	int timeInt, valInt;
 | 
						int timeInt;
 | 
				
			||||||
	Wire *tmpWire = nullptr;
 | 
						Wire *tmpWire = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// get rid of first line
 | 
						// get rid of first line
 | 
				
			||||||
@@ -129,7 +129,12 @@ bool Simulation::parseVector(string fileName) {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		e.push(Event(valInt, timeInt, tmpWire));
 | 
							if (valInt == "X") {
 | 
				
			||||||
 | 
								e.push(Event(-1, timeInt, tmpWire));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else {
 | 
				
			||||||
 | 
								e.push(Event(atoi(valInt.c_str()), timeInt, tmpWire));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user