Instruction set need advice?

Thread Starter

vead

Joined Nov 24, 2011
629
I have searched about Instruction set but I am confused I don't know what is concept how they make . I want to understand with example it's just for learning purpose
I have 2 bit ALU I have 5 instruction Add, Sub, AND , OR NOT . I choose 4 bit instruction word bit I think I need 3 control word bit I think operand will be 2bit because ALU is 2 bit and opcode will be 2 bit
instruction word bit 4 bit= operand 2 bit+opcode 2 bit

I am not sure I am going to correct way please help

how to make instruction set ?
 

GopherT

Joined Nov 23, 2012
8,009
A man once saw a log move down a hill by itself. It moved very quickly and smoothly. He realized that if he cut the log into short sections he could use the round-and-round movement to move other things. He initially just used a row of thinner logs and set his load on top of those segments. After He pushed his load a foot or so, the load would roll off of the last section of log - he then moved that free log to the front of the load and push some more.

He eventually figured that he could drill a hole in a slice of a fat log and fix the slabs to an axle. When he was just about done with his invention, his wife drove up with a new Honda.
 

MrChips

Joined Oct 2, 2009
34,810
A man saw his friend drive by with a new Honda. He was amazed and fascinated with its sleekness and beauty. So he decided to make one just like it for himself. So he went into the forest to find the perfect tree to carve into his new car. He is lost in the forest and we haven't heard back from him.
 

shteii01

Joined Feb 19, 2010
4,644
A man saw his friend drive by with a new Honda. He was amazed and fascinated with its sleekness and beauty. So he decided to make one just like it for himself. So he went into the forest to find the perfect tree to carve into his new car. He is lost in the forest and we haven't heard back from him.
That's... that's beautiful... that's poetry!
☺7
 

ScottWang

Joined Aug 23, 2012
7,501
I have searched about Instruction set but I am confused I don't know what is concept how they make .
...
...
5 instruction Add, Sub, AND , OR NOT
5 instructions, so you need 3 bit as:

Rich (BB code):
b2-b1-b0
 0    0   0
 0    0   1
 0    1   0
 0    1   1
 1    0   0
 x    x    x
 x    x    x
 x    x    x
 

Thread Starter

vead

Joined Nov 24, 2011
629
5 instructions, so you need 3 bit as:

Rich (BB code):
b2-b1-b0
 0    0   0
 0    0   1
 0    1   0
 0    1   1
 1    0   0
 x    x    x
 x    x    x
 x    x    x
I know this but what will opcode and operand ?

operand will be 2bit because ALU is 2 bit and opcode will be 2 bit
instruction word bit 4 bit= operand 2 bit+opcode 2 bit

Is it correct ?
 
Last edited:

ScottWang

Joined Aug 23, 2012
7,501
I know this but what will opcode and operand ?

operand will be 2bit because ALU is 2 bit and opcode will be 2 bit
instruction word bit 4 bit= operand 2 bit+opcode 2 bit

Is it correct ?
What is ALU?
Add, Sub, AND, OR, NOT those are the ALU can do, if the bits of ALU = op code, then op code = 3 bits.
If you only want to using machine code then it's ok, if you need to using the assembly or C then you have to creating the virtual code as ADD A,B or SUB A,B, etc..., and you also have to write the compiler for assembly and C.
 

Thread Starter

vead

Joined Nov 24, 2011
629
What is ALU?

If you only want to using machine code then it's ok, if you need to using the assembly or C then you have to creating the virtual code as ADD A,B or SUB A,B, etc..., and you also have to write the compiler for assembly and C.
Instruction word bit divide into OPCODE which specify Instruction type and operand which specify the operation of instruction

virtual code ADD A,B
What is A and B I think it is register we can say instruction like ADD , SUB but What is A and B . Is it operand or opcode?
 

ScottWang

Joined Aug 23, 2012
7,501
Instruction word bit divide into OPCODE which specify Instruction type and operand which specify the operation of instruction

virtual code ADD A,B
What is A and B I think it is register we can say instruction like ADD , SUB but What is A and B . Is it operand or opcode?
Did you see the 74HC181?

Try to read it first.
 

Thread Starter

vead

Joined Nov 24, 2011
629
Did you see the 74HC181?

Try to read it first.
I have read datasheet now what I do next ? Instruction set for any controller is very Important we can write code according to instruction set
Rich (BB code):
ORG H
MOV A, #5H
MOV R1, #4H
ADD A,R1
can you explain what is opcode and operand in programm
 

ScottWang

Joined Aug 23, 2012
7,501
The below is a test1.lst file that it show the opcode and operand.
opcode - operation code.
74,79,29 are the opcode.
5,4 are the operand
MOV,ADD are the virtual symbol, so they didn't show on the *.lst file.

Rich (BB code):
1   0000                   	           ORG 0H
2   0000                   	Start:
3   0000   74 05           	    MOV A, #5H
4   0002   79 04           	    MOV R1, #4H
5   0004   29              	    ADD A,R1
6   0005                   	nop
So you have to understand what the software opcode compare to the hardware 74HC181, you should spend more and more time to see all the structures.

http://forum.allaboutcircuits.com/attachment.php?attachmentid=66148&stc=1&d=1395317608
 

Attachments

Top