123

8

Click here to load reader

Transcript of 123

Page 1: 123

0:01hello everybody I'm gonna be looking at the general concept and implementation0:05of pipelining Image Processor0:07now we have previously learned about the architecture and uses a single cycle and0:11multi cycle MIPS processor0:13but we kind of short change much of the hardware if we keep the project actually0:17as it currently is0:19because the president doesn't actually use more to the hardware0:22if we handle instructions one by one because %uh this large inefficiency0:26but these are the hardware available the concept of pipelining was introduced to0:31take advantage of the hardware by0:32initializing the next instruction before the previous one is fully complete0:36so how exactly does pipelining work its easy to think of pipelining in the way0:42we think of doing any activity in our daily lives0:44now pretend that it's the weekend and you have four massive loads of laundry0:48to do0:49but also pretended you have a big test for your computer architecture class and0:53you can't devote your whole0:55evening to doing laundry now this is the how one might initially approached doing1:00all these four looks1:01well this is all fine and dandy except for one problem1:05it takes six hours to do all four loads from start to finish1:09doing it this week this is exactly the way we have been using our processors in1:12this class so far1:13not exactly efficient now let's look at the second step in a process here1:18after we have to watch would put the load in the dryer1:21and wait for the dryer to finish to load but just standing there at the1:24laundromat1:25staring into space isn't exactly the best use of our time1:28so what if instead of staring blankly we can't get the ahead on the next load

Page 2: 123

1:33while its previous one finishes after all were free1:36and Water Street so we put the next load in the washer soon as we finish putting1:40the previous one1:41in the dryer now we have both the washer and a what dreyer going1:45while it does two consecutive looks let's assume that both the washer and1:49dryer take the same time1:51to wash and dry load such as they're done at the same time1:55and I can move to the next step in each respective cycle this means that once1:59I'm with the second load to the dryer2:01and the first look to the folding table the washer is once again2:04free to use and once again we packed the washer with Mark lows2:08to start our third look now still waiting for the dryer and washer to2:12finish2:12we can fire for the clothes from the first load you can see we are kind of2:17stacking2:18one load on top of the other and having this entire process running parallel2:21and it certainly pays off because instead of sitting around pouring2:25herself to tears waiting for washing and drying cycles official till 2 a.m.2:29like we're doing here under this way were constantly doing multiple things at2:33once2:34and finishing this the same amount of floats by 9:30 p.m.2:37this is d same way that pipe laying works2:40Image Processor it said all this stuff with washing and drying clothes2:45was replaced steps up his laundry business with each step in the midst2:48processor2:49each instruction animates processor has five different steps2:53instruction fetch instruction decoder register fetch2:56and execution step where we carry out a variety of different operations like our3:00type instruction execution3:02every read and write a dress competition and branch completion or jump from

Page 3: 123

3:06completion overdoing fracture jumps then there's a fourth step3:10where we carry out everything having to do with memory such as3:14every reader dresser memory right completion if we're also doing our type3:18instruction this is a step with that instruction is completed3:21the fifth step right back if the final one which also doubles as memory3:27recompletion3:27in the case of some instructions involving reading memory so these are3:32all the five steps up doing a single instruction3:34now when we have multiple niche instructions in a program the processor3:37can start doing effect instruction3:39before the previous one is complete in order to maximize efficiency in our3:42application3:43notice that when stacking each of these instructions together3:46we have to move the steps second instruction one cycle after the first3:50the steps of the 13 structured one cycle after the second and so on3:54after all we can't exactly put a washer and dryer to work on two loads at once3:59much that we can't make it ale you due to different operations at once4:03so now we have everything to get pipe laying going4:06do we need to change anything in the pipeline depth at itself4:09the answer is yes but we don't really have to change much4:12now datapath need some way to be able to help with the two-step its in4:17in addition me to be able to kind of stop or rather4:21isolate each step in a datapath since we're going to be using the same path4:25for multiple different instructions to accommodate this we need to introduce4:29state registers these registers service kind of a partition4:33that separate each other five steps up an instruction such as we can make this4:37conga line of instruction steps work4:40will name each of the state registers by the two steps that they're separating4:44for instance will name the first partition I fetches last4:47DEC to indicate that this will separate instruction fetch and decode

Page 4: 123

