mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Updating initial state and checks
This commit is contained in:
		
							parent
							
								
									190e44f0da
								
							
						
					
					
						commit
						cbadfa0268
					
				
					 1 changed files with 28 additions and 15 deletions
				
			
		| 
						 | 
					@ -1016,22 +1016,35 @@ struct SimWorker : SimShared
 | 
				
			||||||
			log_error("Stop time is before start time\n");
 | 
								log_error("Stop time is before start time\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		auto edges = fst->getAllEdges(fst_clock, startCount, stopCount);
 | 
							auto edges = fst->getAllEdges(fst_clock, startCount, stopCount);
 | 
				
			||||||
		fst->reconstructAllAtTimes(edges);
 | 
							
 | 
				
			||||||
		bool initial = false;
 | 
							if ((startCount == stopCount) && writeback) {
 | 
				
			||||||
		for(auto &time : edges) {
 | 
								log("Update initial state with values from %zu\n",startCount);
 | 
				
			||||||
			for(auto &item : inputs) {
 | 
								if (edges.empty())
 | 
				
			||||||
				std::string v = fst->valueAt(item.second, time);
 | 
									edges.push_back(startCount);
 | 
				
			||||||
				top->set_state(item.first, Const::from_string(v));
 | 
								fst->reconstructAllAtTimes(edges);
 | 
				
			||||||
 | 
								top->setInitState(startCount);
 | 
				
			||||||
 | 
								pool<Module*> wbmods;
 | 
				
			||||||
 | 
								top->writeback(wbmods);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								if (edges.empty())
 | 
				
			||||||
 | 
									log_error("No clock edges found in given time range\n");
 | 
				
			||||||
 | 
								fst->reconstructAllAtTimes(edges);
 | 
				
			||||||
 | 
								bool initial = false;
 | 
				
			||||||
 | 
								for(auto &time : edges) {
 | 
				
			||||||
 | 
									for(auto &item : inputs) {
 | 
				
			||||||
 | 
										std::string v = fst->valueAt(item.second, time);
 | 
				
			||||||
 | 
										top->set_state(item.first, Const::from_string(v));
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if (!initial) {
 | 
				
			||||||
 | 
										top->setInitState(time);
 | 
				
			||||||
 | 
										initial = true;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									update();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									bool status = top->checkSignals(time);
 | 
				
			||||||
 | 
									if (status)
 | 
				
			||||||
 | 
										log_error("Signal difference at %zu\n", time);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (!initial) {
 | 
					 | 
				
			||||||
				top->setInitState(time);
 | 
					 | 
				
			||||||
				initial = true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			update();
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			bool status = top->checkSignals(time);
 | 
					 | 
				
			||||||
			if (status)
 | 
					 | 
				
			||||||
				log_error("Signal difference at %zu\n", time);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue