 So, what we have seen in the last class, we will continue now the take forward the discussion for further building blocks of the microprocessors. So, we saw a combination logic, we saw sequential logic and now we will see how to build memory using now some of those fundamentals and further we are going to kind of see the construction of like some primitive microcontroller or microprocessor, so that we understand some basic stuff and then we will go ahead with you know the modern microcontrollers or microprocessors discussing that ok. So, let me switch to the screen, so what we are going to see is building how do we build memory now out of the deep flip flops that we have seen before ok. So, if you recall the deep flip flops hold their state as long as the clock input is given to them. So, some or see this is this clock input if it is going it is changed or it is going as a pulse here then whatever input is available here will be stored in the value and that value will be available as a queue ok. So, one kind of a deep flip flop is going to hold one kind of a bit memory ok. So, we put together such three flip flops and all of them are having the same you know this clock signal then they form a three bit kind of a register ok. So, this is how like you know you can construct now three bit register ok. So, we have some three storage elements or one three one bit storage elements and they are all can be controlled by using single kind of a clock input to store some value ok. Now, let us see how this value can be stored and retrieved from this register ok. So, we have this basic building block in place, but the question is say if you want to save this number one on one ok how do we save that. So, that number should be available as high voltage, low voltage and high voltage again on these three pins for one flip flop here for this first flip flop 1, second flip flop 0 and third flip flop it should be 1 ok. If it is available then when I give this write enable now this clock signal we are calling it as a WR or write enable kind of a signal ok. So, this signal like this is this kind of a pulse here then that pulse is going to get this input inside into and store the value inside this flip flop and now that value will be available at this terminal Q also ok. So, this is how one can save this value in the flip flop. So, we are now thinking like you know creating this three bit register and from here we want to retrieve the value. The retrieve value means like now the value will be already available at this Q terminals, but now say we want to use the same data lines to transmit to transfer the value into the register or take the value out of the register. So, how do we do that is what we the next question and like see if the number if you turn off the power that is given to this flip flops then like know the memory will be lost ok. We will not have the same number available when the power comes back. So, this is a different kind of like a memory where it is not able to hold the value when the power goes off ok. There are some other memories where this feature can be possible they will have some kind of a capacitive elements to hold the value or some other kind of a technologies ok. We will not get into the details of that. So, you can have a look at and like know get that information. What we are looking at is like you know fundamental principles of construction of memory and how do we address the memory here now ok. So, let me turn off these. So, let us say if you have this value to be retrieved from the same data bus ok, value to be retrieved to the same data bus and from that same data bus I want to say some other value to store. So, I want to use same symbol single data bus or data wires which are kind of giving the value to the memory and which are taking the value out of memory. And so, for this we need to have this Q and D terminals connected to the data bus ok. But now if they are both connected directly to the data bus that is not going to be they are they are shorted if they are shorted together then they will they will not function well ok. The value will be messed up with the feedback or some kind of other you know circuit will happen there. So, we want to have the control over you know whether the value is to be stored into the into the register or value is taken off the register and given to the data or data bus ok. So, that control we can achieve by using some kind of a small element called tri-state gate ok. So, let us look at what is this tri-state gate. It has three states instead of only two states it has third state which is C here which is high impedance kind of a state. So, we will not worry about what is that state for now. It is just a state where like you know the input is the output is such that like you know it is into high impedance kind of a level and that helps in you know not draining the current ok. So, if the impedance is low the current typically will get drained, but now if it is a high impedance state it will not drain the current ok. So, it is that is a kind of a state that we have here. So, the truth table for this is now we have this kind of a special gate which is called tri-state gate which has a input here and it is controlled by using this output enable kind of a pin and then it is getting reflected to output f. So, in this case this is a circuit we do not worry about how the circuit is constructed and why like it is like that, but one can get into details of this is kind of CMOS circuit which will realize this tri-state gate ok which is inverted kind of a tri-state gate because output enable is 1, input is 0, output is 1. So, one can use some kind of a not gate here to make sure that input and output has the same value ok. So, you can imagine that this gate is such that this input value will be on the output only when output enable is enabled or it is 1 ok. So, this is a gate will make use of in this construction now ok. So, this is constructed in this kind of a fashion. So, we connect this Q to the data bus through this tri-state gate. So, whenever the we want this value to be available on the data bus we enable this pins of the tri-state gates all pins connected together the way you have this clock inputs connected together like that we will connect all these inputs together and then that when that is enabled all these data values will be available on respective lines of the data bus ok. So, so, so, this is how I can transmit my data ok from a register to a data bus ok. Now, I want to get a data from the data bus to the register how do I connect. So, where this D should be connected? So, you might have guessed it right ok pause and think about before you listen to the answer. So, yes the D lines can be directly connected to data bus because there is no conflict because unless. So, lot of lot of this data bus will have lot of this data which is continuously changing, but that data will not disturb this register because unless the clock goes high or this input goes high this D value cannot be stored into the into the register ok. So, now we have we are slowly kind of building up now to see how the data can be controlled in and out of the registers. So, this is the same principle now we can extend for getting the 8 bit register created ok. So, in the very similar way we can put 8 kind of a D flip flops together and create 8 bit kind of a register here ok. So, so, this has all these clock inputs connected together to this right pin and all these input to the tri set gates connected together to the output enable and you see this data bus is directly connected to the D pin and the Q is connected through the tri set gate to the data bus ok. This is how your circuit for the 8 bit register would look like ok. So, so, now henceforth we will just like now look at this. So, you can imagine that see how each of this you know each of these parts can be seen at different scales. Say for example, if 8 bit register is just seen as just kind of a block diagram like that it has inside this kind of a circuit. Inside the each of this D flip flop there are this lot of this RS flip flop and gates and other kind of a you know logic blocks. Each of those logic blocks will have CMOS transistors working at the base ok. So, like that one can imagine like ok this is getting now scaled up further ok. So, so, this is how our actually our computer gets built like know it has all these elements that we see at the user level if you kind of start digging in more details ok. What is that is at a hardware will have you will find all these kind of features to be there at the hardware level ok. So, now this we will refer henceforth this register just as this small little block with output enable pin and WR pin ok this output enable when it goes high the data from this 8 bit register will be available to the data bus here and when write pin is high then the data from the data bus will be written to this register that is what is there. They both cannot be high at the same time because then like you know if you see if they both are high then this data clash will be there ok. It is like shorting the Q to the D ok which is like having some kind of a data clash ok. So, so, from here we move on to how do we kind of store the data and retrieve the data ok. So, so, so, if you want to store the data again as I said WR pin needs to get enabled for some finite time with output enable being 0 ok. So, how you mean to make sure the output enable is 0 and WR is made high for some small pulse kind of a is given on the WR pin and then your data will be stored. Now, if you want to transfer the data from the register ok now this register to the data bus we need to enable output enable and we need to have of course, WR to be low ok and then the read operation will happen that way we are reading the value from this register and that is available on the data bus. Now this data can be exchanged between the registers through this data bus ok. So, now, we can think how this can happen. So, you have these two registers here and this register A and register B and from here I want to transfer the value to this register ok some register A I want to transfer the data to register B. So, from the from the A I should first transfer this data to the data bus and from the data bus I should transfer the data to the register B ok. So, so, I will transfer the data from register A to the data bus by using output enable for the A register to be high ok. Now, this data is available here now at the same time I need to do this WR to be high for a short duration then that data will be stored in this register B and then I can make WR to be low and now A's data is also there in the in the register B. So, is the data in the A register lost? No, we have not written anything to A register that data is still intact there ok like that this operation is going to happen ok. So, this is about like so, we have constructed memory elements ok. Now, we will need to address this memory. So, we how do we know like that ok we are at this register or this register there will be like thousands and millions of registers like this available. Now, we need to address this register ok. We need to know ok which register I want to move the value from. I cannot give this like just some some arbitrary A, B, C, D's kind of a thing. We need to have some numbers or addresses given to the to the registers ok. So, how do we address create that address kind of a feature in the register is what we need to see. So, so this is like you know we have all these rooms constructed for a hostel ok and students are to live in these hostels, but now we do not know that room numbers are not there yet ok that is a kind of a scenario. So, you have this many rooms available, but you do not have address available for those rooms. So, we cannot designate ok which student or which student is allotted which room for stay ok. So, so to do that now why this will be required of see if there are two three rooms it is very easy, but if there are millions of rooms like you want to scale this up to millions of registers ok where you have say some megabytes of memory then this becomes a issue ok. So, you want to give this address this addresses are given as a binary numbers ok some binary number is given as address then I should designate that this goes to this register ok. So, so that means like I need to have some binary number representing when that number happens on some some some some other lines which are called address bus then I am particularly referring to that particular kind of a register ok. So, how that happens ok. So, let us see. So, let us say we have this n 8 bit registers a huge memory can be formed like that ok this is random access memory that we have here ok. So, so now to address it ok. So, so these are like so many kind of registers connected together and then this is a 8 bit data line which is available why this 8 bit data line why there are 8 lines here because this is a 8 bit register ok. So, this register has 8 bit 1 register has 8 bit memory locations ok like that you can have 16 bit data also we can have 32 bit data also like that you have that is kind of a scaling possibility. Now, to address give address to each of these registers to address that we need to create some more kind of a logic here ok. So, say we say we have a 4 registers just for example ok and addresses are 0 0 0 1 they are binary addresses 4 binary addresses addressing these 4 registers. So, we need to select one of them at a time so to or to address or to you know take a value from that register to write a value from that register to write a value to that register for that we need to select one at a time how do we do that. So, so say say that we first create a bus called address bus ok. So, on address bus we will get these numbers available ok 0 0 if 0 0 is available I need to address only the first register ok. So, so how to address that how do you address first register by using this kind of the logic called decoder logic ok. So, given address it gives particular line to go high. So, so this question is how do we connect now the output of this ok. So, so so this is the next question first how do we kind of like what is this logic here ok. So, this logic will be something of this sort where you have this address that is available here say this is address line here on which the address is available. When this address gets available then only one of these 4 pins will go high and each of these pins will be then used for either write or you know write or output enable for that particular kind of register ok. So, how do we use that is the next question ok, but this is a base kind of a requirement where we have the address given then like know one of the pins is going high. So, so if we have 4 registers then we need 2 addresses address lines. If we have say 10 registers think about how many number of these address lines will be required ok. So, so say 4 binary numbers will give us 16 bit kind of a representation ok yeah. So, so 4 binary so, so we can go up to 16 registers you know for 16 registers to be addressed we need 4 data address address bits ok. So, irrespective address and you know the data bits are irrespective of each other say I can have 3 bit data or I can have 8 bit data, but it number of registers is important for address ok. If I have 10 registers then like know that determines like what is that is, but if I have say 4 registers now of only 2 bit kind of a memory. I still need this 4 you know the 2 lines for addressing ok like that you need to think about ok. So, so the data capacity or data bits in one register is independent of number of registers that I am using and number of address bits that would be required ok. All right. So, so now how do we connect this? This connection is shown here. So, you think about how do we connect this output of the decoder to respective OE and WR pins of registers ok. So, that we can address them so that OE and WR cannot be one at the same time and we are able to address whenever we want to write output like know when you write to I do not have to kind of you know I can do it in a very in a simple manner ok. So, to do that this is a way it can be connected. You can see that we have put some kind of a AND gates here ok. So, this AND gate is connected to this each of this one of the pins of AND gates is first first this AND gates are connected to both output enable and WR as a output of the AND gate is connected there and then inputs are shorted to connect to this decoder. So, that now I can address this particular memory location and depending upon what I write what I put here this is now my output enable one single pin ok for all the registers this one single pin will be there ok. So, I do not have now see if you remember like know previously we had multiple pins for this multiple output enable and WR pins ok. So, now I am I am creating some kind of a additional feature to address them independently and write and read operations are kind of controlled independently ok. So, so you address this register and then read read and write will happen only on this register ok. If you address some other registers for this by the same pins output enable and WR the read and write will happen on different register now ok. So, this is how one can think about you know creating this kind of a features that we would like to have in the system. So, that we can address now the data in each of these registers and address that particular register and then get the data out of that register or write the data into that register and how do we exchange the data by using these data first ok. So, we will not worry about what is a decoder logic that is constructed you can think about that ok. I am skipping these slides for that ok. So, decoder logic will have some kind of a two table and expressions are given here ok. So, typical memory chip will look something of this sort ok in terms of some kind of a architecture kind of a diagram ok. It will have say address bus and it will have a data bus and it will have read or read or output enable kind of a pin and it will have a write pin kind of a pin ok. So, now, we have say 4 byte memory ok and this has 8 8 bit data registers. So, then it will have a 8 lines for the data and then two address lines ok. So, because it is a 4 byte kind of a memory ok. So, like that if you have like larger and larger memory size you can see how much like know how much how long the data bus that will need or if you have say 8 lines of the address bus 8 lines of the address bus then how many maximum number of registers can be there in the memory ok. So, 8 lines means you can have 256 registers in that memory ok. So, 8 line address bus and whatever number of data data bits we do not know we can have any number of data bits does not matter ok. Once you fix the address number of address bus lines then number of registers get fixed in the memory ok. So, this is main understanding for this from the memory perspective ok. So, then there are these different different kinds of variants that will be available ok. So, now, the question is how do we sequence some sequence of operation if it is to be carried out how do we carry out that ok. So, this is one of the examples. So, for writing data from some external register to the specified address location in the memory ok. This is the operation that is given ok. So, what do you think about this writing the data from the external register to specified address location in the memory. So, you need to place some address on the address bus what does it mean is that address bus lines are like you know now 0 1 according to the address that is needed there ok. So, so, physically that is that is the meaning like address bus has some lines are at 0 volts and some lines are at higher volt ok 5 volts or 3 volts depend upon what is the voltage level used ok. So, that will create some kind of a address on the address bus now that particular register can be addressed. Then you want to kind of have a data on the on the data bus coming from the external register ok. So, so, this so, you select this chips. So, there are some additional features that will be there where you there are multiple chips that are there and you want to select one of the chips then you can select this chip for the operation to be done. Then this right enable is there ok. So, you place the bring this also to low that means, like now you enable the right operation. So, you can have this 3 and 4 can be interchanged also you can place the data from the external register on the data bus and then this bring it to low or and then bring it to high again that is one possibility or you can have this basically 3 and 4 can exchange with each other ok. So, and then this right enable is again closed or or disabled that means, the data is now in the memory ok. So, from external register it is now locked into the that particular address location in the memory ok. So, these are these are kind of one of the sequences of operation that can happen. Like that one can think of many different kind of possibilities for like you know doing the some kind of say you want to move the data from one of the memory locations to other memory locations you know what is the operation like that one can start thinking about different sequences of these operations that can be possible. And you know when you start writing your program or that program gets executed this is what happens at the hardware level ok. How does it happen we do not worry about that right now ok. We will see some part we see some glimpses of it in the in the in the next class maybe. So, but right now you see that ok these kind of operations can be performed different kinds of like you know operation sequence of operations can be performed by using this this like you know steps for executing that into into the into into your system ok. And the the basic thinking philosophy here is is this like now. So, this this this helps us to develop our understanding about how things are things could be happening at at at a base hardware level ok. So, again I am giving you some kind of a thing that ok this is not this understanding is not really a must kind of a thing for you to start programming microcontroller ok. Anyway we are programming our microprocessors or computers programming this is not really necessary, but if you have this understanding this will help you think better in terms of your programming ok. So, that is why we are going through this this little bit more details about how things happen at the at the hardware level ok. So, so now let us see this is a this entire thing can be represented in terms of some kind of a timing diagram ok. So, this timing diagram is is is given like this. So, this address bus is given as as like you know we are not now using it as a each line what is a value and things like that. We are just representing entire address one as as a once kind of a signal where from this point in time to this point in time 1 to 8 kind of a numbers or like you know steps of the time that are given. All the time this valid address is there on the address bus. Then this chip select will go low chip select bar will go low that means chip select will be high happening here in this domain ok. Say W this right an apple is happening here in this domain and and data becomes available a valid data will become available from this 4 to 7 or from this time ok duration here. So, so these numbers are written as like say different different kinds of a step that is going to happen. So, first step like you know you will have this in time happening, then second in time happening, third in time happening, then there you will have valid data available when you when you have this external register output enable is enabled on that and then that data will be taken off that register, but before that you will have the the W e going high that means the data is kind of locked. So, otherwise what will happen is if this is still low and some some some data is changed here or this some some valid invalid data comes this is some kind of a invalid data in this domain comes here and still this is this operation is not completed yet ok, then that data may get stored in the in that particular address instead of whatever valid data that we wanted to store ok. So, this is how like you know typically the timing diagrams are given and and our ability to read these timing diagrams is is important. How do we think we think ok of first what are the inputs and what are the outputs ok. So, so here like for example, this output enable is an input given to this external register and and as a result of this what is happening on the data bus is this ok. So, like that this is this is input this is output. Then you need to see ok this chip select and this they and this address but this all are inputs only ok. So, this is what we are giving as inputs and only like you know whatever is available on the data bus is output because like you know that that we are assuming that data bus is connected to the external register and when external register is made output enable high then the valid data is available on the data bus ok. So, like this the these are be through these operations this data from the external register is getting transferred to this whatever address that you have addressed put you have put in on the address bus that particular address of the memory this data will get transferred to that particular register ok. So, these are the operations that are happening you know as they are supposed to happen if you want to transfer the data. Now, how do we make this happen is for this you need a timing timing diagram ok or timing additional kind of a timing inputs ok. So, how do how do we do that we will we will see it in the next class along with you know some of the primitive kind of a microprocessor constructed. So, that you can get a glimpse of how this whole thing are like you know such a nice kind of a way they are interconnected and made to function to get us the functionality that we want as a user of microprocessor or microcontroller ok. So, we will see that in the next class and we will not get into too many details about how things happen, but these are the base kind of a elements that we are putting together to just see ok this is this based on these elements now your entire microprocessor architecture and all the interfaces are built based on this kind of a basic kind of a building blocks or components ok. So, to just give you this glimpse this is this although this is not completely necessary for us to program or understand mechatronics this if this is understood we are very well equipped to do the job in in the in the different scenarios ok. So, we will stop here and we will move on to the next class ok.