mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-29 18:52:30 +00:00 
			
		
		
		
	smtr: Refactor write back into _eval and _initial
Easier for comparisons, and the structure still works. (I don't remember why I moved away from it in the first place.)
This commit is contained in:
		
							parent
							
								
									d73c58fad1
								
							
						
					
					
						commit
						fa2d45a922
					
				
					 1 changed files with 17 additions and 8 deletions
				
			
		|  | @ -210,14 +210,8 @@ struct SmtrModule { | |||
| 			state_struct.insert(state->name, state->sort); | ||||
| 	} | ||||
| 
 | ||||
| 	void write(std::ostream &out) | ||||
| 	void write_eval(SExprWriter &w) | ||||
| 	{ | ||||
| 		SExprWriter w(out); | ||||
| 
 | ||||
| 		input_struct.write_definition(w); | ||||
| 		output_struct.write_definition(w); | ||||
| 		state_struct.write_definition(w); | ||||
| 
 | ||||
| 		w.push(); | ||||
| 		w.open(list("define", list(name, "inputs", "state"))); | ||||
| 		auto inlined = [&](Functional::Node n) { | ||||
|  | @ -240,7 +234,10 @@ struct SmtrModule { | |||
| 		output_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.output(name).value()); }); | ||||
| 		state_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.state(name).next_value()); }); | ||||
| 		w.pop(); | ||||
| 	} | ||||
| 
 | ||||
| 	void write_initial(SExprWriter &w) | ||||
| 	{ | ||||
| 		w.push(); | ||||
| 		auto initial = name + "_initial"; | ||||
| 		w.open(list("define", initial)); | ||||
|  | @ -259,6 +256,18 @@ struct SmtrModule { | |||
| 		} | ||||
| 		w.pop(); | ||||
| 	} | ||||
| 
 | ||||
| 	void write(std::ostream &out) | ||||
| 	{     | ||||
| 		SExprWriter w(out); | ||||
| 
 | ||||
| 		input_struct.write_definition(w); | ||||
| 		output_struct.write_definition(w); | ||||
| 		state_struct.write_definition(w); | ||||
| 
 | ||||
| 		write_eval(w); | ||||
| 		write_initial(w); | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| struct FunctionalSmtrBackend : public Backend { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue