• 0

posted a message on A microprocessor in Excel

## Clock

=MOD( FLOOR( NOW()*100000*FREQ; 1; ); 2 )

This formula checks if the time is even or odd. FREQ is the frequency of the clock in Hz. Update the clock by holding the button that is assigned to recalculate everything. (I think it is F9)

As an alternative, you can select an empty cell and hold Ctrl+R.

For convenience, you can assign the clock cell some name like "CLK".

You could also create a manual clock and a button to switch between the two.

## All the other things...

...will probably be listed in this reply.

Posted in: Computer Science and Technology
• 0

posted a message on A microprocessor in Excel

## Splitter

It is unreasonable to perform complex operations on numbers using discrete logic gates, so you can use the standard addition, subtraction, lookup etc. functions. However, you might want to convert multibit integers into discrete signals and vice versa.

For splitting, the easiest solution is to convert the number into binary and then split the binary number as a string.

For combining the signals, you can concatenate all the bits and then convert the final string to a decimal number.

.

And it works!

Posted in: Computer Science and Technology
• 0

posted a message on A microprocessor in Excel

I wasn't able to find any material related to this topic, so I'm going to post it here.
In this thread I'm going to provide some basic facts that prove that it is possible to emulate any computer architecture in Excel (or any Excel-compatible software). I'm going to provide some fundamental digital logic that can be easily implemented in Excel.
I'm planning to extend this thread over time.

## Basic stuff (combinational logic)

Firstly, you'll need to enable iterative calculations. This allows you to create flip-flops or any other circuits that have any feedback.

Different connections will be stored in different cells. Cells can take two values (for now, at least): 1 and 0.
So let's create the NOT function.

NOT(0) = 1
NOT(1) = 0

There are two ways to implement it:

1. = 1 * NOT(cell)
NOT(cell) will return TRUE or FALSE (the values will change depending on your language), so we have to convert the result to integers.

2. = (1 - cell)
...because 1-0=1 and 1-1=0.

The second way is a bit unusual but it's shorter.

As you can see, I'm using some color coding:

I hope it doesn't require any explanation.

Other gates are also very easy to make:

Logic gates

Notice that:

1. AND(x;y) can be replaced with (x*y) or (x+y)=2

2. OR(x;y) can be replaced with:

a) 1-((1-x)*(1-y))

(x+y)>0

3. XOR(x;y) can be replaced with (x<>y)

4. XNOR(x;y) can be replaced with (x=y)

## Sequential logic

Sequential logic is the one that allows for feedback, i.e. some input of a sequential circuit can reference its output. Remember to enable iterative calculations in Options.

### SR latch

SR Latch

Basically, an SR latch is a circuit that can be either set (S) or reset (R) and keeps its state if (S NOR R).

### D latch

D latch

TL;DR: D (or DE) latch stores the bit in D when the signal E is 1.

S = D AND E
R = (NOT D) AND E

### D flip-flop

D flip-flop

D flip-flop acts like a D latch, but it stores D on the rising edge of the CLK signal, i.e. when it transitions from 0 to 1. You can build it in a master-slave configuration like this:

Posted in: Computer Science and Technology
• 0

posted a message on The Swapper

### Swapper

This block has one item slot, let's call it the accumulator.
3 is the upper side, 4 is the bottom side of the block.

If the back side is not powered:

When side 1 is powered, a stack of items from the container above (3) is transfered to the accumulator.
When side 2 is powered, a stack of items from the container below (4) is transfered to the accumulator.

And if it is:

When side 1 is powered, contents from the accumulator are transfered to the block above (3).
When side 2 is powered, contents from the accumulator are transfered to the block below (4).

All the transfers happen on the rising edge of signals 1 and 2.

The front side is useful as well. The block stores the 'return code' of the last operation.
0 = undefined
5 = success
10 = input error: container (above or below) is empty
15 = output error: container (above or below) is full (or the block is not a container at all)

If you connect the front side to the output of the swapper, you can read some information from it.
If the comparator is in comparison mode, it will act the same way as with chests.
If the comparator is in subtraction mode, it will output the return code.

I don't know if the return code system is any useful, but it might be helpful for debugging or for limited applications.

In general, the swapper can be useful in storage systems

Posted in: Suggestions
• 1

posted a message on Weird tape read-only disk drive

This disk drive is pretty compact but very slow.
The access time (for this particular drive) is between 2 and 30 seconds, so it has a limited field of application.

This is basically a piston tape drive attached to a ripple counter. It works like this:

This device works very well when you read data sequentially, for instance when you are performing operations on an array.

Posted in: Redstone Creations
• 0

posted a message on One button input 3 outputs

This circuit uses only 6 repeaters, ~25 dust pieces and 1 torch. The output of the last repeater is connected to the input of the first repeater.

When you build the circuit, all three repeaters are off. You will have to power the underground wire and press the button once.

Posted in: Redstone Creations
• 1

posted a message on Compact ROM that uses Observers.

## The main idea

If you have 2N memory cells, you need N bits of address to specify which cell you want to read. 2 decoders for N/2 bits occupy much less space than a single N-bit decoder, so the way to go is to create a matrix where each cell has 2 'enable' signals, let's call them "green" and "orange".

My idea is to create an array of pistons and empty space. When you power or unpower such strip (when ["green" NOR "orange"] transitions from 0 to 1), pistons are going to update and trigger the observers above them. Empty blocks will not send any signal. Then you can collect all the signals that you receive and store them.

## The design itself

In this example, 10011010 is written in the cell.

The footprint of the cell is (n+1)x5, where n is the number of bits per cell, but I think you can make it (n+1)x4 if you think of something clever.

This is an array of 64 6-bit cells. It actually uses a 7x4 footprint but the signal is propagated with 2 torches connected in serial so it affects the reading speed.

I think that something similar might work for RAM as well, but I wasn't able to make anything compact.

Posted in: Redstone Creations