Minecraft Redstone Project

Easiest one done yet. Complement. A NOT gate :)

Black wool is the complement
complement.png

Complement inverts the input of the green register and outputs it to white. Blue makes no impact on the result
complementexample.png
 
Next few are simple too. OR.

63065115.png

Takes both inputs, compares them and if one, the other or both are logic 1 then the output will be logic 1
orexample.png
 
Now, to decide what I'm going to do next

storysofar.png


Red - not making
Yellow - not needed until ALU is finished
Green - Have not thought about how these will work and will probably not be needed until the ALU is finished

1.Subtract, so therefore decrement, will be difficult.
2.Increment is another add unit
3.Rotate left and right are just 2 more registers
4.Swap nibbles just requires the data re-routing

I think I will make it in order of which is easiest. 4,2,3,1 :)

Probably make 4 and 2 before I get bored and go off for the day
 
Swap nibbles done :)
A nibble is 4 bits, half a byte.
Swap nibbles just changes the two nibbles over so "10100010" becomes "00101010"

No logic required here. Just wired bit 4 into bit 8 of the mux, bit 1 into 5 blah blah blah
nibblemux.png

nibbleworking.png
 
Increment has been finished. All it does is add 1 to the main register (the green one)
Same circuit as add just with a torch where the 2nd input would go and the rest of the 2nd inputs removed from the other bits

increment.png

incrementtesting.png
 
I need to learn and understand the twos complement method of subtraction to finish the ALU.
If anyone can explain how it works, it would be greatly appreciated.
Otherwise, I will try and wrap my head round it with help from the internet :)
 
Now to try and explain subtraction. To do "A-B" you need to do "A+(-B)"

The add bit is fine, its just a full adder. However to turn B negative, two's complement has to be used.

All that means is invert "B" with a load of NOT gates then add one to this, then it can be shoved into the adder.

The adder has a "carry in" input that essentially adds 1.

so all that needs doing is:
Invert B
Activate "C in"

Simple :) But there's a problem. This only works when the final answer is positive.

So, when the output is negative (this can be determined by the carry out output, logic 1 is positive, logic 0 is negative) the answer has to be inverted and 1 added again.

The solution to this is adding another NOT gate array and another adder with a logic 1 at "C in"

Then, by using a de-multiplexer hooked into "C out" of the first adder the result can be obtained for positive and negative answers.

I have probably confused you and I have probably done this a long winded way but here are a couple of images to show you what I mean (which will probably still leave you confused) :)

A red output shows logic 1, green is 0. The output on the far left is the sign bit which I will probably show on the display as the carry flag. Notice how green is positive answer (I NOT(ed) the "c out" of the first adder)
subtractor.jpg

A negative result shown here (2-6=-4 or 0010-0110=-0100)
subtractor1.jpg

Need to extend this to an 8 bit subtractor but that can be done in minecraft :)
 
Last edited:
This is a test for the size of the subtractor. Decided to put signs down as I need to remember which input is which :)

2 inputs on the right with a carry in. The other carrys are in the bottom left with the sign bit and output (pink) above them. Realized that I only need a half adder for the 2nd add 1.
subtractortesting.png

I think the increment only needed a half adder. So I have extra lag than needed :/ may change that later
 
I don't know. I like the look of the stock one, when I did look for one ages ago I couldn't find a decent one and TBH I can't be bothered.
Recommend me one??? :)
 
Back
Top Bottom