kramble / FPGA-Litecoin-Miner

A litecoin scrypt miner implemented with FPGA on-chip memory.
GNU General Public License v3.0
279 stars 125 forks source link

Cyclone V with built in DDR3 memory controller #3

Closed i3luefire closed 10 years ago

i3luefire commented 11 years ago

maybe we could get this working on the below fpga with built in memory controller. http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=167&No=816&PartNo=2


FPGA Device

Cyclone V SX SoC—5CSXFC6D6F31C8NES 110K LEs, 41509 ALMs 5140 M10K memory blocks 6 FPGA PLLs and 3 HPS PLLs 2 Hard Memory Controllers 3.125G Transceivers ARM®-based hard processor system (HPS)

800 MHz, A Dual-Core ARM Cortex™-A9 MPCore™ Processor 512 KB of shared L2 cache 64 KB of scratch RAM Multiport SDRAM controller with support for DDR2, DDR3, LPDDR1, and LPDDR2 8-channel direct memory access (DMA) controller Configuration and Debug

Quad Serial Configuration device – EPCQ256 for FPGA On-Board USB Blaster II (micro USB type B connector) Memory Devices

1GB (2x256MBx16) DDR3 SDRAM on FPGA 1GB (2x256MBx16) DDR3 SDRAM on HPS 128MB QSPI Flash on HPS Micro SD Card Socket on HPS EPCQ256 Flash on FPGA Communication

USB 2.0 OTG (ULPI interface with micro USB type AB connector) USB to UART (micro USB type B connector)

10/100/1000 Ethernet

i3luefire commented 11 years ago

i mean this may work as is but i have no clue how to optimize the code.

kramble commented 11 years ago

That's one impressive looking piece of kit for just $249. Shame its only on pre-order though. Have you actually got one in hand to play with? Not sure its going to be economic to buy just as a Litecoin miner (like almost certainly not), but as a dev board it looks great.

Yeah, the basic hasher using on-chip ram should work fine, not sure how many cores we can fit. 5140 M10k's looks like five full scratchpads, so 5 cores or 10 half cores, though 110kLE probably won't fit all of them. Whether it will route them is another matter (see the LX150 thread). Its going to need a lot of work to use the SDRAM though, and being only 16 bits datapath is going to drastically limit the performance.

Anyway the above may be moot if I can get the hash core pipelining to work, as the single core performance should shoot up. Its early days yet with this project.

With regard to mining, as with the DE0-Nano board, I suspect the onboard power supply will be somewhat under-rated, which is going to limit the performance we can get. I had to hack my Nano to get the maximum bitcoin hash rate out of it (otherwise I'd fry the regulator chips), but I'd be quite reluctant to do that with this piece of kit. Still, at $249 I'm tempted to pre-order anyway. Not quite so happy about direct from Taiwan though. I may wait for a local (UK) distributor. Alternatively there is the Xilinx Zedboard, but its pricier and lower spec (and not in stock either).

ADDENUM: OK, I've read the user manual. Its very similar in flavour to the DE0-Nano manual. Clearly targeted at the educational market and rather light on the specifics, though helpfully provides lots of pinout info. Most of the functions of the board are probably never going to be used by a typical user, and some of the more advanced ones are going to be challenging (Ethernet on linux? I guess there will be some demo code somewhere). Anyway, back to the litecoin miner. The FPGA SDRAM data path is actually 32 bits (2x16) so that helps, but its going to be a bitch to get it working. The example code uses a Nios II soft-core processor, and from what I've seen of the equivalent DE0-Nano code, its going to be messy to bolt the SDRAM controller onto a mining core, especially as we'll need to use burst mode for speed. The second bank of SDRAM connects directly to the Cortex-A9 processors, so won't be directly usable for mining, but we could run a CPU miner on linux, though its performance is not going to be great. All in all, its a great value board for the price, but quite a challenge to get a miner running on anything but the on-chip RAM.

hagarthehorrible1 commented 11 years ago

Kramble:

I have one of those SoC evaluation boards with Cyclone V in my hands and I will be more than happy to test your code there, but I am concluding that it is useless working with external memory, as the limitation will be LEs available. In the DE2-155 I was able to instantiate 7 cores, using halfram, but with 97% of the logic elements used you start having timing problems on the routing of the logic...

Hagar, the Horrible

kramble commented 11 years ago

Hi Hagar.

Lucky you! How did you manage to get hold of one? Yes, I'd be interested to hear how it performs. I'm also happy to hear you've got 7 cores running on the DE2-115. If you've seen the LX150 thread, you'll so how much difficulty we're having getting multicore to fit on the Xilinx device (the only reason I'm keen to target it is the number of existing bitcoin mining boards from ngzhang, ztex and others that are out there and soon to be redundant).

Have you got anything to share on your optimizations to the hashing core? I'm starting to look at pipelining multiple streams through a single core (to get around the Xilinx routing problems) and I'd love to hear how you managed to get the 6kHash/sec from one core.

Regards, Mark

i3luefire commented 11 years ago

I don't have one personally but was considering getting one for litecoin/tinkering. I have an original DE0 but it sux for mining bitcoin (12mh/s max or maybe it was 1.2mh/s i don't remember) and is probably worse for ltc. I didn't really see the fact that half the ram was tied to the arm portion. At first i thought the arm cores were part of the fpga, but now i see that they are separate silicon but in the same package.

kramble commented 11 years ago

i3lufire If you're prepared to hack the PSU, you can get 35MHash/sec out of a DE0-Nano, take a look at my bitcoin github. Not that its worth it now, given the difficulty (I've still got one Nano mining bitcoin, but its just generating dust now). The real highlight was seeing my code actually find a block last week (at a ridiculous 1.6 billion difficulty). Shame it was pool mining, but the kudos is incredible.

EDIT: Ah, sorry, you meant the Cyclone 3 16kLE board. Yes I can see that would be more limited.

i3luefire commented 11 years ago

very nice. but i have the original DE0 not the DE0-nano

On Mon, Aug 12, 2013 at 12:22 PM, kramble notifications@github.com wrote:

i3lufire If you're prepared to hack the PSU, you can get 35MHash/sec out of a DE0-Nano, take a look at my bitcoin github. Not that its worth it now, given the difficulty (I've still got one Nano mining bitcoin, but its just generating dust now). The real highlight was seeing my code actually find a block last week (at a ridiculous 1.6 billion difficulty). Shame it was pool mining, but the kudos is incredible.

— Reply to this email directly or view it on GitHubhttps://github.com/kramble/FPGA-Litecoin-Miner/issues/3#issuecomment-22509754 .