I need help to understand circuit

WBahn

Joined Mar 31, 2012
30,087
I have read top five pdf file link https://www.google.co.in/?gws_rd=cr,ssl#q=nand2tetris pdf

Chapter 1 tell the basic of gates and their truth table like AND , OR gate
Chapter 2 tell the basic of ADDER , ALU and their truth table
Chapter 3 tell the basic of register , memory and counter
Chapter 4 tell the basic of machine language , command and addressing mode
Chapter 5 tell the basic of computer architecture , there are some short notes for cpu , data memory , instruction memory
I did not understand how to connect basic component of processor
Then you didn't do the projects because if you had then you would have a complete computer system (not including peripheral interfaces like the keyboard and monitor which are memory mapped) built up using only NAND gates and D-Type flip flops. You would know exactly how instructions are encoded for this processor and exactly how they are decoded and executed.

I don't understand what do you mean , If you are asking , how do you make instruction set than I can explain

Look the post #32 there are some component and I just want to assemble them. I just want to make circuit where i can fetch instruction , I can decode and execute the instruction . I know I need program memory, data memory , program counter, instruction decoder , accumulator, two general purpose register , two temporary register and ALU . I am just trying to make simple circuit, after that I will add more function like stack pointer ,psw register , extra memory
All I know but I don't understand how to connect all component together
You have NOT made a coherent instruction set. As just one example, you have stated that you want a load-immediate instruction and yet you have not shown how you intend to encode the immediate value into the instruction. You have, instead, shown conflicting examples that are not even consistent with what you have previously said. You have been asked repeatedly how you intend to represent the RAM or register address within your instruction and you refuse to do so. There is no way to explain how to decode your instruction when you refuse to show how the necessary information is going to be represented within your system.
 

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?
LD A, #3
LD A, #42

Program memory (hex code)
74
03
74
2A

Program memory :address 0001 contain 74 = 11 10 01 01
Program memory :address 0002 contain 03= 00 00 00 11
Program memory :address 0003 contain 74 = 11 10 01 01
Program memory :address 0003 contain 42= 00 10 10 11
Accumulator address: 74 H

Program counter
0000
0001
0002
0003
0004

Processor sends the program counter (PC) value to the program memory's address bus, reads the byte at that address, and increments the program counter.

In this case, PC contains 0001 so processor read the byte at address 0001 in program memory.

Program memory contains a byte value of 74 = 11 10 01 01 ,
Some opcodes are the 4 bit wide or 8 bits wide.

Let's assume that opcode is 74 = 11 10 01 01 and stores in instruction register ,that is address of Accumulator .
This is the first instruction fetch cycle.
fetch and execute


When PC contains address 0002 so processor read the byte at address 0002 in program memory
Program memory contains a byte value of 03= 00 00 00 11
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
So why do you have 74 on the left side of the equal sign and 11 10 01 01 on the right side of it? (11 10 01 01 is E5H)
sorry its just copy paste error 74 = 0111 0100

accumulator # immediate data
# direct addressing
accumulator is 8 bit, assume address of accumulator is 0111 0100
temporary register is 8 bit that hold Immediate data 00 00 00 11
example
LD A, # 00 00 00 11

this is 2 byte instruction
first byte is 0111 0100
second byte is 00 00 00 11

lets assume that first byte 0111 0100 is opcode , that store in instruction register. This is the first instruction fetch cycle.
What I need to know if I want to load the immediate value into the accumulator ?
 

WBahn

Joined Mar 31, 2012
30,087
sorry its just copy paste error 74 = 0111 0100

accumulator # immediate data
# direct addressing
accumulator is 8 bit, assume address of accumulator is 0111 0100
temporary register is 8 bit that hold Immediate data 00 00 00 11
example
LD A, # 00 00 00 11

this is 2 byte instruction
first byte is 0111 0100
second byte is 00 00 00 11

lets assume that first byte 0111 0100 is opcode , that store in instruction register. This is the first instruction fetch cycle.
What I need to know if I want to load the immediate value into the accumulator ?
If the ISA specifies that the instruction LD A, #num is supposed to load the immediate value num into the accumulator, then of course you want to load num into the accumulator. What is it that makes you uncertain about that?
 

djsfantasi

Joined Apr 11, 2010
9,163
forget all , look this circuit. I am using two registers. Data transfer between two register. I have not connected all wires. I am not sure that diagram is right. I just want to see how does data transfer between two register
You have the inputs to the two registers tied together. And no way of getting data to either register.

In the example below, I have connected the output of the accumulator to the inputs of the register. The mode select inputs (S0 & S1) of the register are hardwired to perform a parallel load, to transfer the data. In this application, the DSR and DSL (Data Shift Left & Right, respectively) are not used, so they are connected to ground, I also did not wire the master reset input.

accreg.png

So when the Load input of the register is brought high, whatever is present on pins D0-D3 will be loaded into the register output, pins Q0-Q3. The input pins of the register are wired to the output pins of the accumulator, so the result is that the data from the accumulator is copied to the register, If you wanted to do the reverse, you'd wire the output pins of the register to the input pins of the accumulator and bring both mode select pins on the accumulator high to do the transfer.

For multiple registers, you'd need additional control circuitry between the registers and the accumulator..
 
Last edited:

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
You have the inputs to the two registers tied together. And no way of getting data to either register.

In the example below, I have connected the output of the accumulator to the inputs of the register. The mode select inputs (S0 & S1) of the register are hardwired to perform a parallel load, to transfer the data. In this application, the DSR and DSL (Data Shift Left & Right, respectively) are not used, so they are connected to ground, I also did not wire the master reset input.

View attachment 77656

So when the Load input of the register is brought high, whatever is present on pins D0-D3 will be loaded into the register output, pins Q0-Q3. The input pins of the register are wired to the output pins of the accumulator, so the result is that the data from the accumulator is copied to the register, If you wanted to do the reverse, you'd wire the output pins of the register to the input pins of the accumulator and bring both mode select pins on the accumulator high to do the transfer.

For multiple registers, you'd need additional control circuitry between the registers and the accumulator..
Now I am looking register that store Immediate Data actually I want to load data from immediate register and that data will store into Accumulator , I don't know which ic is used for immediate data storage register
 

djsfantasi

Joined Apr 11, 2010
9,163
I provided the example, as an attempt to steer you into better understanding of what you had done. I could have stopped after my first statement. Having said that, I believe that the example provided along with the extra description should answer your last question, should you expend the effort to think about it carefully. You have a register (what makes it an immediate register?) and you'd like to store that in the accumulator. Well, you should now know how to do this in the opposite direction. How to go back? (Hint: I describe it in my earlier answer).
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
I provided the example, as an attempt to steer you into better understanding of what you had done. I could have stopped after my first statement. Having said that, I believe that the example provided along with the extra description should answer your last question, should you expend the effort to think about it carefully. You have a register (what makes it an immediate register?) and you'd like to store that in the accumulator. Well, you should now know how to do this in the opposite direction. How to go back? (Hint: I describe it in my earlier answer).
Ok I am trying. I have uploaded circuit please look this
load immediate data into accumulator
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,163
Have you read the datasheet for the 74HC194? What are S0 and S1 used for? Can you get the truth table for the from the datasheet? (Hint: There is at least one major difference from your schematic and mine, relating to these two inputs). Why did I connect them the way I did? There are three simple questions there. Please try and answer them all.
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
Have you read the datasheet for the 74HC194? What are S0 and S1 used for? Can you get the truth table for the from the datasheet? (Hint: There is at least one major difference from your schematic and mine, relating to these two inputs). Why did I connect them the way I did? There are three simple questions there. Please try and answer them all.
ok look another diagram
 

Attachments

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
What are S0 and S1 used for? Why did I connect them the way I did? Did you read the datasheet?
So and S1 are mode select Input. operation of device is determined by mode select input
when Both s0 and s1 low data is retained in hold . when both s0 and s1 high data is transfer to output respectively
 

Thread Starter

abhimanyu143

Joined Aug 25, 2014
211
This is like pulling teeth.

So why did he connect them the way that he did?
he did two pin grounded because we need only one select pin.

When the signal is LOW, existing data is retained in
a hold (“do nothing”) mode.
when the select pin is HIGH, data is transferred to the Q0 to Q3 outputs respectively,
I have attached pdf file
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,163
he did two pin grounded because we need only one select pin.
<snip>
I have attached pdf file
Look again, because I don't see "two pin[ s ] grounded".
Is this a language issue or have you misunderstood?
Since you could find the datasheet to attach, I can only hope you have read it.
I am starting to forget the question...
 
Top