8051 Instruction set

absf

Joined Dec 29, 2010
1,968
look at this link
there is diagram with RAM, ROM and 74HCT573 but there is no clue
Are you refering to the picture attached?

8051 simple computer.gif

In that schematic, The RAM and ROM are external memories which has to be accessed using MOVX command. Port 0 is holding the lower 8 bit of the Address and the Data lines D0-D7. That's why it needs the 74HCT574 to latch the A0-A7 for the external memories.

But in your previous posts, you were talking about the internal architecture of the 8051 which has internal 4K/8K flash depending on the AT89S5x part numbers.

Allen
 

Thread Starter

vead

Joined Nov 24, 2011
629
I am looking something about control unit of 8051 but I did not find any useful thing that help me to understand control unit of 8051
so I want to start with basics
I want to do logic design so anyone know simple way
If anyone want to help me anymore then I can explain small instruction set just for learning
i think If i have instruction set then I can decide how instruction will fetch decode and execute
then I want to learn how control unit make and other unit make from that Instruction set
 

kubeek

Joined Sep 20, 2005
5,795
Again you are starting from the wrong end. First decide that datapath, then the instruction set.
First make a circuit that can preform certain functions like load, store, add, substract, increment, etc., when you manually set the control signals in a specific way. Then do the instruction set and decoder.
 

absf

Joined Dec 29, 2010
1,968
I am looking something about control unit of 8051 but I did not find any useful thing that help me to understand control unit of 8051,
so I want to start with basics.
I want to do logic design so anyone know simple way
If anyone want to help me anymore then I can explain small instruction set just for learning
i think If i have instruction set then I can decide how instruction will fetch decode and execute
then I want to learn how control unit make and other unit make from that Instruction set
Here's a simplified block diagram of 8051 I got from the net. I added in the control lines in purple and colored the address bus in red and data bus in green.

8051_arch2.PNG

Imagine you have a 5 to 32 decoder, where the 5 inputs lines are connected to data bus D7-D3. Then you would have 32 outputs and let's call them Y0-Y31 for the time being. Your MOV instructions...

MOV Rn,#imm is opcode 78-7F, bin 01111rrr.........would use output Y15 with rrr being the registers R0-R7.
MOV direct,Rn is opcode 88-8F, bin 10001rrr.........would use output Y17 .......... do .........................
MOV Rn,direct is opcode A8-AE, bin 10101rrr.........would use output Y21 ...........do .........................
MOV A,Rn is opcode E8-EF, bin 11101rrr.........would use output Y29 .......... do .........................
MOV Rn,A is opcode F8-FE, bin 11111rrr.........would use output Y31 ...........do .........................

You then have another 3 to 8 decoder, where the 3 inputs are connected to rrr ie D2-D0 of the data bus. The 8 outputs would go to the /CS of the R0-R7 in registers bank 0. Together with other control lines that open or close the gates to/fro each functions blocks in the block digram. You can actually control the movements of data from one Function Block to another FB.

Allen
 
Last edited:

cmartinez

Joined Jan 17, 2007
8,254
Alright Vead... I think I FINALLY understand what your issue here is...

You are trying to learn digital design from the bottom up... from the very basic logic blocks all the way up to far more complex things like the 8051... right ???
Well, here's an excellent software that I discovered many years ago, (it's called Digital Works) and helped me learn all the basic stuff, and more.
This software already comes with some examples that you can tweak to your heart's desire. Plus, I have several designs of my own that I could send to you so you could explore some more, if you want.

Download this software and start playing with it... I guarantee it will be worth your time.
 

takao21203

Joined Apr 28, 2012
3,702
Alright Vead... I think I FINALLY understand what your issue here is...

You are trying to learn digital design from the bottom up... from the very basic logic blocks all the way up to far more complex things like the 8051... right ???
Well, here's an excellent software that I discovered many years ago, (it's called Digital Works) and helped me learn all the basic stuff, and more.
This software already comes with some examples that you can tweak to your heart's desire. Plus, I have several designs of my own that I could send to you so you could explore some more, if you want.

Download this software and start playing with it... I guarantee it will be worth your time.
He does have plenty of such softwares, but doesnt understand how register A "knows" it gets binary 11011110 moved from opcode after MOV and what is ALU control.

Why doesnt ALU bit not set?
 

absf

Joined Dec 29, 2010
1,968
I think vead is more ambitious than that.

He is trying to learn how the inside of a mcu works. So he can design his own microcontroller based on FPGA/CPLD using the verilog language. He has been exploring this subject asking plenty of questions in EDA, ETO as well as AAC.

Allen
 

Thread Starter

vead

Joined Nov 24, 2011
629
Here's a simplified block diagram of 8051 I got from the net. I added in the control lines in purple and colored the address bus in red and data bus in green.

View attachment 76111

Imagine you have a 5 to 32 decoder, where the 5 inputs lines are connected to data bus D7-D3. Then you would have 32 outputs and let's call them Y0-Y31 for the time being. Your MOV instructions...

MOV Rn,#imm is opcode 78-7F, bin 01111rrr.........would use output Y15 with rrr being the registers R0-R7.
MOV direct,Rn is opcode 88-8F, bin 10001rrr.........would use output Y17 .......... do .........................
MOV Rn,direct is opcode A8-AE, bin 10101rrr.........would use output Y21 ...........do .........................
MOV A,Rn is opcode E8-EF, bin 11101rrr.........would use output Y29 .......... do .........................
MOV Rn,A is opcode F8-FE, bin 11111rrr.........would use output Y31 ...........do .........................

You then have another 3 to 8 decoder, where the 3 inputs are connected to rrr ie D2-D0 of the data bus. The 8 outputs would go to the /CS of the R0-R7 in registers bank 0. Together with other control lines that open or close the gates to/fro each functions blocks in the block digram. You can actually control the movements of data from one Function Block to another FB.

This is what kubeek was trying to explain to you in post #21.

Allen
Is it possible ? can I use 3 decoders , I have doubt I think 8051 use only 8 to 256 decoder if this possible tell me I will create logic table
 

GopherT

Joined Nov 23, 2012
8,009
Yes, Vead has been asking about Microcontroller / CPU design and build for the past year or so. It has been painful to watch the various members trying to help a newborn drive a Grand Prix racer. It generally takes about 20 posts to understand the futility and the interest sputters out. Then he makes a new post with a seemingly unrelated topic and new fish to follow his bait.

He started with ion implantation - he is working his way back as he learns how much he doesn't know.

http://forum.allaboutcircuits.com/search/673925/?page=8
 

ScottWang

Joined Aug 23, 2012
7,400
Yes, Vead has been asking about Microcontroller / CPU design and build for the past year or so. It has been painful to watch the various members trying to help a newborn drive a Grand Prix racer. It generally takes about 20 posts to understand the futility and the interest sputters out. Then he makes a new post with a seemingly unrelated topic and new fish to follow his bait.

He started with ion implantation - he is working his way back as he learns how much he doesn't know.

http://forum.allaboutcircuits.com/search/673925/?page=8
The link was deleted or something wrong?
And I thought maybe he is not really wanting to learn from the basic, I just to check the old threads that I mentioned, they were all gone now, but yesterday still there.
 
Last edited:

takao21203

Joined Apr 28, 2012
3,702
I am not a fan of Wikipedia, however, most technology terms, bugs and vermin as well chemicals and political ideas, will yield a result. Each wikipedia article also has links which the unliterate knowledge seeker can explore.

Out of curiosity, I learned about all kinds of reactors, and related chemicals. It was interesting, while I wasnt stupid and uneducated about A bombs before travelling Wikip., some details really werent clear, or better say, my knowledge wasnt precise.

I wrote my opinion to vead before:

LEARN HOW TO LEARN.



Someone who is futilent against all attempts to teach him "How to learn" and who who replies:


Well sure. I studied the 68000.

It is indeed a 4bit controller, which runs a microcode, emulating a 16bit Instruction set.

The first 4 bits are the instruction group.

Inside the larger CPU, there is a smaller, simpler controller.


sorry But I am not getting something related to my question Its batter can you explain with small example ?


isnt neccessarily a fullblown troll, but denies to accept an explanation how a CPU actually works; insists the repliers walk him through his binary babbling and worry about WHY 5, 6, and 7 bits and it can haz ALU direct control without instruction decoding.

Its kindof trollish.

A CPU contains a smaller, simpler CPU, which isnt documentated to the outside user.
Thats pretty much it, all you need to know.

A PIC for instance always does 4 cycles....while the 8051 isnt that simple, probably its partially hardwired.

YOU DONT WANT TO KNOW...
 

hexreader

Joined Apr 16, 2011
581
@vead

You are making loads of wild assumptions about how 8051 works that are completely and utterly wrong.

It is hopeless to keep guessing about how you think 8051 ought to work. You are not even close to even an appreciation of how it actually works.

takao21203 made an excellent post #12 when he said:
Inside the controller, there is another, simpler controller, which you don't see, and which instructions set you don't know, so, you dont need to wonder about it.
.

Different manufacturers (on different days) may use different hardware and microcode to make an 8051 execute machine code as specified. As far as I know, there is no published schematic or microcode to show an example of how the control circuitry, instruction decode and control signals are implemented. .... and remember, there is no single way of implementing 8051 core, as long as the processor behaves how it is meant to at the end of the day. It may even be, that modern 8051 cores do not need microcode to operate, just logic gates alone - but now I am speculating and guessing :( .

If you really, really want to get an appreciation of how a processor works at the lowest hardware level, then my recommendation would be to spend a few years studying PDP11/04 detailed circuit diagrams, instruction set and the microcode programmed into ROM chips. PDP11/04 was developed so long ago that it uses TTL logic chips to do everything. By studying it's operation you can at least gain an appreciation of the kind of things that go on in a microprocessor/micro-controller core.

When you find the schematics for KD11-D processor board (as use on DEC PDP11/04), you will see that it requires a lot of convoluted logic and a huge microcode ROM just to implement a simple, early instruction set.

I have doubt I think 8051 use only 8 to 256 decoder
Wrong - wrong - completely 100% wrong! Stop with the wild guessing and admit that you don't know!
 
Last edited:

takao21203

Joined Apr 28, 2012
3,702
@veadWhen you find the schematics for KD11-D processor board (as use on DEC PDP11/34), you will see that it requires a lot of convoluted logic and a huge microcode ROM just to implement a simple, early instruction set.
A few years after leaving college, some day I bough a car battery charger, installed 7812 regulators on the backside, drilled holes into it and used them for 4mm sockets. Then I digged out the CMOS cookbook.

After reading, it was clear I dont want to copy schematics. I want to make my own circuits!
It was decided to build a LCD clock with 4000 series chips.

Among other things, it had a RESET sequencer- actually loading zero patterns into the registers, then enabling the clocking. A very simple microprogram. Building the circuit (I wired it with thick copper wire, didnt use a PCB, and I did make a frame from aluminium bars) took me about two weeks.

I knew, it was within my mental capabilities, and it would be possible to make it working. I learned a lot! But it was just the beginning.

No pun intended, vead, I think you should take off from where you are- learn to build a model plane + fly it, make another, better one- before dreaming about to construct a revolutinary JET fighter and repeat statements about its aerodynamics on public forums + express you dont really understand about it.

So this was an example how I learned, how I advanced, I think it was the year 2000.
 

cmartinez

Joined Jan 17, 2007
8,254
... he is working his way back as he learns how much he doesn't know.
Very interesting... some of us learn things the hard way. Backwards, that is... First we start with the spectacular apex of whatever subject draws our interest, and then we go all the way down to the basic concepts, sniffing medium-level stuff here and there in between, until a clear picture starts to emerge for us to contemplate and grasp in a rational way... Personally, I'm normally first attracted to a subject by it's glamor. GPS for instance... I like to understand how relativity plays a role when calculating and synchronizing the orbits of a group of satellites... But it seems that our friend's purpose here is to learn the how and why of every bolt and screw present in the rockets that launched the satellites in the first place... a noble, but futile, attempt. If you ask me. It would take anyone several lifetimes of unpaid hard work to reach that cognitive level...

But who am I to judge? I personally believe that one should never discourage a person's interest if it's good and genuine. That is the why of my chosen signature in this forum.
 

takao21203

Joined Apr 28, 2012
3,702
But who am I to judge? I personally believe that one should never discourage a person's interest if it's good and genuine. That is the why of my chosen signature in this forum.
Yes good reply. I dont say he's acting like a troll, just it could be seen in that light.

Maybe he's good at paying attention to some detail, sees a thing nobody else sees.

Result: Rocket doesnt explode on liftoff, Millions $ saved. Engineering people are not getting judgement in advance, even a good paper is no guarantee a large installation will ultimatively fail.

At some point, every engineer must demonstrate self-drive, the ability to start off something from zero, and oversee it until it is complete.

An engineer, or programmer, must be able to see the larger picture. Or you'd always remain a script kiddie, hacker, paid on hourly basis, and essentially, told what to do with little to none freedom.

Look i have maybe 5000 PDFs. Browsing them, I must ad-hoc decide whats important and what not. I cant go into math details, its not my strength, I can do calculus and most formula if need be, but I am not brilliant at it, and I know it.

I dont ignore details but often there is no time to examine 10000 pages with a fine comb. If a feature isnt present, it must be made present, emulated, the circuit patched, and thats possible in 95% cases. Kindof. If I dont have a 0.01% precision 1kW 380 volts resistor, I take some 1000 Watts Halogen lamps and wire them up, and adjust the voltage with a TRIAC. Kindof.

And there's the mechanical engineer, venturing into electronics, and insists 2 decimals after the colon are relevant, and I tell him, anything after the colon doesnt make any difference- he's going to calculate it with high precision, its just waste of thinking, waste of time. Overload the whole thing for a minute- doesnt matter actually :)
 
Top