Writing tests for memory testing

Thread Starter

dancedancekilobots

Joined Oct 26, 2017
2
hey i was given an assignment to write 3 test for a single port memory and was wondering if anyone has some good example on how to write tests and could help the memory will be copied and pasted below so if anyone with a similar code can help.

Code:
module single_port_ram (data, addr, we, clk, q);
parameter WIDTH = 16;
parameter ADDR_BITS = 4;
parameter DEPTH = 2ˆADDR_BITS;

input [WIDTH-1:0] data;
input [ADDR_BITS-1:0] addr;
input we, clk;
output [WIDTH-1:0] q;

// Declare the RAM variable
reg [WIDTH-1:0] ram [DEPTH-1:0];

// Variable to hold the registered read address
reg [ADDR_BITS-1:0] addr_reg;

always @ (posedge clk)
begin
// Write
if (we)
ram[addr] <= data;
addr_reg <= addr;
end

// Read
assign q = ram[addr_reg];

endmodule
Moderators note: please use code tags for pieces of code
 
Last edited by a moderator:

joeyd999

Joined Jun 6, 2011
6,279
You could start by imagining the kind of write faults that can occur -- things like "stuck ats" and shorted adjacent data lines or memory cells.

Then, think of ways you can test for those situations.
 

joeyd999

Joined Jun 6, 2011
6,279
i have never written a test. Would anyone be able to give an example of a test that they have written to test memory?
You haven't done the first part yet -- identifying potential faults.

We don't do homework here -- unless we're paid for it and we get to email directly to your professor with an explanation.
 

philba

Joined Aug 17, 2017
959
Ditto what Joey said. My rates start at $500/hr. Think about how the device works (look at the data sheet). Try to imagine what errors might occur. Be one with the memory. Ooom.
 
Top