kramble / FPGA-Litecoin-Miner

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

Error divide by zero on Cyclone V Starter Board #16

Open everestultimate opened 8 years ago

everestultimate commented 8 years ago

My config.tcl set url "http://XX.XX.XX.XX:8332" set userpass "myuser.myworker:mypass"

I downloaded mining_proxy.exe from https://github.com/slush0/stratum-mining-proxy. then run cmd.exe mining_proxy -o litecoinpool.org -p 3333

I get this error when i run mine.bat

error

asovetov commented 3 years ago

same error =(

tgbilder commented 3 years ago

Me too. This miner needs a Tcl stratum support. I think it is possible with pure Tcl.

burntCherryCake commented 2 years ago

This error seems like it's not heavily device dependent. I've tracked down where in the tcl script this is happening, but don't know the expected behavior of the variables. I was reconfiguring this project for a Cyclone II (just for fun) when I hit this.

The error happens when mine.tcl calls push_work_to_fpga in jtag_command.tcl. The case I hit was where the target threshold received from the mining pool (Nov 13, 2022) is

$work(target) -> 0000000000000000000000000000000000000000000000000000ffff00000000 but then the script does this to the target: set target [string range [reverseHex $work(target)] 0 7] which results in $target -> 00000000 because the previous line essentially grabs the first 8 characters of the $work(target) value.

Then, in the block of code quoted at runtime, this happens # Only write target the first time (and if it subsequently changes) if { $prevtarget != $target } { write_instance "TARG" $target set diff [expr 0x0000ffff / 0x$target ] puts "new target $target diff $diff" }

which attempts to divide 0x0000ffff by 0x00000000, which is indeed, a divide by 0.

burntCherryCake commented 2 years ago

By the way, getwork <-> stratum conversion seems to be doable via a proxy (https://github.com/slush0/stratum-mining-proxy). The Proxy seems to work, I don't get errors when connecting to a pool, and mine.bat seems to be getting some non-garbage values.