This here's a steady-state device which uses layers of shifted conversion tables to perform an algorithm that transforms Binary numbers into Binary-Coded Decimal.
Each layer is 4 blocks tall and has a propagation delay of only 2 ticks each. The layout is the same as this here (although mine has more layers to accomodate 10 digits):
I went one step further though, and figured out how to apply the same principle to convert Binary Fractions to Decimal Fractions. For example, 0.11(bin) can be converted to 0.75(dec). by using conversion tables with that perform the inverse function (-3 if 8 or more) and shifting in the opposite direction.
Hans Lemurson's Thread of Links:http://www.minecraftforum.net/topic/371610-hans-lemursons-thread-of-links/
Look here to find links to my inventions, creations, and my Youtube channel featuring Amazing Creations of Mine (Redstone engineering FTW!!!) and charming Music-Videos about clones. I also made "Minecraft in Minecraft" (2D platformer/building game). I'm currently trying to make a computer.
Wow. I think this may be the first Binary to BCD decoder that is faster than Minecrafter9's, which was built ages ago. The fact that it can be combined with its inverse to produce numbers below the decimal point just makes this even better. My only complaint is that it would be more useful if it was 2 wide as then putting it on the end of an adder array would require less bussing but it should be an easy transformation if you can find a good 2 wide decoder.
One question: Can it be modified to work with two's complement for negative numbers?
Icks has actually made a 2-wide version which layers looking forwards rather than downwards like mine which will work for what you're proposing.
To handle 2's complement negatives, what you would do is first run it through a device which converts it to the Absolute Value and tells the display whether it should show a negative sign or not. It's relatively straightforward to construct such a device. (If largest bit is a 1, the number is negative, so invert all the bits and add 1 to make it positive).
Rollback Post to RevisionRollBack
Hans Lemurson's Thread of Links:http://www.minecraftforum.net/topic/371610-hans-lemursons-thread-of-links/
Look here to find links to my inventions, creations, and my Youtube channel featuring Amazing Creations of Mine (Redstone engineering FTW!!!) and charming Music-Videos about clones. I also made "Minecraft in Minecraft" (2D platformer/building game). I'm currently trying to make a computer.
Wow!!
That's awesome. It also looks really fast for all the steps the algorithm goes through.
I have tried in the past making one of these but i couldn't for big numbers. It was way too slow. Your modular design is incredible!!
I'll try to have a tutorial up soon for how to make the modules. It's just a lookup table, a decoder sitting directly on top of some lines of ROM. The trick is in how I managed to fit 9 lines of selection in a single length of redstone, since putting repeaters on the input line would have...complicated things, and cost a lot of speed. (Because inputs can come from either end from the layer above, you'd need to install 2-way repeaters which have more delay than I'd like. Fortunately you can just barely fit 9 selection lines in under the decoder without using repeaters.)
Rollback Post to RevisionRollBack
Hans Lemurson's Thread of Links:http://www.minecraftforum.net/topic/371610-hans-lemursons-thread-of-links/
Look here to find links to my inventions, creations, and my Youtube channel featuring Amazing Creations of Mine (Redstone engineering FTW!!!) and charming Music-Videos about clones. I also made "Minecraft in Minecraft" (2D platformer/building game). I'm currently trying to make a computer.
This here's a steady-state device which uses layers of shifted conversion tables to perform an algorithm that transforms Binary numbers into Binary-Coded Decimal.
Each layer is 4 blocks tall and has a propagation delay of only 2 ticks each. The layout is the same as this here (although mine has more layers to accomodate 10 digits):
An explanation of how the Algorithm works can be found on this website: http://www.johnloomis.org/ece314/notes/devices/binary_to_BCD/bin_to_bcd.html
I went one step further though, and figured out how to apply the same principle to convert Binary Fractions to Decimal Fractions. For example, 0.11(bin) can be converted to 0.75(dec). by using conversion tables with that perform the inverse function (-3 if 8 or more) and shifting in the opposite direction.
Look here to find links to my inventions, creations, and my Youtube channel featuring Amazing Creations of Mine (Redstone engineering FTW!!!) and charming Music-Videos about clones. I also made "Minecraft in Minecraft" (2D platformer/building game). I'm currently trying to make a computer.
Also that fractional functionality is crazy.
Icks has actually made a 2-wide version which layers looking forwards rather than downwards like mine which will work for what you're proposing.
To handle 2's complement negatives, what you would do is first run it through a device which converts it to the Absolute Value and tells the display whether it should show a negative sign or not. It's relatively straightforward to construct such a device. (If largest bit is a 1, the number is negative, so invert all the bits and add 1 to make it positive).
Look here to find links to my inventions, creations, and my Youtube channel featuring Amazing Creations of Mine (Redstone engineering FTW!!!) and charming Music-Videos about clones. I also made "Minecraft in Minecraft" (2D platformer/building game). I'm currently trying to make a computer.
I'll try to have a tutorial up soon for how to make the modules. It's just a lookup table, a decoder sitting directly on top of some lines of ROM. The trick is in how I managed to fit 9 lines of selection in a single length of redstone, since putting repeaters on the input line would have...complicated things, and cost a lot of speed. (Because inputs can come from either end from the layer above, you'd need to install 2-way repeaters which have more delay than I'd like. Fortunately you can just barely fit 9 selection lines in under the decoder without using repeaters.)
Look here to find links to my inventions, creations, and my Youtube channel featuring Amazing Creations of Mine (Redstone engineering FTW!!!) and charming Music-Videos about clones. I also made "Minecraft in Minecraft" (2D platformer/building game). I'm currently trying to make a computer.