+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 2
    Points: 703, Level: 5

    Join Date
    May 2015
    Posts
    47
    Helped
    0 / 0
    Points
    703
    Level
    5

    Altering some bits of a RAM location

    Is it possible to alter specific bits of a RAM location?
    For example: A RAM location has some contents(say 00011000), I need to add 4(100) to the contents i.e the contents will be changed to (00011100). Can I just directly invert 2nd bit of the RAM? The only way I know is to generate address of that location in one cycle, in next cycle we will get the contents and alter then and write them back. This consumes two clock cycles. If we can directly send '1' to the second bit location without altering the other bits, it may save a clock cycle(if possible)

    •   Alt6th October 2017, 06:53

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 19,197, Level: 33
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    3,691
    Helped
    802 / 802
    Points
    19,197
    Level
    33

    Re: Altering some bits of a RAM location

    if you're using block RAM I don't think you can do this. But you could create a RAM with bit-enables; it might take up a lot of resources.



    •   Alt6th October 2017, 07:34

      advertising

        
       

  3. #3
    Advanced Member level 5
    Points: 34,548, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,332
    Helped
    1845 / 1845
    Points
    34,548
    Level
    45

    Re: Altering some bits of a RAM location

    The rams usually have byte enable signals, so you can modify individual bytes, but not bit enables.
    At that level, the only way to alter is to read-modify-write.


    1 members found this post helpful.

--[[ ]]--