P2 RAM - power and function question for Chip

Cluso99Cluso99 Posts: 12,847
edited October 6 in Propeller 2 Vote Up0Vote Down
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
My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
Website: www.clusos.com
Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
Sign In or Register to comment.