Forum Discussion
20 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- Ok - if you need dual clock then you have to live with random data during concurrent read/write of the same address - note the you can get some bits of the old data and some of the new. M9K don't have a 'read' signal, they do reads every cycle. You can use the clken to stop this - and keep the output data constant even though the address has changed. --- Quote End --- OK, thank You for the answer about Read. What then could be the solution to have a real dual-port memory ( without the problems during concurrent read/write of the same address ) with one port being controlled by NIOS II and the other by custom logic? - Altera_Forum
Honored Contributor
You have to use a single clock and then enable OLD_DATA.
And still not do two writes to the same location. Note that feeding the same clock to both clock inputs doesn't count - the M9K has to be configured with a single clock input. If the Nios cpu (or other avalon master) is using a different clock then a clock crossing bridge will be added. I mostly know about this because we had issues with the sopc builder silently ignoring OLD_DATA for M9K dual ported between the avalon bus and tightly coupled memory. IMHO internal memory should always be tightly coupled to the nios cpu (unless you need the 2nd port for something else). - Altera_Forum
Honored Contributor
--- Quote Start --- If the Nios cpu (or other avalon master) is using a different clock then a clock crossing bridge will be added. --- Quote End --- Do You mean, that QSYS will add it automaticaly or should I add it manually? --- Quote Start --- IMHO internal memory should always be tightly coupled to the nios cpu (unless you need the 2nd port for something else). --- Quote End --- Do You mean, that if 2nd port is controlled by my custom logic, then internal memory should not nessecary be tightly coupled to the nios cpu? - Altera_Forum
Honored Contributor
How does this scheme change if you instantiate a dpram outside of qsys, but wish to access it from nios (instruction and data)? The megafunction dp ram has just a few signals for each port (address, output read data, input write data, write enable, and clock), but the memory controllers in qsys are all s/dram based, with ras, cas, etc...
Incidentally, one of the reasons I'm looking at instantiating the memory OUTSIDE of qsys, is because quartus seems to have trouble fitting the design when I specify too large of a memory block in qsys. Interestingly, 15k won't fit, but 14k will.. and the fit summary shows only 25% memory utilization (and 65% logic)! So obviously, the 1k isn't causing it to run out of memory, it must be something else. Outside of qsys I can instantiate a 17k dpram (or much bigger) and it synthesizes fine, thus I'd like the nios to execute from this "external" memory. - Altera_Forum
Honored Contributor
I don't think the scheme changes at all; it is the same basic concept just applied slightly differently.
e.g. insert an Avalon-MM Pipeline Bridge, connect it's slave port to your NIOS, and export it's Master port as a conduit. In your toplevel, connect the master conduit pins to your dual port RAM. - Altera_Forum
Honored Contributor
The 'memory utilisation' of 25% means that you are using 25% of the memory bits, not 25% of the memory blocks.
If something is using a small number of address or data bits in a memory block then the utilisation will be reported as low even though the other bits can't be used. - Altera_Forum
Honored Contributor
--- Quote Start --- Yes, its correct! Did You manage to connect External DSP to the exported second (s1) port of the dual port RAM? If Yes , the please answer: 1). why Write signal is present, but the Read signal is missing on the exported second (s1) port of the dual port RAM? 2). Is Write really is WriteEnable? 3). how to use clken ( clock enable ) on the exported second (s1) port of the dual port RAM? --- Quote End --- Did you get an answer to this? I have the same question. Since there is no read signal exported the write must be a write/read_n or write high read low level? Is clken or chipselect used as a data strobe? Are all signals active high? clken, chipselect, write? byteenable is active high so if you specify byteenable as all ones 4'b1111 for 4 byte 32 bit interface you are writing all 32 bits in one write cycle. - Altera_Forum
Honored Contributor
Reads happen every clock without an explicit enable (other than clken).
clken stops the address being latched so has the effect of holding the previous data-out even though the address is no longer present. - Altera_Forum
Honored Contributor
Thank you. 1) Is clken active high? 2) Is chipselect active high? 3) Is reset for the onchip mem s2 active low?
- Altera_Forum
Honored Contributor
I just answered 3) in my last post false so reset is active high as are clken and chipselect.