I am using a RAM of size 512x512 using a word length of 18 bits. After a portion of the design flow, I have to clear its contents. Is there a way to clear it in a single clock cycle?
Initialising the contents and reset are two different things.
Initialisation takes places at power up, and is part of the chip configuration. If there were some reset mechanism, then you would need some secondary storage to store each ram's reset configuration and the logic to reset each element in a single clock cycle. So no, not possible.
You could manually reset by writing each location youself. But the question I have is why do you need to reset it? There are many ways to validate data. Why not have some address (or other logic) that marks the ram contents as valid? reset this single element and the whole ram is "reset".
I have a RAM containing an image. I am compressing it to generate a bitstream. Using that bitstream, I want to regenerate the image using that bitstream. To reuse the RAM, I need to invalidate or reset its contents.
But if I keep the contents there and consider them as invalid and then update them. I should be able to label the contents which are updated and which are still invalid.
Why not have some address (or other logic) that marks the ram contents as valid?
imagine a harddisk with FAT.
* safe a file on the harddisk: Data will be stored at a specific address on the harddisk. This file address combined with some file information is stored in the FAT - also on the harddisk.
* delete a file from harddisk: No file data will be touched /deleted. Only the FAT will be touched. It just marks the address area with the file data as available.
Why are you regenerating the image back over the original image? why not just play it into some form of output buffer?
But either way, shouldnt the uncompressed image be the same size as the original?
That frame buffer is basically most of the ram on the chip. Why not use an external ram as a frame buffer? then you can store many frames?
But if you're overwriting the frame buffer with an image of identical size, why do you even need to reset it? it will get overwritten?
If you absolutely must reset the ram, then you have to set each address one by one.
But I propose if you need to do this, then there is a problem with your design, rather than a problem with the hardware.
If you need to reset the ram, you would need to double or multi-buffer. This allows you to have a RAM, or a section of a larger RAM, that is clear assuming the rate at a ram can clear is faster then the need for a newly cleared ram. For example, a BRAM36 could have a 36 bit write port and an 18b R/W port. If you need 18kb of ram you are now using 36kb of ram. The write port can clear at 36b/cycle and the r/w port can read/write at 18b/cycle. This method works best when you know you will read the entire ram.