I need help to understand circuit

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
hello,
I need help to understand this circuit
as per my knowledge there are three component
3 to 8 decoder
2 to 4 decoder
8 bit instruction register
look the instruction register. I think first four bit specify opcode ,then two bit specify destination ,and then two bit specify source

now I want to modify that circuit I want to add accumulator , registers and Ram memory
how to do , I don't understand how to connect another component ?
 

ScottWang

Joined Aug 23, 2012
7,499
add accumulator , registers and Ram memory
What do you want an accumulator for 4bits or 8bits?
What do you want the registers for 4bits or 8bits?
What do you want the Ram memory for 4bits or 8bits or 16bits?
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
A wider (more bits) instruction word, so that you can include the addressing for the extra source/destinations.
ok I am adding more bit
opcode destination source

Accumulator may be source or destination
registers may be source or destination
ram memory may be source or destination
Immediate value may be source
If I include more bit , then instruction word will be following

opcode ,source (immediate value , accumulator , memory , registers) ,destination ( accumulator , memory , registers)
three bit opcde , four bit source and three bit destination

so instruction word length will be 10 bit long.

look the diagram that I have been posted
lets think we are using 3 decoder
3 to 8 decoder that will select operation LD ST , ADD ....
000 nop
001 LD
001 ADD

2 to 4 decoder for source specification
00 Immediate value
01 accumulator
10 registers
11 memory

2 to 4 decoder for destination specification
00 nop
01 accumulator
10 registers
11 memory

we can say 7 bit instruction word
3 bit for opcode
2 bit for source
2 bit for destination

Does it make any sense ?
 
Last edited:

ScottWang

Joined Aug 23, 2012
7,499
Your list just for the decoder, and you still need 1 byte(8 bits) for the accumulator, 1 bytes (8 bits) for the registers, and 1 byte(8 bits) or 2 bytes(16 bits) for the destination(ram address), some others as PC(program counter), IR(instruction register).

And the others are that you need the 8 bits for the data bus and 1 byte(8 bits) or 2 bytes(16 bits) for the address bus, they depend on that you want to use for 8 bits or 16 bits.
 

djsfantasi

Joined Apr 11, 2010
9,237
Are you considering a 10 bit instruction word or 7 bit? A 7 bit instruction word only allows for a total of 3 registers and RAM locations. (One of four possibilities is used for the accumulator). Two RAM locations is all you'd have. Four bits for the source gives you an accumulator and 15 registers/RAM locations. But you only reserve 3 bits for the destination address, hence 8 locations are effectively unusable. Source and Destination address sizes should be the same.
 

WBahn

Joined Mar 31, 2012
32,745
hello,
I need help to understand this circuit


as per my knowledge there are three component
3 to 8 decoder
2 to 4 decoder
8 bit instruction register
look the instruction register. I think first four bit specify opcode ,then two bit specify destination ,and then two bit specify source

now I want to modify that circuit I want to add accumulator , registers and Ram memory
how to do , I don't understand how to connect another component ?
How you do it depends on your overall architecture. For instance, what address is RAM is to be written to? Is that information supposed to be in the instruction, or is it supposed to be already stored in another register?
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
I am just focusing on connection. I made some some diagram so just ignore how many bit for ram , rom , or other . I will answer your question later. just look only for connection
I don't understand how to connect 1st and 2 nd decoder with registers , accumulator and memory?

here I have drawn some extra diagram that will help you to understand 1 st diagram
Instruction word size 8 bit
Four bit opcode
Two bit source
Two bit destination

Source addressing mode
00 select accumulator
01 select registers
10 select memory
11 immediate value

Destination addressing mode
00 select accumulator
01 select registers
10 select memory
11 nop
Load immediate data into Accumulator
LD A, #immediate
0001 11 00
0001 Load operation
11 immediate data (source )
00 accumulator (destination )

if I am going on right track then I will tell other example
 

WBahn

Joined Mar 31, 2012
32,745
Again, how you do things depends on the overall architecture you are working with. Trying to "just look only for connection" is like someone asking how to connect a brake actuator to the brakes but not being willing to consider that how that is done depends on whether the brakes are hand-operated mechanical brakes like on a 10-speed bike, foot-actuated anti-lock hydraulic brakes like on most modern cars, or lever-actuated pneumatic brakes on a locomotive.

