Minecraft Maps / Redstone Device

Zi3 Microcontroller + Peripheral devices = Calculator

  • 828 views, 3 today
  • 69 downloads, 0 today
  • 5
  • 3
  • 7
Zilack3's Avatar Zilack3
Level 20 : Expert Engineer
9
Hi guys !

Today i show you my new redstone device called Zi3. It was built in 6 months (January 2016 - June 2016).

It is composed of:
- 16 bits ALU divided in 4 stages to reach better performance by reducing the calculation time. Moreover, the ALU is made of several components as a 4 4 bits ripple carry adders, a 4 4 bits XOR, a 4 4 bits AND, a 4 4 bits comparator and a 4 4 bits bi-directionnal shifter.
- 6 16 bits accumulator (A1,A2,A3,B1,B2,B3) with the dual-read technology (calculations can't be perform between two A or B accumulators).
- 6 bits program counter (load only because it's just 6 D-Latch)

This microcontroler can performs several things, for example: mathematical sequences (counter, Fibonnaci sequence), operations (add, sub, div (with or without point), mul), approximation (Euler's number) etc...

To test it, i've implemented 4 programs (ADD,SUB,MUL,DIV) and some peripheral devices for using the µC as a calculator.

How to use it ?

  • Version : 1.10.2
  • Mode : solo
  • Render distance : 16 chunks
  • Position of the redstone device:
    • x = 1505
    • y = 56
    • z = -701

  • You control a cursor (at the lower right corner of each digit) thanks to 4 button.
  • When the cursor is on a digit, press validated button to increment the digit.
  • "=" is on when Zi3 calculating.
  • From the upper lines to lower lines, from the left to the right of the user interface:
    • Validated
    • Up
    • Reset (stop the clock and reset A and B)
    • Left
    • Down
    • Right

  • A and B can't overpass 255 (8 bits).
  • And that's all !
Microcontroller's specifications
  • clock : 125 mHz
  • storage : 12 bytes DPRAM
  • program counter width : 6 bits
  • program's length : 56 lines
  • program's weight : 294 bytes
Program's deadline
  • ADD : 1min10s
  • SUB : 1min30s
  • MUL : 6min20s
  • DIV : 5min10s
Composition
  • Command block (only say command) : 77
  • Redstone lamp : 226
  • Redstone repeater : 3596
  • Redstone torch : 5675
  • Step : 2439
  • Redstone wire : 44038
  • Wool : 52300
ALU's working
LVL1
  • A + B
  • A - B
LVL2
  • A SL+0
  • A SL+1
  • A SR
  • A AND 1 OR AND FF
LVL3
  • A > B
  • A = B
  • A < B
LVL4
  • B SL+0
  • B SL+1
  • B SR
  • B AND 1 OR AND FF
READ LVL1 = 0 / READ LVL2 = 0 / READ LVL4 = 1
READ LVL1 = 0 / READ LVL2 = 1 / READ LVL4 = 1
READ LVL1 = 1 / READ LVL2 = 0 / READ LVL4 = 1
READ LVL1 = 1 / READ LVL2 = 1 / READ LVL4 = 0

READ LVL1, READ LVL2 and READ LVL4 are low active.
Input/Output
16 BITS INPUT

Ax001 // operand 1 [LVL4] (Bits are active-high)
AxSL7 // operand 1 + 7 shift left // NOT CONNECT [LVL4] (Bits are active-high)
Bx001 // operand 2 [LVL4] (Bits are active-high)
BxSL7 // operand 2 + 7 shift left [LVL4] (Bits are active-high)
Cx001 // 0000 0000 0000 0001 [LVL2] (Bits are active-high)
Cx009 // 0000 0000 0000 1001 [LVL2] (Bits are active-high)

16 BITS OUTPUT (Only B's accu are available)

Qx000 // result (Bits are active-high)
Sx000 // sign [0 = positive sign, 1 = negative sign] (Bits are active-high)

8 BITS OUTPUT

Zx999 // [7,6,5,4,3,2,1,0] (Bits are active-high)

BIT 7 : Read Ax001
BIT 6 : Put flag "stop clock cpu" to 1
BIT 5 : Read Bx001
BIT 4 : Read BxSL7
BIT 3 : Write Qx000
BIT 2 : Write Sx000
BIT 1 : Read Cx009
BIT 0 : Read Cx001
Set of the µC (ASYNCHRONOUS PART) (NOT PERFORMED BY Zi3)
while(1){
if(BP_EQ ==1){
Sx000 = 0;
SET();
DDAA();
DDAB();
while(flag_DDAA == 0){
;
}
tempo(10000);
if(BP_ADD == 1){
ADD();
}
if(BP_SUB == 1){
SUB();
}
if(BP_MUL == 1){
MUL();
}
if(BP_DIV == 1){
DIV();
}
}
}
Addition
_________________________________________________
A1 = Ax001; {Zx999 = 80} //$0D [LV4]
B1 = Bx001; {Zx999 = 20} //$0E [LV4]
_________________________________________________
B2 = A1 + B1; //$11 [LV1]
_________________________________________________
Qx000 = B2; {Zx999 = 48} //$12 [LVX]
_________________________________________________

t(max) = t(min) : 5*(2+1+1) = 0min20.00s
Subtraction
_________________________________________________
A1 = Ax001; {Zx999 = 80} //$04 [LV4]
B1 = Bx001; {Zx999 = 20} //$05 [LV4]
_________________________________________________
if(A1 < B1){ //$06 [LVX]
B2 = B3; //$07 [LV4]
}
B1 = A1 - B1; //$08 [LV1]
if(B2 = Cx001){ {Zx999 = 01} //$09 [LVX]
B1 = 0 - B1; //$0A [LV1]
}
_________________________________________________
Qx000 = B1; {Zx999 = 08} //$0B [LVX]
Sx000 = B2; {Zx999 = 44} //$0C [LVX]
_________________________________________________

t(max) : 5*(2+5+2) = 0min45.00s
t(min) : 5*(2+3+2) = 0min35.00s
Multiplication
A1 = Ax001; {Zx999 = 80} //$13 [LV4]
B1 = Bx001; {Zx999 = 20} //$14 [LV4]
_________________________________________________
do{
A3 = B1 AND 1; //$15 [LV4]
if(A3 != 0){ //$16 [LVX]
B2 = B2 + A1; //$17 [LV1]
}
A1 = A1 SL+0; //$18 [LV2]
B1 = B1 SR; //$19 [LV4]
A2 = A2 - B3; //$1A [LV1]
}while(A2 != 0) //$1B [LVX]
_________________________________________________
Qx000 = B2; {Zx999 = 48} //$1C [LVX]
_________________________________________________

t(max) : 5*(2+9*7+1) = 5min30.00s
t(min) : 5*(2+9*6+1) = 4min45.00s
Division
_________________________________________________
A1 = Ax001; {Zx999 = 80} //$1D [LV4]
B1 = BxSL7; {Zx999 = 20} //$1E [LV4]
_________________________________________________
A2 = A2 - B3; //$29 [LV1]
do{
if(A1 >= B1){ //$21 [LVX]
A1 = A1 - B1; //$22 [LV1]
B2 = B2 SL+1; //$23 [LV4]
}else{
B2 = B2 SL+0; //$24 [LV4]
}
A2 = A2 - B3; //$25 [LV1]
B1 = B1 SR; //$26 [LV4]
}while(A2 != 0) //$27 [LVX]
_________________________________________________
Qx000 = B2; {Zx999 = 48} //$28 [LVX]
_________________________________________________

t(max) : 5*(2+8*6+1) = 4min15.00s
t(min) : 5*(2+8*5+1) = 3min35.00s
Set
_________________________________________________
A1,A2,A3,B1,B2,B3 = 0; //$01 [LVX]
B3 = Cx001; {Zx999 = 01} //$02 [LV2]
A2 = Cx009; {Zx999 = 02} //$03 [LV2]
_________________________________________________

t(max) = t(min) : 5*(3) = 0min15.00s
Program counter (PC)
Bits are active-low.
Operations (OP)
- 0 = no torch
- 1 = torch

BIT0 (OUTPUT):
- 0 : Read LVL2
- 1 : Noting
BIT1 (OUTPUT):
- 0 : Read LVL1
- 1 : Nothing
BIT2 (INPUT):
- 0 : A<=B
- 1 : A>B
BIT3 (INPUT):
- 0 : A>=B
- 1 : A<B
BIT4 (INPUT):
- 0 : A=B
- 1 : A!=B
BIT5 (OUTPUT):
- 0 : Nothing
- 1 : Write A3
BIT6 (OUTPUT):
- 0 : Nothing
- 1 : Write A2
BIT7 (OUTPUT):
- 0 : Nothing
- 1 : Write A1
BIT8 (OUTPUT):
- 0 : Read A3
- 1 : Nothing
BIT9 (OUTPUT):
- 0 : Read A2
- 1 : Nothing
BIT10 (OUTPUT):
- 0 : Read A1
- 1 : Nothing
BIT11 (OUTPUT):
- 0 : Shift right
- 1 : No shift
BIT12 (OUTPUT):
- 0 : X or 0
- 1 : X or 1
BIT13 (OUTPUT):
- 0 : Shift left
- 1 : No shift
BIT14 (OUTPUT):
- 0 : X and FF
- 1 : X and 01
BIT15 (OUTPUT):
- 0 : Add
- 1 : Sub
BIT16 (OUTPUT):
- 0 : Nothing
- 1 : Write A1
BIT17 (OUTPUT):
- 0 : Nothing
- 1 : Write A2
BIT18 (OUTPUT):
- 0 : Nothing
- 1 : Write A3
BIT19 (OUTPUT):
- 0 : Read A3
- 1 : Nothing
BIT20 (OUTPUT):
- 0 : Read A2
- 1 : Nothing
BIT21 (OUTPUT):
- 0 : Read A1
- 1 : Nothing

Feel free to write your own program !

Enjoy !

PS : All the components and programs have been homemade.
Progress100% complete
Tags

1 Update Logs

Update #1 : by Zilack3 07/07/2016 12:27:26 pmJul 7th, 2016

- Download link updated

Create an account or sign in to comment.

1
07/08/2016 8:48 pm
Level 28 : Expert Engineer
Snap2it
Snap2it's Avatar
Does the "Program's Deadline" mean that it takes five minutes and ten seconds to divide?
1
07/09/2016 4:28 am
Level 20 : Expert Engineer
Zilack3
Zilack3's Avatar
The program's deadline mean that ALL the calculation time (from the pressing of the push-button to the displaying of the result on the 7-Seg) can't take more than 5min10s.

EDIT1: 5min10s is the calculation time for 255/1. It will take less time if you perform the operation 255/0. To understand why i say that, see DIV's part.

EDIT2 : DIV is now called Division.
1
07/08/2016 8:47 pm
Level 28 : Expert Engineer
Snap2it
Snap2it's Avatar
This is very cool! What series of operations does the CPU have to do when dividing numbers?
1
07/09/2016 4:38 am
Level 20 : Expert Engineer
Zilack3
Zilack3's Avatar
It does addition, substraction, shift left OR 0, shift left OR 1, comparaison. To see more details, check DIV's part.
1
07/08/2016 10:43 am
Level 16 : Journeyman Botanist
LinuxViki
LinuxViki's Avatar
cool, a mix of Redstone Computer (like Bluestone) and a Redstone Calculator (like Count-Tron)
1
07/07/2016 1:08 pm
Level 2 : Apprentice Crafter
ThaQwiver
ThaQwiver's Avatar
Holy cow! That's awesome!
1
07/09/2016 4:14 am
Level 20 : Expert Engineer
Zilack3
Zilack3's Avatar
Thanks you !
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome