fix grammar errors, printing errors, and bug with default simulation time
This commit is contained in:
parent
8a4a0b8423
commit
372466027a
@ -14,30 +14,34 @@ int main() {
|
|||||||
string fileName;
|
string fileName;
|
||||||
Simulation e;
|
Simulation e;
|
||||||
int len = 60;
|
int len = 60;
|
||||||
|
bool canOpen;
|
||||||
|
|
||||||
cout << "Please enter filename: ";
|
cout << "Please enter filename: ";
|
||||||
getline(cin, fileName);
|
getline(cin, fileName);
|
||||||
cout << "How long do you want to simulate to (default 60)? ";
|
cout << "What time do you want to simulate to (default 60ns)? ";
|
||||||
if (cin.peek() == '\n') {
|
if (cin.peek() == '\n') {
|
||||||
len = 60;
|
len = 60;
|
||||||
}
|
}
|
||||||
else if (!(cin >> len)) {
|
else if (!(cin >> len)) {
|
||||||
cout << "Invalid input using 60.\n";
|
cout << "Invalid input; using 60.\n";
|
||||||
|
len = 60;
|
||||||
}
|
}
|
||||||
e.parseCircuit(fileName);
|
canOpen = e.parseCircuit(fileName);
|
||||||
|
|
||||||
// 2. Parse the vector file to initialize the simulation Queue with initial
|
// 2. Parse the vector file to initialize the simulation Queue with initial
|
||||||
// Wire state (i.e., value) changes
|
// Wire state (i.e., value) changes
|
||||||
e.parseVector(fileName);
|
canOpen = e.parseVector(fileName);
|
||||||
|
|
||||||
// 3. Simulate the circuit using Event-driven control
|
// 3. Simulate the circuit using Event-driven control
|
||||||
// first, remove the top Event e in the Queue
|
// first, remove the top Event e in the Queue
|
||||||
// second, determine if e causes a future Wire state change
|
// second, determine if e causes a future Wire state change
|
||||||
// third, create and queue any future Wire state changes as new Events
|
// third, create and queue any future Wire state changes as new Events
|
||||||
// fourth, apply e's effects
|
// fourth, apply e's effects
|
||||||
e.simulate(len);
|
if(canOpen) {
|
||||||
|
e.simulate(len);
|
||||||
|
|
||||||
// 4. Print the results of the simulation
|
// 4. Print the results of the simulation
|
||||||
e.print(len);
|
e.print(len);
|
||||||
system("pause");
|
system("pause");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user