mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Selective boolopt
This commit is contained in:
		
							parent
							
								
									e9b0f73cb3
								
							
						
					
					
						commit
						c32d0a412c
					
				
					 8 changed files with 297 additions and 36 deletions
				
			
		| 
						 | 
				
			
			@ -17,8 +17,6 @@
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
#ifdef VERIFIC_LINEFILE_INCLUDES_LOOPS
 | 
			
		||||
#include <stack>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
    This Visitor decorates the AST with a loop ID attribute for all outer for loops.
 | 
			
		||||
    All AST nodes contained within the subtree of an outer for-loop
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +39,7 @@ class DecorateLoopsVisitor : public VeriVisitor
 | 
			
		|||
			// We increase the loop count when we enter a new set of imbricated loops,
 | 
			
		||||
			// That way we have a loop index for the outermost loop as we want to identify and group
 | 
			
		||||
			// logic generated by imbricated loops
 | 
			
		||||
			outerLoopId++;
 | 
			
		||||
			outerLoopId = node.Linefile();
 | 
			
		||||
		}
 | 
			
		||||
		loopStack.push((VeriLoop *)&node);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +56,7 @@ class DecorateLoopsVisitor : public VeriVisitor
 | 
			
		|||
		if (loopStack.size()) {
 | 
			
		||||
			if (loopStack.top() == (VeriLoop *)&node) {
 | 
			
		||||
				loopStack.pop();
 | 
			
		||||
				std::cout << "Loop out: " << (VeriFor *)&node << std::endl;
 | 
			
		||||
				// std::cout << "Loop out: " << (VeriFor *)&node << std::endl;
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			Verific::linefile_type linefile = (Verific::linefile_type)node.Linefile();
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +71,6 @@ class DecorateLoopsVisitor : public VeriVisitor
 | 
			
		|||
 | 
			
		||||
      private:
 | 
			
		||||
	std::stack<VeriLoop *> loopStack;
 | 
			
		||||
	uint32_t outerLoopId = 0;
 | 
			
		||||
	linefile_type outerLoopId = nullptr;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,6 +55,7 @@ USING_YOSYS_NAMESPACE
 | 
			
		|||
#include "VeriLibrary.h"
 | 
			
		||||
#include "VeriExpression.h"
 | 
			
		||||
#ifdef VERIFIC_LINEFILE_INCLUDES_LOOPS
 | 
			
		||||
#include "VeriStatement.h"
 | 
			
		||||
#include "VeriConstVal.h"
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -430,8 +431,8 @@ void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &att
 | 
			
		|||
	if (obj->Linefile()) {
 | 
			
		||||
		attributes[ID::src] = stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(obj->Linefile()), obj->Linefile()->GetLeftLine(), obj->Linefile()->GetLeftCol(), obj->Linefile()->GetRightLine(), obj->Linefile()->GetRightCol());
 | 
			
		||||
#ifdef VERIFIC_LINEFILE_INCLUDES_LOOPS
 | 
			
		||||
		if (uint32_t loopid = obj->Linefile()->GetInLoop()) {
 | 
			
		||||
			attributes[RTLIL::escape_id("in_loop_" + std::to_string(loopid))] = std::to_string(loopid);
 | 
			
		||||
		if (linefile_type loopid = obj->Linefile()->GetInLoop()) {
 | 
			
		||||
			attributes[RTLIL::escape_id("in_for_loop")] = stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(loopid), loopid->GetLeftLine(), loopid->GetLeftCol(), loopid->GetRightLine(), loopid->GetRightCol());
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue