Arithmetic and Logic Calculator

An area for asking questions, making suggestion, share ideas and place circuit examples.
Post Reply
JekasG
Posts: 1
Joined: Sat Sep 20, 2014 4:15 pm

Arithmetic and Logic Calculator

Post by JekasG »

Build an arithmetic and logic calculator that has:
1) Four input bits of data, stored in a single-bit register (D-type latch)
2) One carry-in bit, stored in a register (D-type latch)
3) Six instruction bits, each stored in a register (D-type latch).
a. The first and second bits of the instruction (B1 and B2) specify the
operation to be performed.
- 00 is a NOR operation
- 01 is a AND operation
- 10 is an NAND operation
- 11 is an ADD operation
b. The third and fourth bits of the instruction (B3 and B4) specify one
input data register which will be used in your calculation.
- Register 0 is addressed as 00
- Register 1 is addressed as 01
- Register 2 is addressed as 10
- Register 3 is addressed as 11.
c. The fifth and sixth bits of the instruction (B5 and B6) specify the
second input data register which will be used in your calculation.
- Register 0 is addressed as 00
- Register 1 is addressed as 01
- Register 2 is addressed as 10
- Register 3 is addressed as 11.
4) Each operator will perform a calculation on the input data from the registers
identified by bits B3, B4, B5 and B6.
5) ADD operations will also use the carry-in register.
6) If you perform a logical operation (NOR, AND or NAND), the output should
be stored in an output register (D-type latch).
7) If you perform an ADD, you should store the trailing bit in the output register,
and the leading bit in a carry-out register (D-type latch).


I have problems understand this problem i have to solve.
So i am to make a four single-bit register, but i don't know what i have to do for it.
I also have to make a six instruction bit, each stored in a register.
So how does B3 + B4 and B5 + B6 relate to the input bits ?
How am i supposed to make this curcuit

Thank you in advance.
User avatar
admin
Site Admin
Posts: 407
Joined: Sun Jun 14, 2009 10:53 pm
Contact:

Re: Arithmetic and Logic Calculator

Post by admin »

Frankly, I am confused too. I suggest you to ask this question to your teacher. Probably there are some typos in the task.
Hans Cadans
Posts: 57
Joined: Thu Apr 24, 2014 12:30 pm

Re: Arithmetic and Logic Calculator

Post by Hans Cadans »

Dear JekasG,

I do understand the problem very well, but I won't give you the answer right away.
The whole problem is well described by your teacher.
To help you, I will give you an other description.

You have to make an 1-bits ALU, (Arithmetic and Logic Unit), four 1-bits input registers, an 1-bits output register
and a carry register.

Start with the ALU. This ALU has to perform four operations. (NOR, AND, NAND and ADD).
Each operations needs two operands. (1 bit). So, for the logic operations, you'll need the associated 2 input gates.
For the addition you need a Full-Adder (two input bits, a carry-input, an output for the SUM, and an output for an eventual carry-out.

Because you have to choose between four operations, you need two bits (B1 and B2, this gives you four combinations 00,01,10 and 11)
for the correct operation. B1 en B2 form the, so called, Opcode-Field.
As I said, you only need two operands for each operation, but you have four different input-registers. So you have to decide,
which register acts as the first operand and which input register acts as the second.

To choose one of the four inputs-registers as operand-1, you need two bits (B3 and B4, this gives you four possibilities)
To choose an other (or the same) input-register as operand-2, you need two bits more (B5 and B6)
Let's call these bits the Address-Field.

An instruction has, in this way, the next form:

Instruction Address-Field
Operation Operand-1 Operand-2

B1 B2 B3 B4 B5 B6

For example the code 01 10 11, has to perfom an AND-operation with register-2 and register-3.
The outcome goes to the output register.

With logic operations the outcome only goes to the output-register
With the additon the outcome ( two bits, because you have 1-bit-registers) goes to the output-register (least significant bit)
and to the carry-out register (most significant bit).

I assume that the output of carry-out register acts as the carry-input.

And now the problem of the choices you'll have to make:
You have to design circuits, which selects the output of the right gate or the Full-Adder, according to the value of B1 and B2
and, which connect the output of a chosen input registers to one input of the ALU, (B3 and B4) and the output of the other
register to the other input of the ALU. (B5 and B6). If B3,B4 and B5,B6 are the same, then you multiply the chosen register by two.

Let me know, if you don't have to design all the necessary circuits yourself, but you are allowed to use more sophisticated circuits,
then I can and will give you more details and solutions

Best regards
Hans Cadans
Post Reply