Reading and Writting to a RAM at the same time

Status
Not open for further replies.

srpronto

Newbie level 2
Joined
May 25, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
22
Hi guys,
I'm doing a project and I came to a problem, maybe two.
I'm using a RAM that stores 18 : std_logic_vectors(6 downto 0). I'm using two counters in this project, one changes the adress and the other changes the value on that adress. Both values of the counters are being shown on the HEX of the board.
The problema is:
- When i change a value, on some of the adresses, it appears to change right (even two the numbers looked bugged on the HEX) but and when i change to a higher adress the value i put on other adress seems to follow and make those next adresses with the same or other value that i didn't put at start.

In this project i need to be able to read the value that currently is stored on RAM and need to write to it at the same time. I'm not sure if the problem is on the RAM, i guess the problem is on the clocks i use (currently using 50MHz clock on the board), but i need some guidance . Any more code you need to look at just tell me.
 

I would not call that a RAM. It is some kind of register bank.

The problem you have is probably caused by the the line
Code:
			addr_reg <= address;
being outside of the clocked part of the process. You should not have any code there.
 


I removed that signal completly and i'm now using the address input directly. Do you think that this "register bank" (and i admit it really is that) is fine? From my VWF it seems to work just fine but something with the clock should be wrong. In a hour i'll test it again and see if i'm successful.
 

The clock names don't match:

Code:
	process(WriteClock)
	begin
		if(rising_edge(clock)) then

Try to use as few clocks as possible, and use strobes instead.
You don't want clock domain crossings where you easily can avoid them.

The design looks strange, but I don't understand what problem it is supposed to solve, so I can't say much about it.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…