mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Added support for constant bit- or part-select for memory writes
This commit is contained in:
		
							parent
							
								
									1b00861d0a
								
							
						
					
					
						commit
						6d69d4aaa8
					
				
					 2 changed files with 56 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -114,3 +114,23 @@ assign rd_data = memory[rd_addr_buf];
 | 
			
		|||
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
module test05(clk, addr, wdata, rdata, wen);
 | 
			
		||||
 | 
			
		||||
input clk;
 | 
			
		||||
input [1:0] addr;
 | 
			
		||||
input [7:0] wdata;
 | 
			
		||||
output reg [7:0] rdata;
 | 
			
		||||
input [3:0] wen;
 | 
			
		||||
 | 
			
		||||
reg [7:0] mem [0:3];
 | 
			
		||||
 | 
			
		||||
integer i;
 | 
			
		||||
always @(posedge clk) begin
 | 
			
		||||
	for (i = 0; i < 4; i = i+1)
 | 
			
		||||
		if (wen[i]) mem[addr][i*2 +: 2] <= wdata[i*2 +: 2];
 | 
			
		||||
	rdata <= mem[addr];
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
endmodule
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue