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.

how Program counter receive signal ?

Status
Not open for further replies.

Parth86

Member
hello ,

I need help,I am posting schematic. I hope someone will help me
upload_2015-1-8_21-37-16.png


blue - 10 bit address bus
black -4 bit data bus
red - I don't understand connection between pc and ALU?

I don't understand how how program counter know some the instruction (jump , branch , subroutine call )
I think mux is use for following
low address means - output of multiplexer should (0)
high address means - output of multiplexer should (1)
when address mux is ( 0) then this is end of instruction and pc incremented for next address
when address mux is (1) then execute jmp or branch instruction

I don't understand how does 10bit address load from 4 bit data bus ?
 
I haven't done much extreme low level CPU stuff myself, hence this is why I haven't commented on your progress... Its not that I'm not interested.. I just don't need to know that kind of information....

You will have found by now, When the documentation is scarce... You are pretty much on your own..

There will be a few people that can comment, but there will be less than that, that will be able to help much..

I found the building of the Motorola 68008 in the "Art of electronics" was as low as I needed to go....
 
I haven't done much extreme low level CPU stuff myself, hence this is why I haven't commented on your progress... Its not that I'm not interested.. I just don't need to know that kind of information....

You will have found by now, When the documentation is scarce... You are pretty much on your own..

There will be a few people that can comment, but there will be less than that, that will be able to help much..

I found the building of the Motorola 68008 in the "Art of electronics" was as low as I needed to go....
its ok '' Ian '' I know you always give your best.you always help me , thank you very much for your quick response.
 
Vead,
You can make your computer any way you want.
ideas:
short jump: SJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 128h, good for small loop. (only load low 4 bits of PC)

medium jump:MJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 180h, good for large loop. (load center 4 bits and reset low 8 bits of PC)
Bank change:BC:A
A=4 bit address. example, at address 123h, BC:8, now you are at 823h, large jump. (load top 4 bits of PC)

----------------------------------------
12 bit jump is hard. You will have to mux in a new register.
long jump: LJ:AAA
load temp 3:0, load temp 7:4, load temp 11:8 now load temp 11:0 to PC 11:0
A1, A2, A3 are 4 bit. This is a slow instruction.
---------------------------------------------------------
Jump +/- is common instruction. Mux in a simple 4 bit adder to PC3:0. You might be able to break in to RCO--ENP+ENT wire so the carry will work.
Jump +/-: J+-:A
A=4 bit signed. PC11:0 + A. Can jump back up to 8 locations or forward up to 8. Fast small loop.
--------------------------------------------
subroutine: A small computer like this might have a stack size of one. Can do GoSub. Can not do nested Subs.
You will need a 12 bit register that looks at the output of the PC.
On GoSub it will store the PC. (PC+1)???
On Return the output of the Stack register will be loaded into the PC.

GoSub Direct:AAA will be slow. Maybe hard to make.

GoSub Bank:A The address gos to PC11:8, PC7:0=0
GoSub:A sends you to page A location 0. GoSub:3 will sent you to 300h.
This will give you 16 fast locations for subroutines
-----------------------------------------------------
Some ideas from computers I used years ago. In these very simple computers, the instruction are a little strange because the goal is to make the hardware simple.
 
Vead,
You can make your computer any way you want.
ideas:
short jump: SJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 128h, good for small loop. (only load low 4 bits of PC)

medium jump:MJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 180h, good for large loop. (load center 4 bits and reset low 8 bits of PC)
Bank change:BC:A
A=4 bit address. example, at address 123h, BC:8, now you are at 823h, large jump. (load top 4 bits of PC)

----------------------------------------
12 bit jump is hard. You will have to mux in a new register.
long jump: LJ:AAA
load temp 3:0, load temp 7:4, load temp 11:8 now load temp 11:0 to PC 11:0
A1, A2, A3 are 4 bit. This is a slow instruction.
---------------------------------------------------------
Jump +/- is common instruction. Mux in a simple 4 bit adder to PC3:0. You might be able to break in to RCO--ENP+ENT wire so the carry will work.
Jump +/-: J+-:A
A=4 bit signed. PC11:0 + A. Can jump back up to 8 locations or forward up to 8. Fast small loop.
--------------------------------------------
subroutine: A small computer like this might have a stack size of one. Can do GoSub. Can not do nested Subs.
You will need a 12 bit register that looks at the output of the PC.
On GoSub it will store the PC. (PC+1)???
On Return the output of the Stack register will be loaded into the PC.

GoSub Direct:AAA will be slow. Maybe hard to make.

GoSub Bank:A The address gos to PC11:8, PC7:0=0
GoSub:A sends you to page A location 0. GoSub:3 will sent you to 300h.
This will give you 16 fast locations for subroutines
-----------------------------------------------------
Some ideas from computers I used years ago. In these very simple computers, the instruction are a little strange because the goal is to make the hardware simple.
Thank you for your explanation.
I have some question in my mind.

I am specially asking some questions about program counter. I want to make my work easier. I am struggling. I have read, program counter make with counter and multiplexer

what should I do to make simple program counter?
How to modify my program counter ?
what component I need to use in circuit (how many mux for PC) ?

I need some component (counter and mux ) that will make program counter. Its very good for me if someone help me to design basic program counter.
 
Vead,
I think you should change your ROM to 8 bit not 4 bit. 8 bit is more common. 8 Bit gives you more power.

It is hard to make two byte instruction work. (3 byte and 4 byte)
Jump, address Where jump is 4 bit and address is 4 bit in two instructions, this requires too much hardware and thinking.

Jump_address in one 8 bit word is much more simple. 4 wires to the instruction decoder and 4 wires go to modify the PC all in one clock.

If you look at the small PIC computers you will see the ROM output is 10,12 or 14 bits wide. This makes for easy hardware.
So in your case you can use two 8 bit ROMs. (It is OK for the data to stay 4 bit if you want) Now with 16 bits form the ROM you can make very powerful instructions. AND You can have large jumps (many bits). The most important part is that everything is one cycle.
 
**broken link removed**
**broken link removed**
Years ago there was a project at some universities (in FPGA class) to make a 6502 using logic. I don't know if you can find one of those projects on line. It is a simple computer.
 
Vead,
I think you should change your ROM to 8 bit not 4 bit. 8 bit is more common. 8 Bit gives you more power.

It is hard to make two byte instruction work. (3 byte and 4 byte)
Jump, address Where jump is 4 bit and address is 4 bit in two instructions, this requires too much hardware and thinking.

Jump_address in one 8 bit word is much more simple. 4 wires to the instruction decoder and 4 wires go to modify the PC all in one clock.

If you look at the small PIC computers you will see the ROM output is 10,12 or 14 bits wide. This makes for easy hardware.
So in your case you can use two 8 bit ROMs. (It is OK for the data to stay 4 bit if you want) Now with 16 bits form the ROM you can make very powerful instructions. AND You can have large jumps (many bits). The most important part is that everything is one cycle.
ok I have done some changes. there is some mistakes in my design just ignore him
Its just example
suppose
16 bit program counter ,
16 bit address bus
8 bit data bus
8 bit alu
1 of 8 multiplexer
upload_2015-1-9_9-53-29.png


what i need to do ?
 
One of the hairy things to realize is that the PC has to point to the NEXT instruction. How do I know? I designed as part of team of 3, a microcoded controller in the time period of the 8008 as part of a lab exercise. 16 bits x 16 words. Tiny, but it could sort 1-digit BCD numbers. The PC gets loaded as part of the execution of the current instruction. It gets strobed out on the next clock pulse. I did the Program Counter section.

This basically says, you can load the PC during the instruction. In my case, the new PC was 4 bits of the instruction. When it's absolute, it's a bit easier. when it's relative, it's a bit harder.
 
One of the hairy things to realize is that the PC has to point to the NEXT instruction. How do I know? I designed as part of team of 3, a microcoded controller in the time period of the 8008 as part of a lab exercise. 16 bits x 16 words. Tiny, but it could sort 1-digit BCD numbers. The PC gets loaded as part of the execution of the current instruction. It gets strobed out on the next clock pulse. I did the Program Counter section.

This basically says, you can load the PC during the instruction. In my case, the new PC was 4 bits of the instruction. When it's absolute, it's a bit easier. when it's relative, it's a bit harder.
hello ,
forget all things and tell me , about following concept

* Increment PC
* load PC from data bus

I am using 4 counter with 1 multiplexer (look post #10)
when mux 0 - increment PC
when mux 1- load pc from data bus

If I use another multiplexer we can divide in different Address
 
Vead,
You can make your computer any way you want.
ideas:
short jump: SJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 128h, good for small loop. (only load low 4 bits of PC)

medium jump:MJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 180h, good for large loop. (load center 4 bits and reset low 8 bits of PC)
Bank change:BC:A
A=4 bit address. example, at address 123h, BC:8, now you are at 823h, large jump. (load top 4 bits of PC)

----------------------------------------
12 bit jump is hard. You will have to mux in a new register.
long jump: LJ:AAA
load temp 3:0, load temp 7:4, load temp 11:8 now load temp 11:0 to PC 11:0
A1, A2, A3 are 4 bit. This is a slow instruction.
---------------------------------------------------------
Jump +/- is common instruction. Mux in a simple 4 bit adder to PC3:0. You might be able to break in to RCO--ENP+ENT wire so the carry will work.
Jump +/-: J+-:A
A=4 bit signed. PC11:0 + A. Can jump back up to 8 locations or forward up to 8. Fast small loop.
--------------------------------------------
subroutine: A small computer like this might have a stack size of one. Can do GoSub. Can not do nested Subs.
You will need a 12 bit register that looks at the output of the PC.
On GoSub it will store the PC. (PC+1)???
On Return the output of the Stack register will be loaded into the PC.

GoSub Direct:AAA will be slow. Maybe hard to make.

GoSub Bank:A The address gos to PC11:8, PC7:0=0
GoSub:A sends you to page A location 0. GoSub:3 will sent you to 300h.
This will give you 16 fast locations for subroutines
-----------------------------------------------------
Some ideas from computers I used years ago. In these very simple computers, the instruction are a little strange because the goal is to make the hardware simple.
hello ronsimpson,
as you said
short jump: SJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 128h, good for small loop. (only load low 4 bits of PC)
medium jump:MJ:A
A=4 bit address. example, at address 123h, SJ:8, now you are at 180h, good for large loop. (load center 4 bits and reset low 8 bits of PC)

assume we have 16 bit program counter. how to implement circuit using logic Ic. ?
 
Relative jumps are usually +- something from the program counter.

It really doesn't matter how you mess with the program counter because it can only be used on the next clock cycle. You can think of it as, "the new program counter will be". It' so much easier to "microcode" the instruction set. i.e. the microcoded instruction set could be 128 or even 256 bits wide. That gives you the ability to tweek the various operations than need to be done with logic.

The addressing modes are probably the hardest to implement.
 
hello sir

Mr. ronsimpson told me following example
short jump: SJ:A -----> (only load low 4 bits of PC)
medium jump:MJ:A----->(load center 4 bits and reset low 8 bits of PC)
Jump +/- is common instruction

I think we can keep some bit high or low using multiplexer.
suppose we have 16 bit counter
can we start to make PC that will do only short jump and long jump.so First I have to make circuit for short jump and long jump, After that I will add circuit for Branch instruction
how many multiplexer I need ? which bits of PC should be High and Low ?
 
Take a look at this datasheet https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CCgQFjAB&url=https://datasheets.chipdb.org/RCA/MPM-201B_CDP1802_Users_Manual_Nov77.pdf&ei=X4mvVOiiD8u_ggTy4oKIAg&usg=AFQjCNGyEVZLUkaqBJvZs6Bs4WfaNlUGTg&sig2=vnzTtSIBW3R9b-vOQVwOPg&bvm=bv.83339334,d.eXY&cad=rja for an OLD processor (1802) I used in the past. The cool part is that every instruction is defined.

the BAD part is that there is no GOSUB instruction in this architecture, however any register can become the program counter. The program I wrote for it, I hand assembled everything - The PC barely existed then. The first thing I wrote was to implement GOSUB.
 
Typically, say 8 bits could be used for +127, -128 branch which is 8 bits.

if you had a 16 bit program counter, you have to sign extend the 2's complement notation of 8 bits and then add to get your new program counter.
1111 1111 would be -1 in 8 bits if I remember right. 0000 0000 1111 1111 is not -1 in 16 bit 2's complement notation. To sign extend it to 16 bits, you would have 1111 1111 1111 1111. The sign bit (left most) just gets replicated. You would then add to the old PC to get the new program counter.

Sign extending means the sign bit gets replicated to fill out say the 16 bit PC.


I
 
Typically, say 8 bits could be used for +127, -128 branch which is 8 bits.

if you had a 16 bit program counter, you have to sign extend the 2's complement notation of 8 bits and then add to get your new program counter.
1111 1111 would be -1 in 8 bits if I remember right. 0000 0000 1111 1111 is not -1 in 16 bit 2's complement notation. To sign extend it to 16 bits, you would have 1111 1111 1111 1111. The sign bit (left most) just gets replicated. You would then add to the old PC to get the new program counter.

Sign extending means the sign bit gets replicated to fill out say the 16 bit PC.

I
I understood the meaning of Sign extending.but still I don't understand how to make simple PC

I think its best If I make circuit than I ask some specific questions
so lets talk about this circuit. I want to make my work easier. I want to learn step by step.
how to modify the circuit for program counter ? I want to modify circuit for short jump and long jump. what I need to add with following circuit

upload_2015-1-10_2-19-3.png
 

Attachments

  • upload_2015-1-10_2-4-14.png
    upload_2015-1-10_2-4-14.png
    60.3 KB · Views: 275
  • upload_2015-1-10_2-9-29.png
    upload_2015-1-10_2-9-29.png
    44.9 KB · Views: 250
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

Back
Top