 We will saw in the last class different different building blocks of microprocessors ok. The combinational logic circuits, the sequential logic circuits and we saw also memory and its addressing hm. So, in this part now we will start putting together everything to construct a microprocessor. We will start off with some small primitive microprocessor construction and thenwe will look at how these instructions are executed inside a microprocessor ok. So, we we have in the last lecture we have seen the operation of transfer of data from external register to the memory ok. What are the sequence of things that have to be happening for different different pinsthat will carry out that operation ok. Now, how these operation can be done by using some kind of a timing and control circuit we will introduce that here and then proceed for like introducing more and more kind of a you know functionality to this microprocessor and get a glimpse of what how things are happening inside ok. So, here the idea is to kind of introduce you to the basic fundamental understanding here for the timing and control circuits and the basics of microprocessor instruction sets and things like that architecture instruction sets everything yeah. And then based on this you will be able to understand the modern microprocessors and microcontroller data sheets in much much kind of a better fashion ok that is howwe have you know introduced these lectures here ok. So, we will proceedwith first with the the example we saw in the last class. So, you just recall this that you know we had this sequence of operation to be performed for getting the data from the external register A now to be transferred to somememory location where the that memory location is indicated by this address which is on the address bus here and that address is stored in this register called MA. So,the sequence of operations would go something like you know you need to have thisoutput enable for MA going high which will take the data from this register and put it on the address address bus. So, when the the data the address bus has some kind of a data that particular location in the memory will be addressed now. And thenyou want to make this enable this chip select and you know this so that this this particular write operation is is is enabled and then we have this valid data to be there on the data bus and then this operation this writing of this data here will be done. So, how do you get the data on the data bus to same way like now you made output enable pin high and then the data from the register A will be now available on the data bus ok. So, this will be captured in the timing diagram as we have seen in the last class in this kind of a passion ok. So,you see that here this is output enable formemory address and then there is output enable for a data register. So, so you know that now these are the like numbers some kind of a sequence that is there in which the operation needs to happen. How would we get this operation done now by by some kind of a circuit or logic circuit ok. So, we make use of some sequential logic for this. So, let us understand first you know suppose you have some different problem given here ok. So, how do we generate the sequence of this pulses which will light this bulb first then this will light this bulb and then like this bulb and this bulb like that it should light in a sequence like S 1, S 2, S 3 and S 4 ok. So, so they they need to be on for a while and one once S 1 goes off S 2 should get lit up ok that is what we want to do. So, how do we do this ok. So, if you just scratch your memory little bit and see our sequential logic circuits which we have seen there is one example there which will help us here. So, if you recall thing and then proceed ok. So, yeah it is a ring counter ok. So, so this in the ring counter you introduce this sequence like you know 1 0 0 0. So, this state is 1 here which will I introduce all others are 0 and then in the next clock cycle that one will come here and then in the next clock cycle it will proceed here and if you have this feedback which is coming like you know. So, this is continuously this sequence will go on in a loop 1 0 0 0 0 0 1 0 0 0 1 0 0 1 0 and 0 0 0 1 it will happen for S 1, S 2, S 3, S 4 in a loop and that is what we want for this lights to be lit up in a sequence ok. The timing diagram for this such kind of a case will look something of this sort ok. So, S 1 is lit up first then S 2 is lit up after that once S 2 goes off then S 3 is lit up and S 3 goes off S 4 is lit up and again S 4 goes off S 1 is lit up again ok and then this this continues in the in the clock ok. So, now if if you want to you make use of this sequence to realize this data transfer operation for external register to the memory that is what we are talking about. So, we see the see the timing diagram again carefully for the operation that we want to do and then now we put this S 1, S 2, S 3, S 4 in some some kind of a time sequence here ok S 1, S 2, S 3, S 4. So, so there are these four kind of a timing zones which we have mapped here and in that like we know S 1 will go high first then S 2 will go high then S 3 will go high and then S 4 will go high this is what is going to happen in time for for us now ok. So, now how do we use make use of this S 1, S 2, S 3, S 4 going high in a sequence to execute like what we want here. So, remember our inputs are these W A, C S and address bus and output enable ok. So, these are the inputs which we need to provide some kind of a proper signals to this input. So, that our operation happens in a way that is governed by this timing diagram ok. So, let me get a pointer right. So, now, think about this ok what we we need to do ok. So, this combination logic we can use on S 1, S 2, S 3, S 4 to produce this appropriate output which can be connected to this O E pin here or O E pin here or C S pin and W E pin here ok that is what we want to do ok. So, how do you think about. So, say if you go back and see your S 1, S 2, S 3, S 4 all 4 cycles this address bus has valid data which is coming from making O E for the memory address to be high ok. So, we we are this inputs S 1, S 2, S 3, S 4 they are odd with each other to produce some output that output will be connected to to this output and input of memory address. Then all the sequence all S 1, S 2, S 3, S 4 durations your memory address will be holding the address bus will be holding valid address ok. So, that is how we can think about. So, like that you think about for other pins what is a combination of S 1, S 2, S 3, S 4 to be used and then proceed. So, you can see now that this circuit is going to look something of this sort ok. So, you have S 2, S 3 connected with OR gate here S 3, S 4 connected with OR gate here and then you see that in S 2, S 3 sequence S 2, S 3 sequence you will have this this will be S 2 and S 3 sequence like this will be happening S 2, S 3 are here. So, this part will be happening ok. So, this will be done to the chip ok and S 3, S 4 sequence you will have this valid data here ok. So, so one can see that by using simple kind of a like that the sequence of pulses going high one after other and some kind of a combination of these those pulses in the in the in the combination logic way we can achieve the task that we wanted to do ok. So, this is one of the task that we we had now the the question is like many such tasks can be performed now one can see that easily ok. So, we can put together many different different kinds of elements ok as whatever whatever we have seen combination logic elements adder comparator or this many different kind of possibilities are there ok and many sequential elements also can be there and then we can put together all these to build now our microprocessor unit ok. So, how do we this work with regular we will see with the example ok. So, so we want to have a microprocessor which will consist of some temporary registers ok and some memory then you can put in some combination logic circuits to do some some additional addition subtraction operation logic output operations ok all those kind of things can be put together and then we will need a timing and control circuitry the way we had these four pulses coming up you know similar kind of a timing and circuit to execute this desired task ok. So, we will see one with some example of actually put together this ok. So, this is a primitive microprocessor architecture that is shown here. So, see this microprocessor architecture or microcontroller architecture will typically given in such kind of a diagrams and these different different registers there is a data bus then the registers will have some functionality that is given in the data sheet of the microcontroller. This data bus this kind of a thing tells you that the data from this register can be written and read also ok, but in the register t the data is can be only given as a input one cannot read the t register like that you can read this kind of a diagram ok. And you have a memory small memory available in the microcontroller this memory address register holds some kind of a address and then one can address this memory ok something is there then you have some this is only adder here. So, this adder is taking value in the register t and value in the register a l and this is adding together and this value is available in this register and when you this put this output enable pin high for this register then that added value will be available on the data bus things like that. So, you can have only this one way kind of a direction coming in the data is coming on this data bus you cannot write in this register otherwise ok like that some kind of understanding can be built for by use by reading such a kind of a diagrams. Similarly, you will find this kind of diagrams in many modern kind of a microcontroller data sheets and one you should kind of figure out have a ability to figure out what is diagrams really mean. So, that can be done now with this understanding that we have done so far and by reading the data sheet of the of that microcontroller ok. So, let us proceed with the with some some operations here now ok. So, this is our understanding of this microprocessor and suppose we connect now some signals like you know same S 1, S 2, S 3, S 4 in this fashion ok and I tell you now can you just guess for such a kind of a diagram what is the operation that will be happening ok. So, read this carefully like how this S 1, S 2, S 3, S 4 are connected to this and they are going in the same sequence high ok. So, S 1 will go high first then S 2, then S 3 and then S 4 ok. So, you can pause here for a while and figure out like you know little bit at least to think about what will happen in S 1 sequence for example, what will happen in S 2 when S 2 goes high hm. So, like that you can think and then you can proceed we will go one by one in the in the understanding ok. So, let us say S 1 goes high ok. So, when S 1 goes high the contents of this register MA ok which are always there on the. So, so see this this has no output enable nothing. So, this is always connected to this memory. So, contents of memory register this memory address holding register will be available on the address bus there that is there for always. Then when S 1, S 2 goes high this S 1 goes high in this thing that then that this chip select will happen here and then this memory will be selected ok. Now, this memory is getting selected and then the data from this will be available on the. So, the data from this will be available on the on the data bus ok. So, data which data is available data which is at the location which is governed by this address here that will that data will be available on the on the data bus ok. Then then what will what else is happening that data is this this is right here ok. So, when S 1 goes high that data is also getting written in the in the register T ok. So, the data will be fetched from the memory location and it is given to the register T. So, there is a clock that is kept here ok to make sure that you know this clock signal is is is given along with S 1. So, S 1 you remember it is half this S 1 is goes high for a full clock cycle and this when it is ended with the clock this output will be only half cycle up ok. This is done to kind of make sure the there is no clash of the data or the the the right operation is completed well before like you know this the data gets invalid on the data bus. So, that there is no clash of the data. So, some some some integrities of that sort are or are done which you do not need to really bother about ok. So, now let us see what is happening in S 2 ok. So, that is what we saw why do we need and get here and then yeah. So, now, when when S 2 goes high you can see S 2 is here and S 2 is here ok. What is happening here is again something is getting written here ok. What is getting written? So, you see this is output enable for this A register. So, that is going high this is OR gate that is going high that means, data from register A will be available on the data bus now ok. So, you see the data bus is same data bus is shared in in all different registers and memory and so on and so forth ok. So, the data from A will be available on the data bus and it is written in which register now it is written in the AL register ok. That is is happening in the in the second part of the sequences 2 ok. So, so you remember the first part the data from the memory was available here was transferred here. Now, then the second part like the data from the register A is going to get transferred here. Then what will happen in 3? S 3 goes high you see that this data from this this is now added together this is a data which is data in the register T plus AL will be added together and that data will be available now on the data bus ok. Now, we register that data is written their data is written in in in register A again. So, whatever was previous content it is overwritten and like know that addition will be available here ok. Now, that is what is done here and then what is happening in the S 4 sequence you take this data which is from from S 4 register now it is put again on the data bus and in S 4 it is now right enabled and like the data is is written to this memory ok. So, so this how like know typically you can you can see that the the sequence of operations is going to happen. Now, some integrity is that we need to figure out and then things thing like that, but this is this is giving you some kind of a sense of this is how like you know some things connected together this some operations can be performed and we know that these operations are has not great meaning here ok. So, one can have the summary of these operations which are achieved in different different state, but you can see that ok this some kind of a successive addition is performed here on some data, but it is not a greatly meaningful kind of a thing ok. And also suppose we have this microprocessor this will be only doing this there is no other command that is to be we cannot write any command that saying that ok this is my my program and I want to have like know something done like that or I have to want to have some instruction set which will which will control this kind of operation nothing like that is there right now ok. So, we want now to have such a kind of a facility we we build some more stuff in the in the thing ok. So, so we we we add some more registers to our primitive microprocessor and like know look at some more operations with this microprocessor too ok. So, this is a microprocessor which is having now like know a lot more number of registers, but still that additional addition ALU is there. So, there is there can be many different you know logic elements that can be used in ALU to arithmetic logic unit to kind of perform many many different operations. One can now guess that you know this very easy to see that ok we can have lot of things put together in in our ALU. You can have some some counter or other kind of a things also put as a part of this microprocessor unit ok. So, now what we we need to introduce here is is we have like notice here we have introduced some some register called PC register is like a program counter register ok. So, this will keep track of which instruction you are you are running at present ok. So, you have some sequence of instructions that are typically written as a program that is that is what you write when you write a program right. You write some first command line second command line like that you write this and one after other they get executed ok. So, so this program counter register is special register which will keep keep track of that count ok that it will it will fetch the instruction first whatever that you have written that program it will fetch that instruction and it will like know put that into instruction register is other kind of a facility that is there. This is a special register. So, these are all there are some special registers having some special functionalities in the in the in the microprocessor. So, so typically you will have this kind of a not all registers can be accessed by a user. This is a typical very typical for any microprocessor. You can address say for example, this program counter register you cannot write anything into that ok. You can just read from the program counter register to to see like that you will have in in every microprocessor some kind of a special registers will be there and every registers will have a function some functionality and that functionality will be written in the part of the data sheet. You do not need to guess from just this diagram. The diagram is helps you to kind of guess some of the aspects, but rest of the thing can be read from the so, read from the data sheet of the microprocessor. So, there is there is this other kind of a register which is typically will be there now it will have this you know memory address holding register. From that register that address can come on the address bus and that particular like location in the memory will get addressed ok. So, this is some kind of a description or understanding of this diagram ok. So, you can pause it and read through and understand little better if it if at all you need to be. So, now the there are some questions that we can raise now ok. So, so, so these are like some kind of a special registers and how these registers would work is what is get gotten here. So, we do not worry about. So, what we want here is special functionality to this register we want the data from the data bus transferred to MA ok. So, some data from the data bus can be transferred to this register ok, but you cannot read and transfer any data from this register back to the data bus ok. And that that that data will be transferred to the address bus when the output enable is is. So, this functionality is is needed can you guess why this functionality is needed. See we have written some kind of a program and some memory locations ok. So, when we execute we need to give microprocessor location from where you want to execute that location when you give that location will be the starting point for this memory address register to hold ok. And that address will be there on the address bus and then that address can be transferred to the address bus and then your your you know your address bus is pointing to that particular location failure program is written in memory. And now that first command that you have written in the from the program that can be now fetched from from this data bus fetched from this memory and gotten onto the data bus and transferred to this instruction register ok IR. These are the so, this this register will typically not see for a user to be accessed ok. So, we are giving this here to just to give you some glimpse of how things are happening inside ok. So, this register you will not be able to see or you know many times they will not even kind of put them in the in the architecture ok, because the user is not concerned with those registers too much ok. So, now the question is we would like to have this facility to code or program and that that say some some instructions are written some memory locations and we would like to have these instructions to be fetched as I said from the memory and given to this register IR. And now from IR like now they will be taken and executed in some way ok. So, let us see that how things happen little bit in more detail. The say say program counter is holding first memory location and so, this program counter if you see is maybe here you can see. So, program counter is holding that you know first memory location ok. So, that program counter will be now holding the starting point that starting point address will be transferred to the data bus from there it should be getting to the memory address register and then it will be available on the address bus. The moment this is executed then second address this program counter will update like know it increment by 1 and then second memory address will be there here. Then again it will be taken here from here it will be transferred to this and again it will be executed or this it is be addressed and then the second line of your command or program will be second command of your program will be transferred to the instruction register and then it is executed like that is this this this sequence will continue further ok. So, now we will now create this kind of a brief notion for the for the instruction. So, PC to MA what is means like know contents of this register PC are transferred to MA. So, for that lot of operations are to be done before. So, the way we said ok external location some you know some data holding external location to be transferred to the memory. Now, this is just transfer from one memory one register to other register there is no memory involved here ok. So, so program counter transfer some you know data to memory register ok. So, we now see that this this other instruction that we want to see the memory address will be given by this program counter register which is now holding the memory address that is pointing to some memory location and the data from that memory location needs to be fetched and transferred to the IR register. So, this this will indicate briefly as you know M is for stands for memory memory which is like you know pointing pointed by this memory address register that particular kind of a location whatever is there is to be transferred to IR register ok. This is how we represent this small small commands and then PC is is incremented ok. So, program counter needs to get incremented ok. So, these are like you know small small brief briefly we will write these commands ok and now we we do not worry about how like you know this this will happen actually. So, let us kind of skip through this part how the program counter is function to do some some things that are described ok. So, let us not worry about this part here this is more like how do you digital circuit we will design about that ok. So, these are more details about how the program counter is made to function the way it is there ok. So, so these are the operations that we said which should happen. So, program counter content should go to memory address register and then whatever is addressed by that register to the memory that location of the memory we contents of that location in the memory we transfer to IR register and then we update these are the this is the sequence of operation should happen every single command that we execute ok. So, irrespective of any additional operations that are to be done and then we can have these additional operations that move B to A or some kind of a operations that we can add to this sequence ok. And now we want this thing to be executed in some kind of a way the by using this you know some kind of combination of the states or combination of the you know some of this each of this can be designated as a as a state ok. So, so we will see how this operation can be executed in a in a. So, this is a example of another kind of a command ok. So, this is so these three are common and then now contents of A are to be transferred to be to AL register contents of B are to be transferred to the D register and A should again hold addition of L and T which is given by ALU arithmetic logic unit. So, this is another command that we have built up ok. So, we are we are kind of building these commands now ok this is a command one where like you know this just moving of contents of A from A to B happens and then like there is a second command ok. So, we want to see like how these commands can be finally executed ok. So, we create this kind of a you know table in which like you know we have this commands which are now called mnemonic ok. So, these are like a assembly language kind of a commands ok. So, typically this is a way this is syntax that will be used in the assembly language for for moving some data from one register to other register add as something to the register like that you will have this different different kind of commands that will be possible ok. So, say for this first command we want like you know this this is a like a micro instructions that are called. So, whatever this we say ok PC to MA you know this is a micro instruction. So, this micro instructions are typically which are can be completed in one kind of a clock cycle ok and you have like no second instruction say micro instruction third micro instruction like that three micro instruction are the required for executing this one single command ok. So, this is your command and then there will be some code associated with that command ok. So, we do not need to worry about this code here ok. This code will be used by this IR register to actually execute this sequence of things and how that happens we will get some glimpse of it, but we will we will we will not get into too many details about it ok. So, so these are the three kind of a seek operations to be happening one after other for a first command like that you can have the second command operations ok and the the what it does here result and its code. So, typically these are the things involved in in every of your instruction set. So, this this assembly language is is one of the fundamental kind of a language for the instruction your each micro controller will have its own instruction set and it will produce some kind of a instructions or some commands it will be mentioned there and that this commands will get executed by using this kind of a micro instructions typically ok. So, so you are just getting a small glimpse of of that ok. So, this is a second command that we have generated then some kind of a third command I am I am generating here. So, we will not get into too many details about how these commands are how what are these operations and things like that. What we want to see is that every command that or every instruction that is issued in micro controller or microprocessor will have this some set of micro instructions to be executed and they are they are executed by using some kind of a timing and control unit ok. So, all these micro instructions together you can see that we we want now only like know we will add this S 1 S 2 S 3 we have said here, but S 1 S 2 are common because these micro instructions are common, but S 4 S 5 S 6 are new kind of a micro instructions. Like that you will identify like know every command whatever you want to want operations to happen for that command you know we will add these micro instructions to the set and all these micro instructions form like know this distinct kind of operation that are to be performed. And now these operations can be say up to here when we come there are 11 kind of states that that we get distinctly here ok. So, these 11 things these are like remember these are to be executed in one clock cycle kind of a thing the way we had executed S 1 S 2 S 3 S 4 in our previous example. The same way this will happen now the logic will be little more complicated and and more involved ok. So, we will just get a small glimpse of that. So, these are like 11 kind of a distinct operation which are kind of called the states here. And now we want to have this states executed in a in a one particular kind of a way when command 1 or command 2 is issued ok. So, we have these 4 commands that are defined for this microcontroller and we want to execute whatever commands that is written by the programmer ok. So, but then when they when this command is issued then this this operation should happen is what we want to make sure. So, we start generating a state diagram which is now dependent upon the the instructions that that that are there 4 instructions that we have. So, so, S 0 S 1 S 2 will be instructed it will be executed anyhow ok. Then S 3 will be done only when the the command issued has some particular format or this is a command which is having code 0 0 ok. So, we start drawing this kind of a state diagram from here saying that ok S 1 S 2 S 3 are same states I will go from S 0 to S 1 to S 2 and then I will go through go to S 3 only when I R is equal to something ok. Like that we will start drawing the complete state diagram. And then we we will start connecting the signals ok. So, so, this signal connection again can be seen in a in a way that you know you want to have these operations to be done ok. So, this is kind of very easy as as similar to whatever previous example ok. So, we have the signal connections signal is a states identified and for each of the states now we will do this kind of a signals connection to to do this task ok. So, now whenever like you know this S 1 S S 0 goes high this part will happen. When S 2 goes high for example, this part will happen ok that is going to happen you can check it here ok. So, so, one can construct that very easily and then what we want here is now the the loop the state diagram to be generated for these instructions to happen ok. So, say for example, S 2 when this happens like you know this S 2 is here S 2 is here S 2 is here you can see that you know this this this will get executed when S 2 is going high ok. So, so, what we have done is so far is identified these states and each of the states when it is to be executed what is to go high and low in the in this connection we have done. And now we we will see what is how it is to be executed ok. So, so, for that we we saw like know we will use this kind of a timing and control unit here. So, we had previous unit way which is which has simply to go through S 1 S 2 S 3 S 4 that is it. But now here we we want to have this control way given by this IR this as I was saying before that ok S 1 S 2 S 0 S 1 S 2 are executed anyhow, but S 3 we should go only when IR has something ok. So, so, we start writing it as a state diagram ok. You remember our sequential logic we developed by using state diagram. So, this is how we develop this diagram ok. So, when IR is this from 2 you go to 3 and then like know you go back from otherwise like know for this IR is something else you go through these different states. Then again like know you have some some kind of a way this is like you get this sequential logic diagram done. And then you can execute this logic by using your you know. So, each of these states will have one D flip flop selected and we can start connecting things together. And we add on with the D flip flop. So, some more kind of a logic elements to to get this executed. So, I will not get into details of that again we will just directly see the see the final result here ok. So, you can pause and go through some of these things more detail if you want to later ok. So, this is how this final circuit is going to look like ok. So, so, this we we generate depend upon instruction we use decode the instruction and get say this this pins high. And when these pins are high then like know the sequence of operation is going to run according to the state diagram that we have seen ok. So, this is like a complete picture of the stuff ok. This is not typically you will not get to see this in the microprocessor data sheet. What you will see is only the architecture that ok this has this registers and registers have this functionality. How it happens you know you do not have to bother about. So, this is like a complete picture of a typical microcontroller execution operation execution that happens in the in the microcontroller. And of course, there will be then lot of other facilities you can have additional registers put together for getting this for loops while loops and then storing something you for temporary that you know stack and other kind of registers can be introduced. So, so, once you have this base understanding of how things are happening then all the other things can be imagined very nicely how they would have been happening there ok. So, so, this just summary of this whole thing whole processor of this you know 4 lectures on microprocessor that we have done to get all the basics very very nicely understood here. And this understanding will help you read through the data sheets of microprocessor very easily. So, so, we have these instructions these are called typically assembly language in instructions ok. And each of these instructions will consist of several micro instructions and each micro instructions will tell you ok that much time will be taken for. So, so, if you have 3 micro instructions to done this then 3 clock cycles will be needed to execute this. So, you can get also some sense of how much time will be taken to execute my my command ok. And this machine language or assembly language is what is called this instruction set is termed as ok. And this is how like see you write a program in C or any other language you know it is getting when it compiles ok what that compiler does is basically converts all your higher language stuff into this assembly language instructions and then executes that assembly language instruction the way we saw they get executed by using the timing and control unit ok. So, this that is how like things happen typically in the microprocessor ok. So, we will stop here for now.