mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Merge pull request #2029 from whitequark/fix-simplify-memory-sv_logic
ast/simplify: don't bitblast async ROMs declared as `logic`
This commit is contained in:
		
						commit
						0a14e1e837
					
				
					 3 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -3540,8 +3540,8 @@ void AstNode::mem2reg_as_needed_pass1(dict<AstNode*, pool<std::string>> &mem2reg
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// also activate if requested, either by using mem2reg attribute or by declaring array as 'wire' instead of 'reg'
 | 
			
		||||
	if (type == AST_MEMORY && (get_bool_attribute(ID::mem2reg) || (flags & AstNode::MEM2REG_FL_ALL) || !is_reg))
 | 
			
		||||
	// also activate if requested, either by using mem2reg attribute or by declaring array as 'wire' instead of 'reg' or 'logic'
 | 
			
		||||
	if (type == AST_MEMORY && (get_bool_attribute(ID::mem2reg) || (flags & AstNode::MEM2REG_FL_ALL) || !(is_reg || is_logic)))
 | 
			
		||||
		mem2reg_candidates[this] |= AstNode::MEM2REG_FL_FORCED;
 | 
			
		||||
 | 
			
		||||
	if (type == AST_MODULE && get_bool_attribute(ID::mem2reg))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								tests/svtypes/logic_rom.sv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/svtypes/logic_rom.sv
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
module top(input [3:0] addr, output [7:0] data);
 | 
			
		||||
    logic [7:0] mem[0:15];
 | 
			
		||||
    assign data = mem[addr];
 | 
			
		||||
    integer i;
 | 
			
		||||
    initial for(i = 0; i < 16; i = i + 1) mem[i] = i;
 | 
			
		||||
endmodule
 | 
			
		||||
							
								
								
									
										3
									
								
								tests/svtypes/logic_rom.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								tests/svtypes/logic_rom.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
read_verilog -sv logic_rom.sv
 | 
			
		||||
prep -top top
 | 
			
		||||
select -assert-count 1 t:$mem r:SIZE=16 %i r:WIDTH=8 %i
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue