Author Topic: Newbie here, and wanting to get neck deep into Homebrewing, but not a CPU...  (Read 6144 times)

0 Members and 1 Guest are viewing this topic.

Offline AGRGaleTopic starter

  • Newbie
  • Posts: 9
  • Country: au
Hello people,

I've had an interest in the hardware side of Bitcoin, manly the ASICs they use, what I wanted to do is attempt to get some discrete logic and slap together my own bitcoin core calculation.

The problem is, I really don't understand the logic of bitcoin calculation, so I can't just attempt to layout a boolean logic map.

Since you can calculate it by hand (pencil and paper linky link)
and there is a Spreadsheet calculation for SHA256 ( Sha256 on Spreadsheet in google docs.) which I can just follow.

Now I have posted this in the Beginner section since, well, I'm new at these forums and this concept, I'm not new at soldering, or even playing with SMDs and a hot air iron.  and I'm happy to spend the time soldering 100s of 1000s discrete components on some proto board, but can I get a hand though this please?
 

Offline tec5c

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: au
I'm happy to spend the time soldering 100s of 1000s discrete components on some proto board, but can I get a hand though this please?

Good, because this is exactly what you'll be doing!

Just to clarify, are you asking for help with the logic layout? The wording of the quote I inserted kind of makes it seem like you're after help to solder everything together. :P
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
If the data at https://bitcointalk.org/index.php?topic=1029536.0 is correct he will be doing a metric shitton  :scared: of soldering I think....

Quote
SHA256D, which is what Bitcoin uses, is 128 rounds, comprising

768 32-bit additions,
640 32-bit ORs
896 32-bit  XORs

So if using 8-bit wide ICs there would be (768+640+896)*4=9216 ICs in total. And my guess is that my cellphone can calculate the hashes faster than this discrete implementation
 

Offline AGRGaleTopic starter

  • Newbie
  • Posts: 9
  • Country: au
I'm happy to spend the time soldering 100s of 1000s discrete components on some proto board, but can I get a hand though this please?

Good, because this is exactly what you'll be doing!

Just to clarify, are you asking for help with the logic layout? The wording of the quote I inserted kind of makes it seem like you're after help to solder everything together. :P

Yeah, bad wording, yeah, I meant getting things laid out, not the soldering.

If the data at https://bitcointalk.org/index.php?topic=1029536.0 is correct he will be doing a metric shitton  :scared: of soldering I think....

Quote
SHA256D, which is what Bitcoin uses, is 128 rounds, comprising

768 32-bit additions,
640 32-bit ORs
896 32-bit  XORs

So if using 8-bit wide ICs there would be (768+640+896)*4=9216 ICs in total. And my guess is that my cellphone can calculate the hashes faster than this discrete implementation
just over 9000 eh? I'm going to sit and read this post you linked for a bit, work out how that person came to that conclusion.. but yes, a cellphone could outperform a truck load of ICs wired together, but its not speed I'm after, its the curve-ball learning experience, and a large device that could outlast ww3

Why don't you implement it (or study the native or ported implementation of it by someone else) in an FPGA and then simplify that into simple logic gates if you wish.

But really you can make a RTL implementation that will run in a simulator or FPGA so that achievement itself is pretty much "mission accomplished" except for actually building the thing out of TTL chips which will be a large and costly project unless you implement some kinds of programmable "processors" to sequence shared ALU resources. 




Yeah, I could do that, but it would negate the metric shit-ton of soldering I may want to do :P
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Hey, whatever floats your boat, as long as you understand that a bitcoin miner built out of discrete gates won't outperform an average smartphone. I'd personally prefer to build a CPU or a clock or something; something that's actually nominally useful.
 

Offline AGRGaleTopic starter

  • Newbie
  • Posts: 9
  • Country: au
Hey, whatever floats your boat, as long as you understand that a bitcoin miner built out of discrete gates won't outperform an average smartphone. I'd personally prefer to build a CPU or a clock or something; something that's actually nominally useful.

well i could do a 4000 transistor 4004 clone, then get it calculating sha256d :P
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: fi
    • Electronics blog about whatever I happen to build!
I don't think calculating bitcoin hashes with discrete logic would be any more stupid than making a CPU, it's just something fun and interesting to do. I doubt the idea is to outperform anything :) My suggestion is that this would be a very good opportunity to learn FPGAs which is kinda the same thing as making the thing out of discrete logic. You'll get to learn a new valuable/useful skill instead of soldering 9000 logic chips.
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline tec5c

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: au
I get the impression that the OP is aware of the excessive amount of work involved in his project, thus it seems like he is wanting to do it purely for the sake of doing it and learning a few things along the way. Which, if so, is highly admirable.  :-+
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Its a great idea, - if you are about to start a 10 year posting at an Antarctic weather station, have $10000 to blow on chips and boards and nothing better to do.
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Yea, it's not really an experience with a lot of learning-something potential - except that it is very boring to make 200 000 solder joints. Hm,  that's not too bad. Soldering for 10 hours per day it will be done in a month :-)

It will basically be same-same-same sets of boards 128 times over and a lot of interconnects.   So this is something more suited for a PnP machine or a trained monkey.



 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
