Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Jump and branch Instruction ?

Status
Not open for further replies.

Parth86

Member
Hello ,


load ,store, move Instruction :- we need Accumulator , register and memory to execute this type of instruction

arithmetic instruction :- we Need ALU to execute arithmetic Instruction example :add, sub, mul, div

Logical instruction : - we need ALU to execute logical instruction example AND, OR

How does Jump and branch instruction execute?.

I don't understand which circuit we need to execute Jump and branch instruction ?
 
For jump, load the program counter with a new value.

For branch, use the ALU to do a signed add of current program counter value with signed offset value.

At least, I think that this is how I would do it, but I have not ever designed a CPU for myself, just seen how mini-computers used to do it. Modern RISC devices may do branch differently
 
Usually the program counter already has an adder inside it so that it can increment, so your relative jump would modify that to enable it to jump a few adresses from the current address. For a long jump you simply load new address into PC.
Branch instruction needs something to decide whether it should branch or continue to next instruction, this is usually based on some bit in status register, the simplest being zero flag which is zero when the result of the last operation was zero.
 
Jump all the time.
Jump if Carry bit=0, if not go to next instruction.
Jump if Carry bit=1, if not go to next instruction.
Jump if ________, if not to to next.
-------------------------------------------------------------
You have a loadable counter. There needs to be a wire that (address=address+1) or (load new address).
That wire comes from a mux that looks at some conditions. (carry, ffh, zero, odd, even, always , never, etc)
 
suppose I have 15 address line and 4 data line
upload_2015-1-12_20-46-40.png


what Extra circuit I have to Add with that circuit to execute jump and branch instruction ?
 
Usually the program counter already has an adder inside it so that it can increment, so your relative jump would modify that to enable it to jump a few adresses from the current address. For a long jump you simply load new address into PC.
Branch instruction needs something to decide whether it should branch or continue to next instruction, this is usually based on some bit in status register, the simplest being zero flag which is zero when the result of the last operation was zero.
ok I have to make loadable Pc that will load or increment. I have to select its branch instruction , jump instruction , its call instruction or subroutine instruction, can I use 4 input multiplexer to select jump, branch, subroutine , next instruction?
 
Why four? What is the difference between jump, branch and subroutine from the standpoint of a PC?
 
Why four?
I know how data transfer , arithmetic and logic instructions fetch , decode and execute. I have rough architecture
Now I want to know how does jump , branch instruction fetch decode and execute.

when I look 8051 architecture I don't understand how jump , branch instruction fetch decode and execute. that's why I want to make basic architecture for these instruction.

What is the difference between jump, branch and /QUOTE]

during jump instruction , program counter loaded with new address. program execution continue from new location in memory

during branch instruction , program counter loaded with one of multiple new value.
 
Last edited by a moderator:
during branch instruction , program counter loaded with one of multiple new value.
No, branch is almost the same as a jump. The only difference is that branch checks some condition. If the condition is true then the jump is executed. If it is false then the branch instruction is ignored and in the next cycle the code continues with the next instruction in row.
 
No, branch is almost the same as a jump. The only difference is that branch checks some condition. If the condition is true then the jump is executed. If it is false then the branch instruction is ignored and in the next cycle the code continues with the next instruction in row.
anyway e I want to make block diagram that will do following function
1)loadable program counter
(address +1 ) or (new address )
2) Jump If Accumulator is zero if not then execute next instruction
3) jump If accumulator is not zero if not then execute next instruction
4) jump if register R is zero if not then execute next instruction
5)jump if register R is not zero if not then execute next instruction

I am not sure this example is enough for learning. I just want to make small one I don't understand where to start ? what I need ?
I am just taking different example for basic understanding. I just want to make block diagram

I don't understand 8051 architecture . its more complicated for me
can you please tell me how to make loadable program counter ?
where to start ? what I need ?
I just want to make block diagram
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top