Shop OBEX P1 Docs P2 Docs Learn Events
P2 RAM - power and function question for Chip — Parallax Forums

P2 RAM - power and function question for Chip

Cluso99Cluso99 Posts: 18,069
edited 2017-10-06 20:59 in Propeller 2
Chip,
I have been playing with the P1V to fix the Quartus warning messages.

What I found was that in order to remove the warning message, I needed to selectively write to the RAM and always read the RAM. This would seem to mean that the RAM would draw power for reading even when reading was not required.

I just wanted to check that you were aware of this for P2, so as to minimise power for clocks when reading the RAM is not required. The same applies for reading Hub Bytes only, that is, only enable the respective byte not the long. I am certain you know more than me here, but I wanted to point it out just in case.
// 8192 x 32 ram with byte-write enables ($0000..$7FFF)

reg [3:0][7:0] ram [8191:0];

reg [31:0] ram_q;

wire wena = (ena_bus && !a[13] && w);

always_ff @(posedge clk_cog)
begin
	if (wena)
	begin
		if (wb[3]) ram[a[12:0]][3] <= d[31:24];
		if (wb[2]) ram[a[12:0]][2] <= d[23:16];
		if (wb[1]) ram[a[12:0]][1] <= d[15:8];
		if (wb[0]) ram[a[12:0]][0] <= d[7:0];
	end
	ram_q <= ram[a[12:0]];
end
Ray
Sign In or Register to comment.