Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

How to increment the Altera RAM data without reading data from the RAM

Hi All,

I am using 2PORT RAM megafunction in my module. I want to write some data into a particular RAM address and then I want to increment that data by 1. One way, I know, is that I could read data from that location, add 1 to the read data and write it again into that RAM address. But that would be little bit tedious. All I want to know is whether it is possible to increment the data at that RAM address without reading it.Thanks.

Ashish Devre

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    A read-modify-write operation on a RAM cell can be implemented by external logic, but will always need two clock cycles.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Did the same. Read the data, incremented it and wrote it again.

    You are right. Additional clock with double of original clock frequency would be needed. But in my application there wasn't any need of that, as I was writing on the alternate rising edges of my clock.

    Though it would be easier, if that increment-without-read facility had been there.

    Is there any other RAM available with this kind of feature? Just curious