[replying to myself is bad manners but I don't care :-) ]

But to be a bit more on the constructive side I just wanted to say that maybe there are better things to build if you want to spend a lot of time and money.

An arcade game from the seventies comes to mind.  Many of them was made without any microcontrollers, just pure logic.  That is a challenge to tackle and would (at least in my mind) give a lot more cred than a copy-paste-repeat*128 design as a sha256 would be.

 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
I'm happy to spend the time soldering 100s of 1000s discrete components on some proto board, but can I get a hand though this please?

Good, because this is exactly what you'll be doing!

Just to clarify, are you asking for help with the logic layout? The wording of the quote I inserted kind of makes it seem like you're after help to solder everything together. :P

Yeah, bad wording, yeah, I meant getting things laid out, not the soldering.


I think the scale of this is too large for a first project; I doubt you would ever get it working correctly.

I suggest you find a smaller project, one that can be done with maybe a dozen ICs, and take that to completion. You will learn a lot about decoupling, layout, controlled impedance, speed of light, schematic tools, layout tools - especially if you take the time and effort to examine all the non-idealities of what you've created.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline crispy_tofu

  • Super Contributor
  • ***
  • Posts: 1124
  • Country: au
If you're doing this, I think it'll be a huge undertaking (too huge?) for you. Most people (like me) would probably lose interest after the first 20 000 solder joints!   :scared:
 

Offline AGRGaleTopic starter

  • Newbie
  • Posts: 9
  • Country: au
If you're doing this, I think it'll be a huge undertaking (too huge?) for you. Most people (like me) would probably lose interest after the first 20 000 solder joints!   :scared:

this could happen, but if i lay out a plan on a whiteboard at my workbench, few hundred post-it notes, i should be able to hold on. Also to note, i have found it relaxing soldering 100s of LEDs to proto boards, so i might find making ALUs entertaining..


...snip...


I think the scale of this is too large for a first project; I doubt you would ever get it working correctly.

I suggest you find a smaller project, one that can be done with maybe a dozen ICs, and take that to completion. You will learn a lot about decoupling, layout, controlled impedance, speed of light, schematic tools, layout tools - especially if you take the time and effort to examine all the non-idealities of what you've created.

Well, i may need to start at the communications side of it, so, serial to parallel would be a start :P

 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8275
If the data at https://bitcointalk.org/index.php?topic=1029536.0 is correct he will be doing a metric shitton  :scared: of soldering I think....

Quote
SHA256D, which is what Bitcoin uses, is 128 rounds, comprising

768 32-bit additions,
640 32-bit ORs
896 32-bit  XORs

So if using 8-bit wide ICs there would be (768+640+896)*4=9216 ICs in total. And my guess is that my cellphone can calculate the hashes faster than this discrete implementation
That is only if you do all the rounds in essentially combinatorial logic. Since the OP's goal is not to make the fastest implementation, perhaps he should attempt to make the smallest (in terms of gate count)? I think using bit-serial operations, and registers to keep the intermediate results, would make it rather small.
 

Offline fivefish

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: us
Quote
768 32-bit additions,
640 32-bit ORs
896 32-bit  XORs

How are you going to deal with all the propagation delays?
 

Offline AGRGaleTopic starter

  • Newbie
  • Posts: 9
  • Country: au
If the data at https://bitcointalk.org/index.php?topic=1029536.0 is correct he will be doing a metric shitton  :scared: of soldering I think....

Quote
SHA256D, which is what Bitcoin uses, is 128 rounds, comprising

768 32-bit additions,
640 32-bit ORs
896 32-bit  XORs

So if using 8-bit wide ICs there would be (768+640+896)*4=9216 ICs in total. And my guess is that my cellphone can calculate the hashes faster than this discrete implementation
That is only if you do all the rounds in essentially combinatorial logic. Since the OP's goal is not to make the fastest implementation, perhaps he should attempt to make the smallest (in terms of gate count)? I think using bit-serial operations, and registers to keep the intermediate results, would make it rather small.

well since the sha256 calculation is done in 64 rounds, I could store that 4-bytes of data each operation, using only 1 hashing logic unit.

so basically, one hashing unit consist of:
6 x 32-bit adders
5 x 32-bit ORs and
7 x 32-bit XORs

« Last Edit: October 20, 2015, 05:29:58 am by AGRGale »
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8275
You could compress that down into a few gates if you use bit-serial addition/logical operations along with a lot of shift registers...
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
You could compress that down into a few gates if you use bit-serial addition/logical operations along with a lot of shift registers...

Nice to see the old techniques for making commercial computers haven't been forgotten :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Just buy truck load of resistors, 1N4148s and2N3904s, and make your own "FPGA". :)
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16284
  • Country: za
You could compress that down into a few gates if you use bit-serial addition/logical operations along with a lot of shift registers...

Nice to see the old techniques for making commercial computers haven't been forgotten :)

Going to be a little difficult getting the MK4007 serial memories for it though. Went obsolete in the 1970's, and i have not seen much data on it online either, most are the regular 4007 CMOS chip.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf