- Documentation
- Flux C++ extension
- Memories
Memories
A memory is declared as an array. __memory(READ_TIMING, COLLISION) states how it behaves.
__fpga void sampleBuffer(clock clk, bits<10> addr, bits<8> dataIn, bits<1> writeEnable, bits<8>& dataOut) { __memory(clocked, write_first) bits<8> samples[1024]; __onRise(clk) { if (writeEnable) { samples[addr] = dataIn; } } dataOut = samples[addr];}| Option | Values | Meaning |
|---|---|---|
| Read timing | clocked, async |
Read on the clock edge, or immediately |
| Collision | write_first, read_first, undefined |
What a read returns while that address is written |
read_first requires clocked reads. A memory without the annotation reads asynchronously, which limits it to distributed RAM (4096 bits in the generic technology).
Resources
Section titled “Resources”You do not name block sizes or counts. The selected board decides how many blocks a memory needs.
flux --emit=hardblocks sample_buffer.fluxA memory that needs more blocks than the board has is rejected.