Consider your example to load immediate data into the accumulator.

What would the instruction be if I want to load the value 3 into the accumulator? What would it be if I want to load the value 42 into the accumulator?
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
Again, how you do things depends on the overall architecture you are working with. Trying to "just look only for connection" is like someone asking how to connect a brake actuator to the brakes but not being willing to consider that how that is done depends on whether the brakes are hand-operated mechanical brakes like on a 10-speed bike, foot-actuated anti-lock hydraulic brakes like on most modern cars, or lever-actuated pneumatic brakes on a locomotive.

Consider your example to load immediate data into the accumulator.

What would the instruction be if I want to load the value 3 into the accumulator? What would it be if I want to load the value 42 into the accumulator?
as you said I tried to make diagram but not sure I don't think that , this will work
 

WBahn

Joined Mar 31, 2012
32,745
Again, we can't do much for you until you more fully define your instruction set architecture.

You used the example of loading an immediate into the accumulator. So let's stick to that.

I have two instructions that appear somewhere in the code:
LD A, #3
LD A, #42

What are the instructions, in binary, for those two assembly code instructions?
 

WBahn

Joined Mar 31, 2012
32,745
How is studying an ALU going to help him understand instruction decoding and memory addressing?

His basic problem is that he can't articulate what the problem is that he is trying to solve -- and it's hard to solve a problem that you don't understand.
 

ScottWang

Joined Aug 23, 2012
7,499
How is studying an ALU going to help him understand instruction decoding and memory addressing?

His basic problem is that he can't articulate what the problem is that he is trying to solve -- and it's hard to solve a problem that you don't understand.
He just want to creating inside structures of a small CPU, but I want him to looks from outside of the CPU as a block diagram, this is just like when we want to know someone else, maybe we will see how his appearance, and know more about what he like, how he eat, how he study, how he do all the stuff.
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
Again, we can't do much for you until you more fully define your instruction set architecture.

You used the example of loading an immediate into the accumulator. So let's stick to that.

I have two instructions that appear somewhere in the code:
LD A, #3
LD A, #42

What are the instructions, in binary, for those two assembly code instructions?
Instruction word size 8 bit
Four bit opcode
Two bit source
Two bit destination

ooo1 load operation

Source addressing mode
00 nope
01 select registers R1
10 select registers R2
11 select registers R3

Destination addressing mode
00 Nope
01 select registers
10 select memory
11 select accumulator

LD A, #3
LD A, #42
Instruction word size 8 bit
Four bit opcode, Two bit source, Two bit destination

I I I I D D S S
I I I I D D R R
0001 1 1 0 1 ; LD A, #3
0001 1 1 1 0 ; LD A, #42
 

Attachments

Last edited:

WBahn

Joined Mar 31, 2012
32,745
Instruction word size 8 bit
Four bit opcode
Two bit source
Two bit destination

ooo1 load operation

Source addressing mode
00 nope
01 select registers R1
10 select registers R2
11 select registers R3

Destination addressing mode
00 Nope
01 select registers
10 select memory
11 select accumulator

LD A, #3
LD A, #42
Instruction word size 8 bit
Four bit opcode, Two bit source, Two bit destination

I I I I D D S S
I I I I D D R R
0001 1 1 0 1 ; LD A, #3
0001 1 1 1 0 ; LD A, #42
According to your description above:

0001 11 01 would mean load from R2 to "registers"

while

0001 11 10 would mean load from R2 to "memory"

Do you even see that you are ignoring the immediate value altogether?

And this is not consistent with your prior description (Post #12) where you said:

Source addressing mode
00 select accumulator
01 select registers
10 select memory
11 immediate value

Destination addressing mode
00 select accumulator
01 select registers
10 select memory
11 nop

Load immediate data into Accumulator
LD A, #immediate
0001 11 00
0001 Load operation
11 immediate data (source )
00 accumulator (destination )
Although I suspect I know where this will go, I would recommend that you work through the first several projects in the Nand2Tetris project described in my blog:

http://forum.allaboutcircuits.com/blog/nand2tetris-overview.590/
 
Top