4:52the second is named DEC slash exec to indicate that this separates decode and4:57execution4:58and so forth something else that we need to be able to move between5:02each of these partitions are all the control signals that will need for each5:05individual instruction5:07now we're reading these control signals the instruction decode step5:11but once we move the instruction path that the coats that5:14we need to be able to read the control signals for the next5:17and us we can't keep them there while the previous instructions facing his5:21thing5:22because we need to keep this process moving we're going to have to save these5:25control signals5:26in the state registers such that one holdout iPad can5:29remember multiple control signals for different sections5:33not that the further we go along the path we get rid of the control signals5:37we know we're not going to need anymore moving forward5:41now rumor when we were deciding light need for easier to work with in the5:44beginning of the course5:46as in all the structures have the same length will disadvantage certainly comes5:49handy when we're working with pipelining5:51because we don't have to worry about their instruction links what we're5:54trying to cram multiple instructions5:56into one tap we can easily and neatly fit5:59these structures between status even as we face the code them6:03without having to worry about this it's not all dream wasn't roses though6:08because pipelining also comes with its fair share issues6:12pipelining can introduce multiple problems a big one6:15what we called hazards hazards are issues that pop up when we were doing6:19multiple instructions that once6:22now you might think that on it that a pad level we've tried to make it as

Page 5: 123

6:26painless as possible by introducing6:28all the state registers in saving important control signals in these6:31registers6:32but there are problems that occur outside the scope of the data path level6:38there are three main hazards that were briefly going just to look at in this6:41video6:42and they are structural hazards that I hazards control has6:47structural hazards occur when two different instructions6:51try to use the same resource at the same time6:54if you remember we originally try to mitigate this issue by6:57starting at and instruction one cycle after the other7:02but this is not enough if we stacking up instructions7:06certain types we can come up with a combination where to instructions7:11that are multiple lines part try to use the same resource7:15which can present plenty of problems on its own7:18the second type hazard is it that a hazard this one is simple to understand7:23let's take a look at this pair of instructions that are meant to be done7:26consecutively7:27you might be surprised at every implement the pipeline processors7:30exactly as we have it now without any has a control7:34just these two instructions will present problems7:37do you see why take a look at the output of this instruction7:42now let's take a look at the input of the Nexus traction7:45if we look at the instruction steps we can notice a problem right away7:50we don't store the result of this instruction his respective register7:54until the last step7:56but the second instruction we've reached the same register7:59in the second step this means that if we do this addition the first instruction8:04it will be saved if the registry in time for the second instruction to actually8:08get the update Valley when it reads it

Page 6: 123

8:11again this is what is called at that a hazard8:14the third instruction isn't as a control Hazare8:17which works a little bit like the way the data has it works8:21for instructions like exceptions branches jumps8:24it takes some time for the data path to properly compute the applicable8:27comparisons8:29at new destinations at the program before we're ready to move the program8:32in that direction8:34however if we continue to sit back the program in the same way8:38to pretend that we're not changing our course in the program8:41program might start doing operations that were not meant to be doing at all8:45if for example we have a branch instruction that could potentially skip8:49the next to instructions8:50ask for the branches conditions and we stacked these next two instructions just8:55to get ahead in the pipeline8:57the by players affectively deciding to not take branch9:01regardless of what the conditions are already are9:04this presents a problem if we were actually going to skip his next9:07instructions9:08these are the problems presented as a control Hazare9:12there are multiple ways of solving these hazards a simple one being rather9:15specific9:16relook at these two examples which that there's a potential hazard9:19when we're doing a register read courageous a right at the same time9:23but note that in the datapath is actually possible for us to hardware9:27level9:27to both read and right to the register during the same cycle9:31because of this we can modify the way the rates to read and write9:35works by dividing it's registering 22 using the positive and negative9:39edges of the clock you free right to register on the negative edge

Page 7: 123

9:43and read from the register on the positive edge we can even9:46right to increase from the same register using two different instructions without9:50missing a beat9:52what instructors are side by side a more general way of solving data hazards9:57is doing what is called stalling sometimes known as inserting bubbles10:01since in some cases we absolutely cannot get the appropriate most update10:05information from a register10:07sometimes the best course of action is simply to stop the stacking process10:11by eight selling the program so that we can let the register values catch up10:16because see how it works here we're selling the program us for this10:19instruction10:19to get the right register value when it needed10:23but let's look at this insincere were everything is to be stopped10:27this is highly efficient because we're basically back to not even doing10:30any pipelining at all because we're starting the program so much10:34but let's think about this for a sec look at the way this instruction works10:38notice how the last two steps there is no way for this race to change its value10:42the thing that matters most to this instruction which is a register value10:46has already been computed by this time so why do we need to wait until here10:50for us to be able to fetch to register value if they register value is ready10:54right here10:55well we don't which is why we can take the data that comes out this step10:59its ticket right into this step in this other instruction sister program doesn't11:03have to sit around waiting for no reason11:06this what is called data forwarding and as you can see we don't have to sell the11:09program to oblivion and keep that by planting event is at the same time11:13now each of these hazards are more complicated this and properly11:17implementing the control solutions to this is more imp of11:20but that's outside the scope for this video with this video we have gone over11:23

Page 8: 123

what is pipelining11:25basically implementing it where some issues when we implemented and how to11:29solve these issues in a general matter11:31I hope you have to learn something from this and thank you for watching