mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Merge pull request #2880 from whitequark/cxxrtl-fix-2877
cxxrtl: add debug_item::{get,set}
			
			
This commit is contained in:
		
						commit
						9af88951bc
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -999,6 +999,22 @@ struct debug_item : ::cxxrtl_object {
 | 
			
		|||
		next    = nullptr;
 | 
			
		||||
		outline = &group;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template<size_t Bits, class IntegerT>
 | 
			
		||||
	IntegerT get() const {
 | 
			
		||||
		assert(width == Bits && depth == 1);
 | 
			
		||||
		value<Bits> item;
 | 
			
		||||
		std::copy(curr, curr + value<Bits>::chunks, item.data);
 | 
			
		||||
		return item.template get<IntegerT>();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template<size_t Bits, class IntegerT>
 | 
			
		||||
	void set(IntegerT other) const {
 | 
			
		||||
		assert(width == Bits && depth == 1);
 | 
			
		||||
		value<Bits> item;
 | 
			
		||||
		item.template set<IntegerT>(other);
 | 
			
		||||
		std::copy(item.data, item.data + value<Bits>::chunks, next);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
static_assert(std::is_standard_layout<debug_item>::value, "debug_item is not compatible with C layout");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue