 greetings risk five friends. Today I thought that I would try something a little different. With the ALU having been designed and sent off to China to get the PCB manufactured and now I'm just waiting for it to come back, I thought that I would start on the shifter. So if you'll recall the ALU was able to implement various arithmetic and logic operations but was not able to implement a shift. And we have three basic shift instructions. We have a shift left. We have a that's actually SLL. We have a shift logical left. Logical left. We have a shift right logical. I guess this is left logical. Left logical. We have a shift right logical. And we have a shift right arithmetic. Right arithmetic. And the difference between left logical and right logical of course is the direction. And when you shift logical you shift zeros into the position that's that's shifting over. So for example for left logical if I had 0 0 1 1 1 and I wanted to shift it 1 left then this would become 0 1 1 1 0 because I'm shifting a zero in. Same thing with right logical. If I had a 0 0 1 1 1 and I wanted to shift that one position right logical I would be shifting a zero into the upper position. I would end up with 0 0 0 1 1. And the last bit just sort of falls off the end. This also falls off the end and it doesn't actually get stored anywhere. In many architectures that bit gets stored in you know sometimes the carry bit. But the risk 5 has no carry flag so that bit actually doesn't go anywhere. It just disappears. Now with right arithmetic the idea is that shifting one right is the same as dividing by two arithmetically. So of course if you were to take negative one well if you were to take negative two and divide that by two you would want to end up with negative one. And the only way to do that this is negative two in two's complement notation in five bits. So the only way to get this to become negative one when you shift is to shift a one into the upper position so that you end up with that which is negative one. Otherwise if you just do it logically you would end up with this which of course is not anything it's just 15. So the idea is that in arithmetic shifting you take the most significant bit and you shift that into itself. So that's why this becomes a one because we're shifting a one as the most significant bit. And if we had this and we were to shift that arithmetically well we take the most significant bit and shift it into itself. So that would be zero zero one one one. So that's the difference. Now in terms of instructions shift left logical has its own funk three pattern. Shift right logical and shift right arithmetic share a funk three. And the only difference between the two is that bit 30 on the shift right arithmetic is set to one. So how do we implement a shifter? Now again what I should say here is that when you shift you can shift any number of positions between zero and 31. In other words you shift by a five bit amount. And for the register register instructions so for example shift left logical you know let's suppose it would be you know register five by register six. Well register six of course is 32 bits but we're only going to pay attention to the lower five bits. Same thing with shift left logical immediate. So you know for example if I had you know I don't know hex 3f which is six bits we would only be paying attention to the lower five bits. So that would be one f which is 31. So I would be shifting this left 31 positions. Okay so because we want to be able to shift in essentially one instruction cycle we don't want to shift by one repeatedly because that would take more cycles. So we want to do this a little more efficiently. Now there are things called barrel shifters and funnel shifters and they basically require huge masses of gates in order to accomplish shifting left or right or arithmetic by any amount. Instead what we're going to do is we're going to use the logarithmic shifter. And here's how the logarithmic shifter works. So if we want to shift left logical some value x by some value y what you do is you take y and you decompose it into its binary number. You know let's suppose this is b 4 3 2 1 and 0. So this is just the binary representation of y and this represents a shift by one. This represents a shift by two and so on where each b sub i represents a shift by two to the i. Now you can do this in basically any order that you want and you can do them one after another. So in other words if I had some circuitry here that shifts by one and then I have some circuitry here that shifts by two and by four and by eight and by sixteen. In other words this is two to the zero two to the one two to the two to the three to the four and I feed them in a chain like this and I enable or disable these based on the binary number. So this would be if b zero is set if b one is set and so on. Then at the end of this I will get a shift by any arbitrary amount between zero and thirty one. If I'm going to shift by zero then none of these are activated and they're just going to flow through. Now really what I need here is kind of a multiplexer right because this is going to be a shift by zero and this is going to be a shift by zero and so on and I'm just going to sort of multiplex between these two depending on whether we're activated or not. So we're going to multiplex and then feed multiplex and then feed this is a terrible drawing multiplex and then feed and then multiplex and that's the output and the input goes to both of these shifters. Now of course a shift by zero is just you know a wire and a shift by one well you know it's fixed it's a fixed shift by one so basically what I'm going to do is I'm going to put you know wires like this and then these wires are like this and these wires are like this and so on so there's 32 bits in 32 bits out. Now the way that I'm going to accomplish this is not through multiplexers and quote shifters but through tri-state buffers so the idea is that we have our 32 bits coming in and now we need to either shift by one or shift by zero so what I'm going to do is I'm going to take a tri-state buffer and another tri-state buffer and what I'm going to do is connect the inputs and connect the outputs and only one of these is going to be active at a time and what this buffer is going to do is so for example if I were to shift left then here I'll just draw the lowest four of these so this is a buffer of four bits so we have so we have input I'll just call it input bit zero input bit one input bit two and input bit three so now I'm basically decomposing this 32 bit bus into this now in order to shift left really what I want in the output is I'm going to be shifting a zero in so I want this to be zero I want this to be in zero I want this to be in one and I want this to be in two well I'll do that by simply rerouting the inputs so this will be grounded this will be in zero in one and in two so that's what this thing is now if we take a look at the shift by zero and I have all four buffers well in that case I want this bit to be in zero and in one in two and in three so now I can get rid of this and now I'm just going to join these up this is my very very messy schematic okay so these are enabled if we're not shifting and these are enabled if we are shifting by one so if we are shifting by one in zero is going to appear over here in bit one position if we're not shifting then in zero is going to appear over here in bit zero position and that's basically the way it works shift right works exactly the same way if it's logical shift then of course we're just going to be shifting a zero at the top and if it's shift left arithmetic well we're just going to take whatever the most significant bit is and shift that in so in other words it's going to look like this at the very top so we have our our inputs so this would be in 31 in 30 and in 29 so I'm simply going to connect this to this and to this and do this so that way shifting arithmetically right uh the most significant bit which is the sign bit appears in this position and in this position in 30 appears in the 29th position in 29 appears in the 28th position and so on so basically that's shift by one and then I just need to shift by two shift by four by eight by 16 and then I'm done so uh that's the plan so what I'm going to do now and this is you know maybe it's just going to be very boring or I don't know what I'm just going to go into chi-cad and build this from scratch so uh you know you could just leave it running in the background I don't know I I kind of like to see these build videos just running in the background while I'm doing other work so you know maybe you want to use it that way I don't know that you're going to actually learn anything from it but anyway here it goes and so let's use chi-cad to put together the shifter all right so I am going to open up the schematic view and this is the default size and I'm just going to change it to the approximately the biggest size possible because there's going to be a lot of stuff in the shifter I don't really expect people to you know watch this the whole way or even look at it at at one one x speed or even pay attention to this so I guess I'm just going to mumble along and put stuff down and sort of describe what I'm doing so let's go ahead and put down my dual PCIe card edge so we'll stick it I don't know down there so these are all the signals that I've already defined so we've got the destination bus here this is the upper two bits two bytes and this is the lower two bytes all the lower two bytes are on this side and all the upper two bytes are on this side we also have some non-connects these are basically free connections that I haven't assigned yet so we've got six over here and another seven over here so that's a total of 13 undefined signals I guess you know if I need to get more signals I can just add another one of these PCIe cards PCIe slots okay we've got the boot signals this is to load up the ALU we have some F signals these are actually the opcode are they the opcode or are they the function these are the funct three from the option from the instruction plus one extra bit this is that second to last bit bit 30 which tells us well it tells the ALU whether it's going to an add or a subtract but for the shifter it's going to say whether it's going to be a a shift right logical or shift right arithmetic so we brought these out so this is the ALU output selector we're of course going to need another signal here for the shifter specifically so what I can do is I can just define that signal right here and we're just going to call it shift output enable and I'm going to put a prime in there because whenever I bring a signal out I'm going to want to run it through a buffer so that it's got minimal load on the bus so let's see the other thing that I need to do is well start shifting let's start shifting so I'm going to bring in another thing which is 74 is it this yeah this is an LVC 541 and I kind of like this signal this symbol over here I don't really like the box with the uh with the yellow background and you know just pin names in it um this has the pin numbers and the pin names as well but the symbol is um this IEEE standard and it basically does what it says on the 10 pin so just a really quick primer on IEEE symbols there is a control block over here that's what this little little indentation block over here means it controls whatever's over here and inside the control you say what it does so em that means it's an enable and you can see here that there is a block that becomes the quote enable signal and you can see that it is g1 not and g2 not and they are just added together and that becomes your enable and you can see that in each individual slice over here we have a schmitt trigger symbol which indicates that your inputs are schmitt triggered um you've also got the buffering signal which means that you're going to have a high current output and you've got the tristate signal which of course is the enable and that's pretty much that so they've got you know other neat symbols I don't particularly like the logic symbols because they're basically just blocks I kind of like to use the traditional signals uh symbols symbols okay so um first thing I'm going to do is copy this and flip it around on the x-axis and the reason I'm doing that is so that I can get the low bit aligned with the low bits and now what I'm going to do here is I'm going to make a bus call it rs10 and that's that so now I'm just going to copy that oops copy that several times I'm just going to rename these sometimes I wish that there were kind of spreadsheet functionality in here so that I could just sort of you know select all of these and they just become cells in a kind of a spreadsheet and then I could apply you know some sort of function to it you know or maybe something like sublime text has where you could uh you know define a regex and then well there's a plugin that allows you to renumber that would kind of be nice but anyway all right so those are my 15 input signals now remember that for shifts what we do is we take whatever is on source one bus and shift it by whatever is on source two bus actually only the lower five bits because you're only ever going to be shifting between zero and 31 um and that and the output goes to the destination bus so uh none of these signals these are for the registers um yeah so that's basically that so what I'm now going to do is I'm going to take the lower seven bits here and you always capture a tiny bit of the other stuff which I don't need I'm going to rotate around flip around the y-axis and just move that in there and then I'm going to take these the upper bite and rotate around the y-axis and put it there okay so zoom out that's basically what it looks like right now and I'm just going to move this out a little bit maybe move it down slightly and at this point of course um because of the way that kikad works the moment you label a net those the nets that are labeled the same become connected so adding a bus is just sort of like a visual indicator so I'm just going to this this and that is a bus um and that again that's just for you know aesthetics that when you're actually looking at the schematic you can sort of see oh yeah this group of signals goes over there um as opposed to you know just a bunch of disconnected chips that you have to sort of search around the schematic to figure out what connects to what okay um so this um I have basically created a buffer which does no shifting and in a logarithmic shifter you have to either shift by zero or shift by two to the n so I'm going to call this no shift uh now what I need is a shift left and a shift right by one so I'm going to copy this and move it down to here move it up a little bit we're going to call this one what shift left no shift right let's call it shift right because if I were to take this entire schematic and rotate it let's see counterclockwise then this would be on the right I don't know all right so if we're shifting right um that means that this bit now should be over here and bit zero is supposed to fall off the end so I'm just going to delete bit zero I'm not going to copy it I'm going to delete it and now I'm just going to shift all of these right one grab this and of course again a little piece came off so I'm just going to move that back and I'm going to shift these down by one and of course even though we don't have it here we don't really have it connected to the bus yet not that it matters this is going to be bit 16 all right so the output over here is going to be the input shifted by one right let's do shift left uh and of course I can just connect these buses up because they're all basically the same don't do that okay copy this I don't want to copy that I want to copy this because it has the bits in their original position just do that and we're going to call this oops okay and in order to shift left I basically shift everything up so bit 15 is actually going to be in a different buffer all together so I can remove that and now I'll just move all of these up by one bit up one bit up one bit and of course because this is risk five and we don't have your traditional carry goes into this thing we're just going to ground this so I typically use the ground ref signal a symbol darn it there's also a ground symbol like this there's also a digital ground signal in case you have both digital and analog grounds or power or let's see you've got clean earth and protective earth there's a chassis signal somewhere in here that's kind of a chassis signal symbol uh I typically use this because that's what I grew up with so let's grab that also what I do is I make the value invisible because I know it's ground so now the other thing is that this line this net is called ground ref if you wanted to rename it you would have to put in another label and call it ground which I in fact I'm going to do the reason I'm going to do that is that this symbol when I created it let me just save properties edit with a library editor you can see down here a whole bunch of invisible pins that have no length and they're all called power input if I edit one of them you can see that it's called ground gnd and up here I've also put another bunch of invisible pins called vdd and that's really important um it's convenient to make them invisible so that you don't have to hook them up uh explicitly and uh you also when you make them invisible you also want to make them zero length and stick them right on because otherwise you know if if there's an invisible pin and the terminal is up here somewhere if you run a wire across that it will actually connect so that's a kind of a trap right there and the way to connect up those invisible signals is you will take your ground ref and first of all we called it ground so what I need to do is explicitly state that this net is also called ground finally I need to take a power symbol called a power flag and that says whatever power pins are called ground get connected to here I don't know um uh because because these pins don't actually have net labels on them for example this pin right here is not automatically the net nc11 I think that's what this power flag actually lets you do so the other one was vdd so what I can do now is um take uh vdd okay now it says it's a positive voltage power flag symbol if I were to just stick it down I don't think it will actually connect to the net called vdd and in fact I can run the uh drc and oh we have to annotate things so let's go ahead and just run the annotation that way when I run the drc it can actually refer to various chips so yeah there's a whole bunch of things a whole bunch of problems what I'm specifically looking for maybe is um here we go pin 20 power input of component u3 is not driven so if I look at that um we can see that it's actually pointing to an invisible pin so if I go into the symbol here edit properties edit with library editor um yeah here it is so we can see there's gnd and vcc not vdd so I'm also going to need a v vcc so let's just go ahead and vcc that hit okay and we're also going to connect them because you know my vdd and vcc are exactly the same uh let's go ahead and drc again run delete markers run now you can see uh pin 186 of component p1 is not driven so that is the thing that I called vdd so for whatever reason vdd doesn't get connected until I attach a power flag to its net then when I rerun the drc we can see that that error has at least gone away so anyway that's the uh magical incantation that I've learned about power flags okay uh let's go ahead and delete all the markers because I know they're not connected to anything okay um and actually I kind of wonder um were there markers on this side run close no there were no markers so basically it's saying yeah um these are connected and it's pointing to all the pins that are not connected which is very useful so oops I don't need to annotate I need to delete tape okay so we've got um this is okay this is uh the lower 16 bits uh obviously we're going to duplicate it for the upper 16 bits but what I first want to do is hook up something to these enables okay so uh there are a few things that I can do so one thing uh that I want to do is so we've got this shift uh output enable um so one thing that I could do is I could actually connect it up to to one of these and that basically means that uh when an instruction comes to shift all of these buffers are going to be enabled um the other alternative is that since this is going to be a bunch of cascaded buffers that I could connect this signal to the very last buffers um and I probably will end up doing that um just because it will make my routing simpler so that I don't have to route this line to every single buffer um and yes it will mean that these buffers will actually be outputting and doing things but uh you know I am not really power optimizing at this point so let us go ahead and figure out what we want to do so first I'm just going to take this and ground it because why not so that way we've really oops we've really only got okay really I just wanted some guy to have to delete it and do it again maybe with a a bigger wire okay yes that's what I wanted okay so I can do that I can do that couple buffers up here okay so now the thing that's going to tell us whether we're going to shift left shift right or no shift is first of all the amount of shifting that we need to do ah maybe that's why I need the second uh enable okay so it's based on the amount of shifting that I need to do and whether I'm going to shift um one at least or not is based on rs2 zero so let me bring that signal out rs2 zero I'm just going to leave it hanging for now uh it's pretty clear that I'm going to need an inverter at some point so let me go ahead and bring in an inverter so that's going to be the 74 lvco4 I don't really like that symbol so I'm going to take the 74 o4 I don't like that symbol either so I'm going to go to the 74 lso4 there are tons of symbols in here um actually you know what yeah I'm going to use the 74 lvco4 I'm just going to do that because I know that all the signals are going to feed into this one chip and I just may as well do that now I I guess when I design this chip um I did not make these invisible let's do that exercise now so I'm going to go to properties edit with library editor okay now this is my own library see I have it called lmarve and I've got all my custom things in here so the first thing I'm going to do is edit and make this invisible and also make the length zero and then I'm going to move it down to the outline of the box and do the same here make sure that these are power inputs I think because otherwise power flag doesn't work uh visible invisible and there now I just save it by the way I'm using chi-cad 5 I'm using chi-cad 5 release candidate 2 chi-cad 5 is vastly improved over chi-cad 4 if you're still using chi-cad 4 you might want to ditch it and just get the release candidate right now because they've been saying that they've that they're very close to a release and they've been saying that for months but I just can't wait it's so awesome um okay so that's that I've saved the library close that and now we can see that we have no power symbol over here and the power symbols are going to be connected up to here automatically so the only disadvantage is that you have to know the name of the power signals um it could be vcc it could be vdd it could be ground it could be vss who knows okay um so here what I'm going to do is I'm going to feed in rs20 grab the wire make it a little oops make it a little bigger move this over and I know that I'm going to need all the rest as well so there's just going to be five of them okay and on the other side of course I can have the negative of those so for negative I can either do tilde which puts a bar over it or I could do you know slash putting a slash in there is another way of doing it like that and for some reason my slash key isn't working I wonder if it's because of this uh key press that's q i press anyway um rs what did I say uh cancel all right let's just put the tildes in there and another thing that I've learned is that you won't if you only want to put a bar over some of the sit some of the letters um you can do that to put a bar only over the rs so really tilde means bar off and bar off or I could put a a knot symbol in there okay um now the other thing is that first of all um whenever you have any unconnected input make sure to connect it to a power rail otherwise that input is going to float and is going to accept electromagnetic disturbances which may actually be bad for the chip so always connect your unconnected inputs you can leave your unconnected outputs unconnected but remember to use the no connect symbol on that pin so the other thing is well how do I know which signal goes where because you know on the chip this is whatever it is and when I lay out the board these signals may not easily be routed to these pins well in that case you just go back and forth between the pcb and the schematic and you rearrange pins you're never going to get it right the first time all right so um if we're going to do a no shift we're not going to do any shift whatsoever then rs20 has to be zero so what I'm going to do is I'm going to connect this up to rs20 not and if I am going to shift then of course I want to connect it up to rs20 move these out a bit this out a bit now some of you may be looking at this and saying why am I not using like why am I not using eagle why am I not using alt and well the answer is that none of them are free well okay maybe eagle is free oops maybe eagle is free or at least one version of it is um there is also um circuit studio which I think is free but you know I can't I can't release the the the files on github so I can't source code control them um I can't share them I can't let up any people modify the files or or you know clone it unless they use the right uh unless they sign up for circuit studio um you know and kikad does you know pretty much everything that I need to now certainly altium is going to have a lot more features but altium is a professional package and uh you know the moment you buy the professional package a you're locked into it and b well you can't share your files anymore and it no longer becomes open hardware so that sucks anyway all right so those are my signals hooked up so I'm going to have no shift if rs20 is zero and I am going to have a shift if rs20 is one now how do I choose between left shift and right shift and the answer is well it's going to depend on one of these f's so what I'm going to do is I'm going to bring up my little cheat sheet okay and uh before anybody keeps screaming at me I am going to go ahead and fix my errors uh the error is that uh this is a negative input so of course as a negative input I want rs20 not not rs20 so let's just do this and we can connect this up to here and this up to uh where is it here there we go okay so this signal has to be zero in order to enable this and that means that I want rs20 which is zero for this to just be connected directly there okay uh so that's uh that's that uh now the other thing is I also need to hook up the uh f's and if I pull out my handy little risk five notes here we can see here's shift left and here's shift right logical and arithmetic now so uh we can see that shift left is uh this is funk three so that's right over there this is my f zero f one and f two f three is this bit right over here so um we can see that um f zero is going to be one for both of these f one is going to be zero for both of these but f two is going to be zero for left and one for right so f two is zero for left and one for right which means that I'm going to call this shift right I'm just going to rename that signal okay and of course I'm going to need to invert that as well well lucky I have an extra inverter in this package shift right gonna call this so um now the interesting thing of course is that uh these shift these buffers take negative inputs so that would kind of mean that uh shift right gets shift left which is kind of confusing so I'm just going to call this not shift right and maybe I'll just call this not shift left and again that's probably confusing but maybe it'll only be confusing once when you first encounter it and not on every buffer okay great okay so uh shift right takes the not shift right into wire this up like this and that was the wrong one sometimes what also helps is if I just copy these uh net names and put them down here so that when I'm just looking at a small part of the schematic I know what it is what's this RS20 so that's this here that's probably good enough okay um for no shift of course I don't need to pay attention to whether we're shifting left or shift right because of course it's a no shift this on the other hand has to be the negative shift left so um I wonder if I can just uh hook that up to a bus instead of having these wires all over the place well okay uh let's go ahead and take shift left and is there room for another wire in here yep if left I'm going to solve the way up to here light up to be the shift left symbol to here move this up here as well as well okay all righty um so that's that so these buffers are only going to be enabled when this signal is zero so in other words when RS20 is set and when not shift left is zero in other words when we're shifting left and that is indeed what these buffers do all right so uh that's the bottom two bytes uh the upper two bytes are going to be the same but what I'm going to do is I am now going to call this I'm not going to call it RS115 of course I'm going to call it um let's see S yeah S115 okay and S115 so these get changed to 14 ones get changed as well and the reason that I'm doing this of course is that um so this is the result of the shifter uh so the result of shifting left of course S10 is going to be zero S11 is going to be S10 and so on this is the result oops so this is the result of shifting by one so I'm going to copy that because these are tri-state buffers and the whole trick with this shifter is that only one set of buffers is going to be active at a time and the one set is either shift right no shift or shift left so each one of these S115s gets connected and the only thing driving that that signal is going to be whatever pair of shifters is activated so that's that uh there's another level now shifting by two so uh how do we know that we're shifting by two well that's going to be whether RS2 sub one is zero or one so basically it's going to be a copy of this entirely a copy but very close to it let me turn on my cross hairs cross hairs are sometimes useful so that you can actually line things up all right so now what I can do is I can also put a nice little label so this is shift by one a little bigger and this is going to be by two so this is two to the zero this is two to the one so of course this now is going to be one the only disadvantage of putting the net name throughout the entire wire is that if you change the net name you have to change it all over the place otherwise uh chi-cad will try to connect up those nets uh not try will line these up a little nicely uh okay now these of course are not the RS1s these are now going to be the S1s so uh where's my no shift here's no shift so I can just do this okay that's my no shift and of course this is going to end up being S2 so the shift after shifting by two be so nice to have a tool that could do this for you and I don't know enough about chi-cad plugins to write one myself it's really someone's gonna write one okay um I may as well make that change here too I moved instead of copied I almost moved again all right so when we shift right the bits are gonna fall off the end and specifically we're shifting right by two so I don't need this anymore move this down grab this these now going to become 17 uh no shift we're going to leave this the same and shift left we're going to shift all of these so these were already shifted by one so I can just buy one again we just shift zeros in okay uh that is that now I can connect these signals up so this is what is this RS2 not one uh shift left and shift right so shift left here actually I'll put that down here so that's shift left shift right is over here now missing is RS2 one which can come down here save all right so that's shift by two now um obviously the lower bytes are fairly simple because I'm either shifting zeros into the lowest significant bits or I'm just shifting the higher significant bits down for the upper bytes there is of course whether you're doing a an arithmetic shift or a logic shift if it's a logical shift you're just shifting zeros into the most significant bits but if it's a signed shift then you're going to be shifting the most significant bit into the most significant bit so that's going to be a complication that we're going to deal with when we start adding the upper bytes so let's go ahead and add the shift by four section so we're just going to copy before I do that let me go ahead and add a bus here so that we know that this bus is connected and of course I got this wrong this is s1 these are all s1s okay s1s and these are s1s as well now you can see that uh in shifting right we haven't yet gotten to the point where we are going to get a most significant bit in here so at this point shifting right arithmetic is pretty much the same as shifting right logical okay uh let's add some bus thingalings two three four copy sometimes to move these uh wires like one pixel or one grid coordinate over you want to use the arrow keys and not the mouse keys because once you're in the vicinity find control on your mouse is not that great okay bus uh let's see how shall I do this well first I'm just going to connect all of these up in a line again this is just for visual aesthetics and I don't know well I've already got a piece of a bus here I may as well just do that sort of connection so there so if you're looking at this signal over here you can just follow the bus down here and you can see oh it goes up into there okay uh shift by four so let's go ahead and copy this section move it out a bit because we're going to be dragging these wires along which we don't need now we get to move it back so what I'm going to do is I'm going to start by grabbing this and just line it up with the top probably not evenly spaced out but oh well it's definitely not evenly spaced out that's okay shift by four all right so we have these s2's here so these are all going to be s2's and these are all going to be s3's uh what I can do is change this to s3 right away actually let's make it s4 so that we know that it's shift by four sometimes I just like to have if I'm doing work like this sometimes on the other screen I like to play a youtube video of somebody building something maybe they're putting together a schematic just to have it in the background you know just sort of like yeah I'm working and somebody else is working to you know instead of just listening to silence which some people can deal with I typically like to have either music or you know some sort of background noise while I'm working the silence is not very important to me I know that there are a lot of people out there who absolutely require silence in order to do their work I am not one of those people yes I thrive in an open office setting okay um s2 so in the no shift of course we are not going to be shifting at all so we just get to call these s2 and be done with it uh for shift right um first of all let me just go ahead and change all of these to s2 all right so when we're shifting uh by four we're going to take s2 uh zero one two and three and they're just going to fall off the end so we start with four so I'm just going to delete uh these delete these two manually because otherwise I'm going to pick this dude up and I'm just going to move these down and I just need to pick these up move the little piece back these down and copy two signals and then properly properly so that is shift right by four now shift left by four we pretty much do the same thing these uh upper two bits are going to fall off or they're actually going to be um going to the upper bytes so I can delete these and move these up and I should probably just rename these now before I forget okay uh let's see we need two of these bits go up here uh these two bits these four bits go up here and now we've got grounds here shift left by four so you can sort of see what's happening is uh you know if we wanted to shift by seven then we would shift by one shift by two and shift by four so this ground would get shifted into the zero position that's the zero position up here and that would get shifted into the s2 to position the s2 to position is up here and that would get shifted over here uh is that a shift by seven okay uh no this is actually correct um because bit zero is supposed to go to bit seven on a seven bit shift so here's bit zero it goes to one one goes to three and three goes to seven so bit zero does end up at seven so uh let's see oh I do need to change this to rs2 sub two so that we're shifting according to bit two now so I'll change that here and change that here and then I need to hook it up okay so shift left we know it'll just get hooked up here and shift right I think this is shift right we'll just get hooked up there and we have rs2 sub two not that gets hooked up to here and then we have rs2 sub two I guess I'll route down here up to there oops up to there okay that's rs2 sub two uh let me make this a bus and that should be fairly straightforward I should just be able to copy this bus and just align it right there and good okay save all right so that is shift by four uh now we're going to shift by eight so again copy move it off to the side get rid of these dangly bits move it back oops that's a little too far move it so that it is aligned great all right this is shift by eight eight all right so once again uh we can change the output immediately so this is now going to be s8 s8 and this is also s8 shifted by eight eight shift by eight all right so now I can just remove these bottom ones and copy them from the top from here copy them down here okay uh let's just go ahead and change these to s4 before we decide what the indexes are everything is set up and actually uh I know that these are all going to be grounded so I am just going to let's see remove these things move this over and just draw a line here right because when you're shifting left by eight all of these are going to be zeros and these are actually just going to be uh starting from zero one two three four five okay so that's shift left done uh oh and of course we will need to change this to rs three because this is now bit three so let's go ahead and change those right away uh oops rs two sub three did I make that yeah rs two sub three rs two sub three rs two sub three and rs two sub three all right for no shift of course we're just going to keep these so these now become s4s and these are also s4 okay that's no shift just for fun I'm just going to go ahead and grab this bus right now all right just so that it looks a little nicer okay um it's funny how the uh distance between the buffer stages gradually gets greater um okay shift right once again we have some bits falling off the end so this time it's going to be four more bits are falling off the end so we start with uh s eight right because these bits are now going to disappear so we are just going to get these bits so we'll start off with s eight and that's s four eight nine eleven let me do the fours first I can do that a little more quickly if I do the same thing over and over oops that's interesting if I hit home oh okay didn't know that four okay uh so we have eight nine ten and eleven we now go to twelve thirteen and these 16 17 20 okay now uh before I continue oh yeah let me uh just hook these wires up now this wire goes to there this wire here let's see we've got rs2 sub three inverted here and then we've got rs2 sub three not inverted gets hooked up there okay so we've got these first four stages now before I continue I want to work on the upper bytes and the reason that I want to do that is that the most significant bit the sign bit uh from all the way in the source is going to start affecting what happens on the shift right so uh what I'm going to do is copy this to about here set that off to the side clean up the dangly bits and it looks like I lost the bottom of my box here got a piece of the bus here too don't need that let's go ahead and line this up up here that looks lined up yep okay um and the control lines are all going to be the same as well so I'm just going to hook those up right away goes down to here and this control line here okay let's talk about the no shift that's easy enough so we're starting at now 16 because we're on the upper two bytes so 17 18 19 20 d3 and up to here 24 6 27 28 29 31 okay um now I can take these and go down to where they come in rotate that or rather reflect it okay and this other byte oops this byte here reflect here and I can just hook that up with a bus bus from here up to let's see where did it go with the other one the other one I hooked up well it doesn't really matter I can just hook up the entire thing that's the entire source one bus great okay uh shift right shift left is actually going to be easy because all I need to do is change these so I'm just going to delete these and these and copy these except shift it by one so the most significant bit is just going to fall off the end so that goes away and ease go up here okay well that's shift left all right now we need to deal with shift right and here we're going to have a slight complication so let me go ahead first of all and start with bit 17 because remember bit 16 is down uh here there's bit 16 so we start with 17 18 19 20 21 2 4 7 8 29 and now here's 30 and here's 31 but of course now the question is what is this so this can either be 31 or it can either be a source sub 31 or it could just be zero if it's a logical shift right so let me delete that and delete that from the bus because now this is going to be a function of rs 131 and uh one of these f's um it's going to be uh f3 right because that we said was the bit that determines whether we're doing an arithmetic shift so um I'm going to call this arith maybe I should just you know call it shift arithmetic okay so that's f3 so if that's a one that means I'm going to shift arithmetically so if it's a one that means that uh where's my shift right that means that this is whatever rs one sub 31 is so I'm going to need an AND gate which is a 74 ls is it a 08 yep so I'm just going to do that and that this and this and I'm going to copy this over to here and make this a little bigger move that okay so uh the way this is going to work is if arithmetic shift is set then the output here is whatever rs 131 is if shift arithmetic is not set then this is going to be a zero and we're shifting a zero in and that's all there is to it at least for that section so let us go ahead and do this 37 26 before 16 and now I can just delete these and replicate and since I've been welding these buses together I may as well just weld that bus so this is the entire s1 bus okay so that was fun uh let's go ahead and do the next shift stage which is shift by two so I copy this piece I move it off to the side and remove all the dangling bits be this so that it lines up it's lined up on the top no needs to move a little bit over need to remove this little stub so I don't even need that stub because the buses are going to be welded together right over here and these control lines also get connected so um as before uh shift left and no shift are pretty easy so let's just go ahead and renumber these I wonder if I can just delete these and copy these in let's try it a little too small that's okay uh so first of all and grab these and go one two one two and that should make them small enough I should probably rotate these stick them back here okay that's sort of okay I think that's less work I'm pretty sure that's less work one two three four reflect copy them back in great okay uh shift left so I can just go ahead and remove these and remove these and replace them with let's see so we're starting with 16 so we need um hang on a minute if this is shift left then isn't rs115 coming up here I think so we're certainly not going to shift to zero in the middle of a bite that would make any sense so this one here is 15 and yes I know that I got a little dangly bit but I think they'll they'll just merge in here in here okay uh so shift left that should be a 15 that means that the next shift left is probably going to be 14 14 yeah okay um that means that on these shifts I will also not have these and I will have some bus entries okay so uh in the shift left on the lower bites I ended with 13 so I need to start with 14 here unfortunately I do not have 14 but that's okay grab these and put them in the right place and then copy these two and start with 14 14 and 15 these go up here and starting with 24 here and go up to 29 that is shift left and all of these s2s are now going to be different so let's just go ahead and delete this and copy from here and replace with s2 and here is s2 also uh these go away replaced with these right so that was no shift and that was left shift now we need to deal with right shift shift right and with shift right we're shifting by two so this should now be let's see s1 16 so this should now be s1 18 18 20 oh wait why don't I just delete these and copy so we're at 16 so this needs to be 18 if we're going to shift it by two so we'll start here we need to go to 22 let's go find 22 copy all of this now again these are going to be different whoops uh redo those okay so these are going to be different right because we're taking s131 and we're going to shift it down into this position and we're also going to take s131 and shift it into this position if it's an arithmetic shift if it's a logical shift these are going to get filled with zeros but that's just what this is right this is the sign bit or zero so i'm just going to take this and put it here and that's all there is to it right because this is this is either the sign bit if it's arithmetic or it's zero if it's logical so that's what we're going to put over here and that's shift right for the second one weld the buses together it's that next we're going to need to shift by four now i'm aware that we still need to shift by 16 over here so i'm just filling up this section now rid of the dangles the problem with dangles is is that if they happen to be long and they happen to intersect another wire uh kikad will join those wires so in this case i was lucky that that wire didn't actually join up to anything so we first we're first going to align up the tops going to align the bottom here let's see merge these control lines again technically i don't have to really draw these lines all the way down because their net labels are the same but still great so uh once again we start with no shift so these just become these so like before i'm just going to delete these and copy these over and shorten them up and flip them around and these now become delete those copy these in use these to s4 hitting the wrong button for edit i'm hitting four instead of e four four four four and down here four uh one thing that i didn't do is um this line here shift left shift aref um and let's see shift left shift left shift aref and uh these let's see rs20 those guys uh shift o e i do need to bring these out which i forgot to do this is two three four so these signals i still need to run through a buffer um i have five signals here and three signals here that's eight signals total that'll fit nicely into a single one of these buffers so really these are prime prime and then they would go down to here after the buffer so and again that's just to provide isolation so that um a signal on one card in one slot isn't driving a whole bunch of signals the the most they'd ever be driving is uh one buffer on each slot and the other advantage is that the buffer the buffers are very close to the card edge which means that the line uh connecting the two is very small so you're not going to get a whole lot of reflections all right so where are we we're here the no shift uh i just took care of so the easy one is the shift left so let's get rid of these grounds which we know we're going to not need all right uh let's see since we are shifting left this is now going to be 16 up here this is 17 18 19 and that means of course that these come from the lower bytes so this is 15 this is 14 this is 13 and this is 12 which means that the next bit is going to be 11 on the shift left so there's bit 11 on the shift left okay and likewise this is going to be now 20 21 22 23 24 and 6 and 27 that's shift left taken care of now let's take care of shift right and once again um we're going to be shifting by four which means that 16 17 18 and 19 uh go down into the lower bytes so we're going to start with 20 here 20 22 23 24 25 26 27 and now we're going to need another four bits 28 29 30 and 31 and these are the sign bits thing from um i did something wrong over here obviously i left this enormous hole um because i counted incorrectly so these bits come down here these two bits come down here and now i need 28 331 let's go grab that from here all right shift by eight let's make a copy oh wait um weld the buses together it looks like i need to fix these up delete these delete these not be that all right shift by eight copy move this over get rid of these danglers put this in approximately the right place great connect up the control lines the buses there's no bus there add the bus all right once again no shift is easy we just changed these uh oh interesting i must have done a move instead of a copy okay so we delete these copy these making them shorter and flipping them all right and this is going to be 31 30 17 and 16 just delete the copy these two here is two here that's shift that's no shift taken care of this obviously goes away and let's see we're shifting left which means that let's just delete those which means that the eight bits at the top are just going to fall off the end and we're just going to be left with these and we're also going to need s for 15 down to eight let's go find that 15 down to eight all right so that means that for the shift left the next bit down here should be a seven let's make sure that's correct yes all right and now we just have shift right so we know that for shift right by eight all of these are going to be replaced by this sign signal so let's go ahead and draw that out some copies and then draw one wire right down to there okay and these are now going to start from 31 so 31 30 actually i can just copy them can't i s for 31 like from here okay and that means that for shift right the next bit down here should be 23 let's double check that indeed it is great all right that is shift by eight all right so let's do shift by 16 okay so okay so uh we've got the last section to go let's go ahead and copy all of this and move it over and remove the danglers copy this to here i guess i'm waiting for kikad to figure out how to do that and this is why you save very often in kikad because you never know if it's just going to sort of give up that obviously did not work apparently what happened is a mouse move was in the queue somewhere and here we go again just line this up sit in there and done okay great all right so the first thing i need to do is change these control lines to four the control line up here to four and this control line to four and these control lines to four this control line to four and this one to four and that means that i can now connect them up here let's change this label shift by 16 and we can connect these two down to here and this one over to there that's shift left and shift right and now we've got rs2 sub four which comes from here and we've got rs2 sub four which comes from here right that's that connected okay we also have this small bit of bus which needs to be connected well not strictly it doesn't but okay all right let's take care of no shift so first of all these need to become s8 and so i will copy those from here yeah from here shorten that's no shift and now the outputs here are actually going to go where so the thing that i'm thinking about is that we've still got this last signal over here shift output enable now if i connected this directly to the destination then one of these control lines one of these enable lines would have to be connected to that shift out but the problem is that we've got this shift left and this rs2 sub four lines taking up the enable lines so i could either add a whole nother row of buffers well not another row just another four buffers for the 32 bits or what i could do is i could modify the shift left and the shift right control lines to also disable all of the buffers when this is disabled so i think that that is what i'm going to do so here's shift right so let me move that over a little bit and i'm going to put a junction here so that i can just delete this segment okay and here's shift left i'm also going to put a junction here and delete that segment now what i want is for these to go to one if shift output enable is one and of course i want it to go to one if the inputs are one well that's an or gate so let's go and grab two or gates so that's going to be a 74ls 32 74ls 32 this one copy those move these down and this is actually going to be unit b so what is it properties unit b okay so let's move this over a little bit now this is our actual shift left and shift right control lines i guess i should move this over a little bit okay now this is a shift left um this is actually before the enable and this is after the enable so first of all what i'm going to do is i'm going to grab this signal here and i'm going to put it here except this is going to be after it gets buffered okay now this shift left is going to come from this shift left except that this shift left even though it's after it's buffered it's also before this modification of the signal so i'm just going to call this uh what should i call this shift left um i can call it shift left prime um shift left shift left a whatever and this is going to be shift right a and the reason that i want to give it a name the reason i want to give the net a name is so that when i go to the printed circuit board this doesn't just have some anonymous net number so that it actually has a label so i know exactly what it does okay so does this do what i think it does well when shift left let's suppose shift output enable is one which means we're not enabling the shift right because this is active low so if this is one then these are output to one and that means that we're neither shifting right nor shifting left that does mean that we're shifting uh no shift but i'm going to take the shift output enable signal and also apply it to the no shift control lines so that means that i'm going to take this and make this shift oh e and the same thing down here shift oh e and the same thing for the upper two bytes great okay so that's what happens if shift oh e is one now shift oh e uh is zero that means that we are actually outputting a shift and if shift left a if this signal is one then that means that this signal is one so we're not shifting left and that means that this signal is zero which means that zero or zero is zero so we are shifting right and that is the way that we will enable these output buffers or disable these output buffers okay great so let's see where we were um this is no shift okay so now we can connect these directly to the destination lines so this now becomes rd and this is now rd right so that's the no shift and let's do the no shift for the upper two bytes as well this is no shift outputs directly to rd did it again that's the no shift taken care of let's take care of shift left well with shift left if we're shifting left by 16 that means that all of these lines are grounded so i will just copy this over to here and we are done uh let's go to the upper bytes so with the upper bytes uh that's no shift with the upper bytes for shift left um obviously we're going to want these to be what well s8 16 through 31 fall off the end which means that this starts with s8 zero s8 zero and i believe i can copy that from somewhere copy that from here shorten delete these stick these back in it appears as though you lost some lines all right and now we can delete this and replace it with these and that's shift left taken care of so the only other thing to take care of is shift right now again with shift right because we're shifting by 16 the sign bit is going to be right in all the bits so we're just going to copy these over as the sign bit comes all the way here and uh it occurs to me that i didn't actually name this signal so i should give it a name i will call it sign and of course it's not really a sign it's more like the msp so let me just call it msp okay so that's shift right on the top for shift right on the bottom all we're going to be doing is let's see we're shifting by 16 which means all of these bits are going to fall off the end and we get s8 32 down to 16 so we can remove this we'll go find s8 31 i meant down to 16 so that's right here okay and i lost my bus entries so let me go get some or some okay great and then i can delete these replace them with rd okay so that's shift right that should be all of it taken care of so there's no shift shift left shift right we do have this to replace okay there's no shift there's shift left and i believe that should be that okay so this is the logic so we have in total uh 12 buffers for each of these columns and we have five columns so that's 60 buffers that's not too bad um it's it's not great but you know it's uh it's what we can do now i could have used 16 bit buffers um i think that's the one six what is it two four five or something like that um it's a chunkier chip and i think it may be actually more expensive than just two of these and these are fine um you know they're they're if i if i replace this with a single chip the chip will be wider so this way i get sort of narrower columns um i don't know if that's if i'm rationalizing or not um let's see we've got one and gate we've got two or gates we've got one hex inverter um and that is it oh yes uh a buffer we need an extra buffer so let me copy this buffer um why not just stick it right over here let's put it over there and to give me some room i'm going to move everything over and now kai kat is going to get a heart attack because i'm moving everything over all right all right great now uh let's see um there was a shift arith line so this one is actually prime this one is also uh prime you know what i am going to call this shift left and i'm going to call this one shift oh no because then i have to change it all over the place i'll just keep this at shift left a okay so i'm just going to call the shift left prime shift arith prime uh these are also going to become prime prime prime okay shift oe prime uh i'm going to need that to come in here shift oe prime it comes out as just plain old shift oe and i'm also going to need a shift arith that's going to come down here and this is going to become plain old shift arith buffered all right um going to need another few lines and well actually we're just going to need these so these come in over here right and then we have shift left prime which comes from here goes down to here let's make that a bus sort of a little control line bus i'll make this a bus accept take that rotate ahead and make that a bus okay now what are we going to enable this with well shift output enable um of course this one so uh let's see what i'm gonna want to do is pull this back a bit why does it do that it's like it's not really connected but i know it was okay and now we just take the shift output enable line and put it to the buffer so it basically buffers itself and also the rest of the control lines all right there's that shift oe signal which i can just take from here and bring it down to there if i wanted to okay um i don't think i'm going to take that line and bring it all the way up to these other shift oe lines um nor am i going to take the shift ariff and bring it up to all the way up here uh there is this rs 131 um which is it's not buffered but i think it'll be okay because it really is one load and i guess a buffer would be one load anyway i just need to remember to keep this close to the slot itself so that uh this line doesn't sort of go all over the place um there may actually be another issue which is that all of these source lines they travel basically to three buffers and they may in fact go a long way if they do go a long way then i'm going to have to add buffers for those 32 input lines as well so all right well the next thing that i need to do is add capacitors local capacitors these are basically um charge reservoirs for each of these chips because whenever they switch they use a lot of current and that current has to come from somewhere and if it just comes from a wire that goes to power well you're going to get a power drop so that's why we need some capacitors now rather than put the capacitors next to each symbol i am just going to uh so the first thing that i'm going to do is annotate everything so that all the chips get a reference designator so um how many chips are there in total well it looks like 64 um so the annotator goes first in the y direction and then in the x direction so this would be the last chip to be annotated so that's 64 chips so i'm going to need 64 little capacitors so what i'm going to do is i'm going to take a little capacitor and i'm going to give you a value so it's going to be 100 nanos and i'm going to replicate it uh say eight times that looks good connect the tops connect the bottoms go grab a ground signal where's my ground signal here's one um i'm just going to copy this whole thing so that i have all the signals all right copy this and put it somewhere in the middle and let's just copy one of the power signals and put it there now i can get rid of that okay now i have um these eight capacitors and now i'm just going to duplicate that eight times for 64 so now the nice thing about doing it this way is that all the uh decoupling capacitors are off to the side because they're not important to understanding the circuit and also they each get their own number so when i annotate them annotate we have c1 through c64 and that tells us which capacitor goes to which chip yes they're all the same and i could put them anywhere i want but this sort of lets me keep track of which chip uh got a capacitor placed next to it and which didn't so that's that um the other thing that i'm going to want to do is i'm going to want to add a bigger capacitor maybe even three of them the reason is that this is going to be one you know big card and we have all the little capacitors but if there's not enough charge or yeah if there's not enough charge in the capacitor well the chip is going to need to pull it through the capacitor and down to the the power lines that are coming from the slot well i'd rather them meet a larger uh charge um supply of charge so what i'm going to do is i'm going to take another capacitor except this time it's going to be a polarized capacitor and i'm just going to put three of them down and i'm going to give them a value uh let's call it um 10 micros is fine um i have a bunch of 47 micros uh let's just call it it doesn't actually matter they're all going to be roughly the same size just different heights so value 10 micros value 10 micros and i'll use you know that's just a minimum so we'll ground the negative end positive end at power and i kind of like to start these off at 100 luckily i don't have 100 chips you 100 you 100 and that's my three shit uh three large electrolytic capacitors okay the next thing that i like to do is um just run an electrical rules check to make sure nothing crazy happened all right multiple item yeah i did do that didn't i this is uh u 101 and this is u 102 great run a drc check and okay we've still got some problems here ah yes uh p1 that's our slot connector um we've got a whole bunch of no connects so what i need to do is uh delete the markers and put some no connects now the hot key for no connect is q and that was the wrong place which slows me down quite a bit so i'll stick uh maybe eight down now i'll copy it being careful just to hit the ends of the x's because otherwise i bring the slot along with me and that's no fun for anyone i need five x's here i need a whole bunch of x's here so i'll just grab a bunch and stick them over here and i've got four more here and five more here four over here three here and what's that six six here got a no connect in there all right we've got five here all of these are no connects all right save it and run drc again and we're done no errors except of course we don't actually know if this is going to work or not it looks like it's going to work okay so the next step here would be to create the printed circuit board so but this video has gone on long enough um you can go see part two when that comes up um but uh that is going to basically require um creating the pcb placing all the chips once i place all the chips uh then i'm going to have to go back to the schematic and usually what i do is i put the chips on both sides of the board because otherwise the board just gets huge um and once i put a a chip on the other side of the board that flips all of its pins around which means that uh this is no longer the optimal arrangement of pins so that means that i would have to flip this symbol around so basically i'm just going to go back and forth between the pcb and the schematic changing things around until things line up properly so until next time um i hope you enjoyed that and hopefully you just listen to that background to me in the background and you didn't just listen to me blather on for a couple hours um so until next time see ya