How did you handle the Binary to Hex conversion for the output? I'm also working on a CPU but my plan was to go the binary to decimal route for the display. Sadly, however, the only way I've conceived of to do it would be HUGE and probably very very slow.
you take a 4-bit input into a 4 to 16 decoder, then put that output into a 16 to 7 encoder, which directly controls which parts of the 7 seg display are active.
Yep, that's what I was afraid of. I was hoping someone had conjured up some relatively quick truth table to get the same job done faster and in a smaller space. Meh... Oh well.
What are the two inputs (I guess) on the left? Are these locations? Do they write to some location?
register 14 (1110) and 15 (1111), are special registers that can be read from , but cant be written to from the alu. every time you try to write or load a value into registers 14 or 15, the corresponding value in the input area is loaded instead. the left one goes to register 15, and the one to the right goes to register 14.
what i do is, i write a line of code that will write 0 into registers 14 and 15, but because 14 and 15 are a special case, the value in the user input area ends up stored there instead. that's how my computer handles input.
the example multiplication code on the first post shows me doing this, and then copying (or'ing with 0) the input values to a writeable location.
Wait, is it possible to calculate the fps/tick speed of minecraft, being played within mainecraft? That would be amazing. P.S You are my god.
i spent some time trying to make a pure redstone random number generator. and one thing that the experience taught me, is that redstone is pure logic, and will always give exactly the same results, unless there is some non-redstone source to influence it.
so any sort of FPS display for minecraft would be totally reliant on some other minecraft mechanic, which in turn is affected by the FPS/lag, and i don't know if there are any. maybe it could measure the time it takes a person to navigate a maze (they would take longer if the fps was low), but that seems like it sort of defeats the purpose of a 'automatic' display.
I have written this code to load a number from the input and write it on the screen, but it doesn't do anything.
1011 0000 0000 1111 load(user input 2)->$15
1010 0000 1111 0011 print($0, $15)->half of the screens
(Are you supposed to press both "write at 0" and "write at next position" when you write the first line? No, right?)
Edit:
I have not tested it yet but I need to halt/loop the execution to avoid executing unallocated code, right?
Also do you even need to load the inputs can't you just use them directly?
Would this work? (I can't test it myself because MC has been quite unstable since last patch)
1011 0000 0000 0000 load(0)->$0
1010 0000 1111 1111 print($0, $15)->half of the screens
1100 0000 0000 0001 if($0, $0)->#1
this should work:
*toggle "write at 0" lever (lever should go from up->down->up)
0: 1011 0000 0000 1111 load(user input 2)->$15
*toggle "next line" lever.
1: 1011 0000 0000 0000 load(0)->$0
*toggle "next line" lever.
2: 1010 0000 1111 0011 print($0,$15)->the 2 right most screens
*toggle "next line" lever.
3: 1100 0000 0000 0011 if($0,$0)->#3
*enter a value into the left most user input area (left = $15, right = $14).
*make sure the "screen reset" lever is pointing up (if it is in the RESET position, the screen will always show '0000' no matter what).
*pull the "START" lever. (from the up position, make it point down).
NOTE: don't toggle the levers too quickly. after you pull one down, wait a second, then pull it back up. redstone fails if the signal is too short.
if this still doesn't work, try changing the 'print' line to print to all the screens.
if that fails, add another full delay repeater into the clock and see if that works. if it does, it just mean i didn't optimise the 'print' timings very well (very possible, i added the screen at the end, after i installed the clock).
if nothing works, in a few days when i get back to my regular computer, i'll have a look and see if i can find out what is wrong.
I've been looking at your coding scheme for guidance on how to put together a computer and what functions I should implement and I had a few questions:
-Why do you have a "Delete" function? Isn't that the same as Load(0)? Did you just run out of functions before you ran out of the 4-bit namespace?
-What sort of operations is "rotate" used for as opposed to just shifting?
-Since the middle sections (B and C)of your machine's code don't always point to addresses (like how the Load operation takes them as the bit value), would it be possible to use them as a sort of additional "function parameter" for functions that don't require loading 2 values from the register? I was thinking that all the "Shift"-type functions (I was thinking of implementing a wide variety) could be grouped into just 2 commands, so A would be the command itself, B would contain extra info about what kind of shift, then C would be the Data you're shifting, and D would as normal be the write-address.
I've been studying various computer designs (watching your videos, scjoiner's and many others), experimenting on my own and working on miniaturization of components and multi-function integration, and I think I should be able to make a computer that has all of the capabilites as yours, but is 1/2 the size and runs twice as fast. Whee for technological progress! (Also I'm not saying this to criticize your design, since without your work I never would have been able to make the final conceptual leap to understand how to make a computer.)
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.
I hate it when people ask "What's the point?" about computers. Building a computing machine IS the point, it's an achievement unto itself.
Anyways, I remembered another big question I had for Salaja: How does your adder work? You said that it works much faster than ripple-carry, but I'm wondering how exactly it does this. I just realized that even for an 8-bit Adder, if you're trying to make a fast computer, a 1600 millisecond ripple-time is unacceptably slow. Did you implement a "look-ahead" technique? Your video said it used a "sum of products" method, but what is that? Would you be able to show how you made your adder?
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.
I've been looking at your coding scheme for guidance on how to put together a computer and what functions I should implement and I had a few questions:
-Why do you have a "Delete" function? Isn't that the same as Load(0)? Did you just run out of functions before you ran out of the 4-bit namespace?
i ran out of functions to include. normally, the first 4 bits will be decoded to power a single set of AND gates, that will put a value onto the bus to write to a register. because i ran out of functions, some of the op-codes don't connect to a set of AND gates, as a result nothing is put on the bus. effectively loading 0 from the ALU into a register.
-What sort of operations is "rotate" used for as opposed to just shifting?
i don't know. i haven't written any programs that use it, however it is a fairly common operation (and i had plenty of unused op-codes at the time xD ) so i included them because i could. i'm sure there is a real good use, i'm just not sure what it is.
-Since the middle sections (B and C)of your machine's code don't always point to addresses (like how the Load operation takes them as the bit value), would it be possible to use them as a sort of additional "function parameter" for functions that don't require loading 2 values from the register? I was thinking that all the "Shift"-type functions (I was thinking of implementing a wide variety) could be grouped into just 2 commands, so A would be the command itself, B would contain extra info about what kind of shift, then C would be the Data you're shifting, and D would as normal be the write-address.
yes. that is normally what is done in real life to make more op-codes available. however, like i said, i had had a surplus of op-codes so the inefficiency of unused op-code bits doesn't really matter. plus, it was easiest for the instruction decoder to only look at the first 4 bits.
I've been studying various computer designs (watching your videos, scjoiner's and many others), experimenting on my own and working on miniaturization of components and multi-function integration, and I think I should be able to make a computer that has all of the capabilites as yours, but is 1/2 the size and runs twice as fast. Whee for technological progress! (Also I'm not saying this to criticize your design, since without your work I never would have been able to make the final conceptual leap to understand how to make a computer.)
go for it. i am aware of many faults, redundancies and inefficiencies in my computer. i stared building it with limited knowledge on both logic circuits and redstone, so the first parts i built were garbage and the last ones were the best.
- i've stared building another computer too, but i'm not putting a lot of time into it so it's going slowly. it should be more efficient, but also much bigger than my last, so it will probably be slower. so far, i've built a 256 Byte ROM bank, program counter (can jump or increment by 1), instruction register, and i'm working on the RAM, which will be 128 Bytes, with 32 Bytes being mapped directly to a 16x16 screen. it won't be done for a long time though, as i'm not in any rush to get it done.
Anyways, I remembered another big question I had for Salaja: How does your adder work? You said that it works much faster than ripple-carry, but I'm wondering how exactly it does this. I just realized that even for an 8-bit Adder, if you're trying to make a fast computer, a 1600 millisecond ripple-time is unacceptably slow. Did you implement a "look-ahead" technique? Your video said it used a "sum of products" method, but what is that? Would you be able to show how you made your adder?
"sum of products" is a way to design logic circuits. where: product = "*" = AND, sum = "+" = OR
for example: [A and B] or [C and not(D)], is the same as [AB]+[CD']
it is were all inputs go into AND gates, and the results of those AND gates are all fed into one OR gate.
it is only the method for designing the logic circuit, it has nothing to do with the style of adder. i'm sure there would be more efficient ways to do it, but i couldn't be bothered.
after making the videos, i have been able to classify my adder as a carry select adder, made up of 4x 2-bit parallel adders. what this means, is that 2 results are found for each output bit, and each carry out bit (from each 2-bit section). one result is output if there was a carry, the other is output if there wasn't (a MUX does the 'selecting'). the difference to ripple carry, is that the carry signal only has to go through a MUX, rather than a full adder, this saves a lot of time.
example for 8-bit adders:
delay for ripple carry=
= (8 * delay from each full adder)
delay from a carry select adder with 8 full adder parts (not the one i made)=
= (1 * delay from full adder) + (7 * delay from a 2 to 1 mux)
delay from my carry select adder =
= (1 * delay from a 2-bit parallel adder) + (3 * delay from a 2 to 1 mux)
my adder took about a second to find the first carry values, and 1 tick for each 2 to 1 mux (each of my MUX's handled 2-bit inputs and outputs). so it would take (this is an estimate, i have never timed it accurately) about 13 ticks to calculate an 8-bit sum, and 17 ticks to calculate a 16-bit sum.
after making the videos, i have been able to classify my adder as a carry select adder, made up of 4x 2-bit parallel adders. what this means, is that 2 results are found for each output bit, and each carry out bit (from each 2-bit section). one result is output if there was a carry, the other is output if there wasn't (a MUX does the 'selecting'). the difference to ripple carry, is that the carry signal only has to go through a MUX, rather than a full adder, this saves a lot of time.
example for 8-bit adders:
delay for ripple carry=
= (8 * delay from each full adder)
delay from a carry select adder with 8 full adder parts (not the one i made)=
= (1 * delay from full adder) + (7 * delay from a 2 to 1 mux)
delay from my carry select adder =
= (1 * delay from a 2-bit parallel adder) + (3 * delay from a 2 to 1 mux)
my adder took about a second to find the first carry values, and 1 tick for each 2 to 1 mux (each of my MUX's handled 2-bit inputs and outputs). so it would take (this is an estimate, i have never timed it accurately) about 13 ticks to calculate an 8-bit sum, and 17 ticks to calculate a 16-bit sum.
Thanks for this info! I'm now reading up on Carry Select Adders. My 8-bit ripple-carry Adder takes up to 2.4 seconds to deliver its answer, and I feel that's just a little bit too slow for my tastes.
You mentioned a "Parallel Adder" though. What's that?
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.
Thanks for this info! I'm now reading up on Carry Select Adders. My 8-bit ripple-carry Adder takes up to 2.4 seconds to deliver its answer, and I feel that's just a little bit too slow for my tastes.
You mentioned a "Parallel Adder" though. What's that?
to my understanding, a full adder that is used in ripple carry could be considered a 1-bit parallel adder because it takes in two 1-bit values, and produces a 1-bit result (and a carry). now imagine an adder that takes in two 2-bit numbers, and produces a 2-bit result (and a carry) as an output, that is a 2-bit parallel adder.
how to make a parallel adder:
the same way you would design a full adder. make a truth table for every possible input (including carry). this is 3 inputs and 2 outputs for a 1-bit (full adder) and 5 inputs and 3 outputs for a 2-bit (like mine). you should notice that the truth table for the 1-bit will have 8 different possible inputs, and the 2-bit will have 32 (3-bit would have 128, and a 4-bit would have 512). using the truth table, design a logic circuit to match the table. i used sum of products to make a circuit to match the truth table, but i'm sure there are other ways too.
parallel adders are the fastest in the world, but because their size grows exponentially with the number of bits, any more than 2-bits in minecraft will be slower from distance delays (for the same reason, 1-bit is almost as good as 2-bit), and any more that 4-bits in real life is usually to expensive for the gain in speed.
search google and wikipeadia for other fast methods of implementing an adder.
How long does it actually take your adder to calculate the 8 bit output? And then, unrelated to the first questions, how do you do multiplication and division? I'm also working on an ALU (maybe a CPU eventually) and am trying to find the fastest way for multiplication: an actual multiplication algorithm, or a backwards counter with adders. Same with division, only I have no idea.
Yep, that's what I was afraid of. I was hoping someone had conjured up some relatively quick truth table to get the same job done faster and in a smaller space. Meh... Oh well.
register 14 (1110) and 15 (1111), are special registers that can be read from , but cant be written to from the alu. every time you try to write or load a value into registers 14 or 15, the corresponding value in the input area is loaded instead. the left one goes to register 15, and the one to the right goes to register 14.
what i do is, i write a line of code that will write 0 into registers 14 and 15, but because 14 and 15 are a special case, the value in the user input area ends up stored there instead. that's how my computer handles input.
the example multiplication code on the first post shows me doing this, and then copying (or'ing with 0) the input values to a writeable location.
You built a computer inside a computer.
http://www.instantinception.com/
i spent some time trying to make a pure redstone random number generator. and one thing that the experience taught me, is that redstone is pure logic, and will always give exactly the same results, unless there is some non-redstone source to influence it.
so any sort of FPS display for minecraft would be totally reliant on some other minecraft mechanic, which in turn is affected by the FPS/lag, and i don't know if there are any. maybe it could measure the time it takes a person to navigate a maze (they would take longer if the fps was low), but that seems like it sort of defeats the purpose of a 'automatic' display.
Im so proud... -.-
this should work:
*toggle "write at 0" lever (lever should go from up->down->up)
0: 1011 0000 0000 1111 load(user input 2)->$15
*toggle "next line" lever.
1: 1011 0000 0000 0000 load(0)->$0
*toggle "next line" lever.
2: 1010 0000 1111 0011 print($0,$15)->the 2 right most screens
*toggle "next line" lever.
3: 1100 0000 0000 0011 if($0,$0)->#3
*enter a value into the left most user input area (left = $15, right = $14).
*make sure the "screen reset" lever is pointing up (if it is in the RESET position, the screen will always show '0000' no matter what).
*pull the "START" lever. (from the up position, make it point down).
NOTE: don't toggle the levers too quickly. after you pull one down, wait a second, then pull it back up. redstone fails if the signal is too short.
if this still doesn't work, try changing the 'print' line to print to all the screens.
if that fails, add another full delay repeater into the clock and see if that works. if it does, it just mean i didn't optimise the 'print' timings very well (very possible, i added the screen at the end, after i installed the clock).
if nothing works, in a few days when i get back to my regular computer, i'll have a look and see if i can find out what is wrong.
-Why do you have a "Delete" function? Isn't that the same as Load(0)? Did you just run out of functions before you ran out of the 4-bit namespace?
-What sort of operations is "rotate" used for as opposed to just shifting?
-Since the middle sections (B and C)of your machine's code don't always point to addresses (like how the Load operation takes them as the bit value), would it be possible to use them as a sort of additional "function parameter" for functions that don't require loading 2 values from the register? I was thinking that all the "Shift"-type functions (I was thinking of implementing a wide variety) could be grouped into just 2 commands, so A would be the command itself, B would contain extra info about what kind of shift, then C would be the Data you're shifting, and D would as normal be the write-address.
I've been studying various computer designs (watching your videos, scjoiner's and many others), experimenting on my own and working on miniaturization of components and multi-function integration, and I think I should be able to make a computer that has all of the capabilites as yours, but is 1/2 the size and runs twice as fast. Whee for technological progress! (Also I'm not saying this to criticize your design, since without your work I never would have been able to make the final conceptual leap to understand how to make a computer.)
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.
Anyways, I remembered another big question I had for Salaja: How does your adder work? You said that it works much faster than ripple-carry, but I'm wondering how exactly it does this. I just realized that even for an 8-bit Adder, if you're trying to make a fast computer, a 1600 millisecond ripple-time is unacceptably slow. Did you implement a "look-ahead" technique? Your video said it used a "sum of products" method, but what is that? Would you be able to show how you made your adder?
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.
How did you HGNASIFG do that?!
That is so cool. period.
Now my question is, where did you acquire the time to make that?
i ran out of functions to include. normally, the first 4 bits will be decoded to power a single set of AND gates, that will put a value onto the bus to write to a register. because i ran out of functions, some of the op-codes don't connect to a set of AND gates, as a result nothing is put on the bus. effectively loading 0 from the ALU into a register.
i don't know. i haven't written any programs that use it, however it is a fairly common operation (and i had plenty of unused op-codes at the time xD ) so i included them because i could. i'm sure there is a real good use, i'm just not sure what it is.
yes. that is normally what is done in real life to make more op-codes available. however, like i said, i had had a surplus of op-codes so the inefficiency of unused op-code bits doesn't really matter. plus, it was easiest for the instruction decoder to only look at the first 4 bits.
go for it. i am aware of many faults, redundancies and inefficiencies in my computer. i stared building it with limited knowledge on both logic circuits and redstone, so the first parts i built were garbage and the last ones were the best.
- i've stared building another computer too, but i'm not putting a lot of time into it so it's going slowly. it should be more efficient, but also much bigger than my last, so it will probably be slower. so far, i've built a 256 Byte ROM bank, program counter (can jump or increment by 1), instruction register, and i'm working on the RAM, which will be 128 Bytes, with 32 Bytes being mapped directly to a 16x16 screen. it won't be done for a long time though, as i'm not in any rush to get it done.
meh, troll. i consider it a free bump. :biggrin.gif:
"sum of products" is a way to design logic circuits. where: product = "*" = AND, sum = "+" = OR
for example: [A and B] or [C and not(D)], is the same as [AB]+[CD']
it is were all inputs go into AND gates, and the results of those AND gates are all fed into one OR gate.
it is only the method for designing the logic circuit, it has nothing to do with the style of adder. i'm sure there would be more efficient ways to do it, but i couldn't be bothered.
after making the videos, i have been able to classify my adder as a carry select adder, made up of 4x 2-bit parallel adders. what this means, is that 2 results are found for each output bit, and each carry out bit (from each 2-bit section). one result is output if there was a carry, the other is output if there wasn't (a MUX does the 'selecting'). the difference to ripple carry, is that the carry signal only has to go through a MUX, rather than a full adder, this saves a lot of time.
example for 8-bit adders:
delay for ripple carry=
= (8 * delay from each full adder)
delay from a carry select adder with 8 full adder parts (not the one i made)=
= (1 * delay from full adder) + (7 * delay from a 2 to 1 mux)
delay from my carry select adder =
= (1 * delay from a 2-bit parallel adder) + (3 * delay from a 2 to 1 mux)
carry select adders can vary a lot. i used 2-bit parallel adders, wikipedia's example uses a block of 4 ripple carry adders. -> http://en.wikipedia.org/wiki/Carry_select_adder
my adder took about a second to find the first carry values, and 1 tick for each 2 to 1 mux (each of my MUX's handled 2-bit inputs and outputs). so it would take (this is an estimate, i have never timed it accurately) about 13 ticks to calculate an 8-bit sum, and 17 ticks to calculate a 16-bit sum.
Thanks for this info! I'm now reading up on Carry Select Adders. My 8-bit ripple-carry Adder takes up to 2.4 seconds to deliver its answer, and I feel that's just a little bit too slow for my tastes.
You mentioned a "Parallel Adder" though. What's that?
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.
to my understanding, a full adder that is used in ripple carry could be considered a 1-bit parallel adder because it takes in two 1-bit values, and produces a 1-bit result (and a carry). now imagine an adder that takes in two 2-bit numbers, and produces a 2-bit result (and a carry) as an output, that is a 2-bit parallel adder.
how to make a parallel adder:
the same way you would design a full adder. make a truth table for every possible input (including carry). this is 3 inputs and 2 outputs for a 1-bit (full adder) and 5 inputs and 3 outputs for a 2-bit (like mine). you should notice that the truth table for the 1-bit will have 8 different possible inputs, and the 2-bit will have 32 (3-bit would have 128, and a 4-bit would have 512). using the truth table, design a logic circuit to match the table. i used sum of products to make a circuit to match the truth table, but i'm sure there are other ways too.
parallel adders are the fastest in the world, but because their size grows exponentially with the number of bits, any more than 2-bits in minecraft will be slower from distance delays (for the same reason, 1-bit is almost as good as 2-bit), and any more that 4-bits in real life is usually to expensive for the gain in speed.
search google and wikipeadia for other fast methods of implementing an adder.
Great work!
thanks in advance. :smile.gif: