many ways to build logic out of mosfetshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... ·...
TRANSCRIPT
![Page 1: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/1.jpg)
ManywaystobuildlogicoutofMOSFETs
passtransistorlogic(mostsimilartothefirstswitchlogicwesaw)
staticCMOSlogic(whatwesawlasttime)
dynamicCMOSlogic• Clock=0precharges X
throughthepMOS• clock=1givesthetwo
nMOS timetodrainchargeonXtoground(ifAandBturnthemon)
Wikimediacommons
![Page 2: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/2.jpg)
Switchesotherthantransistors
relays(electro-mechanical)
diodes
ORgate
Wikimediacommons
![Page 3: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/3.jpg)
CS2630ComputerOrganization
CombinationallogicforarithmeticBrandonMyers
UniversityofIowa
![Page 4: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/4.jpg)
Peerinstruction• Drawthecircuitforthefollowingtruthtable(thisonehas2inputs,2outputs)
In0 In1 Out0 Out1
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Answerthenumberoflogicgatesusedwhenfinished;workinpairs
![Page 5: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/5.jpg)
Wherewearegoing
Instructionsetarchitecture(e.g.,MIPS)
Compiler
Memorysystem I/OsystemProcessor
Datapath&Control
Digitallogic
translatingsourcecode(CorJava)ProgramstoassemblylanguageAndlinkingyourcodetoLibrarycode
HowthesoftwaretalksTothehardware
HowaprocessorrunsMIPSPrograms!
Howswitches(1or0)canbeusedtobuildInterestingfunctions:fromintegerarithmetictoprogrammablecomputers
![Page 6: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/6.jpg)
Ingredientsforaprocessor• Combinationallogic• arithmeticandbitwiseoperations• multiplexors(pick1outofofNinputs)• controllogic• branchcalculation• addresscalculation
• Synchronouslogic(we’llgettotheselater)• registers• programcounter,orPC• datamemory• instructionmemory
startlearninghowtobuildthesecombinationallogiccircuits
![Page 7: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/7.jpg)
Howdoweaddtwonumbersaddu $t0,$t1,$t2
Weknow:Thenumbersarephysicallystoredinregistersasbits
Thesumoftwonumbersisafunctionwecanimplementusingcombinationallogic
![Page 8: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/8.jpg)
Startwitha1-bitadder
+
Sum
Carryout
A BCarryin
![Page 9: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/9.jpg)
Peerinstruction:2-bitadder
+2-bit
Sum0
Carryout
A0B0Carryin
Sum1
A1B1
NumberofrowsoftruthtableforSum1outputof2-bitadder?
![Page 10: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/10.jpg)
Howmanyrowsinthistruthtable?
4GBmemoryx8bit/byte=32Gbits
32registersx4Bytex8bit/byte=1Kbit
PCregisterx4Bytex8bit/byte=32bits
processortakesonestepfromcurrentstatetonewstate.Howmanyrowsinthetruthtableofbit0?
https://commons.wikimedia.org/wiki/File:Performance_PIPER_die.JPG
currentstate(theinput)
newstate(theoutput)
![Page 11: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/11.jpg)
Administrivia• 2MidtermpracticesareonICON• takethemlikearealexamandthen checkyouranswerswiththesolutions
• DebugYourBrainnextWednesdaywillbededicatedtoreview• extraofficehour4-5pmonMonday2/27,tobededicatedtoHW3
• Reminder:Midterm3/6• opennotesopenbook,nodevices
![Page 12: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/12.jpg)
![Page 13: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/13.jpg)
https://en.wikipedia.org/wiki/Field-programmable_gate_array
Lookuptable(LUT)– aprogrammabletruthtableinhardware!
“3-LUT”means3inputs(somustprogram8rows)
Field-programmablegatearray(FPGA)
1-bitadder
programmableMUXselectsinputs
analternativetomanufacturingyourownsiliconchip
![Page 14: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/14.jpg)
CS2630ComputerOrganization
AddersandtimingBrandonMyers
UniversityofIowa
![Page 15: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/15.jpg)
Howhumansaddtwonumbers• compute65210 +36710 onpaper
• compute110102 +010112 onpaper
![Page 16: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/16.jpg)
Buildinglargercircuitsoutofcomponents:2-bitadderbuiltfrom1-bitadders
+
Sum0
C1
A0 B00
+
Sum1
C2
A1 B1individualcomponentshavetheirownsmalltruthtables;thenwejustcombinethecomponents
![Page 17: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/17.jpg)
32-bitadder
+
Sum0
A0 B00
+
Sum1
A1 B1
+
Sum2
A2 B2
+
Sum31
A31 B31
…
Reflect:WenowhaveacircuitforA+B.WhatisasmallchangewecanmaketogetA-B?
![Page 18: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/18.jpg)
Undertherugofcombinationallogic:computationtime
![Page 19: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/19.jpg)
PropagationdelaythroughlogicgatesResistor-capacitor(RC)modelofNOTgatewhengiveninput0
1à0 0à1
inputchanges
R
C
1à0 0à1
![Page 20: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/20.jpg)
ChargingacapacitorinanRCcircuit
https://www.quora.com/How-does-a-RC-circuit-work-especially-the-charges-on-the-capacitor
![Page 21: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/21.jpg)
PropagationdelaythroughlogicgatesResistor-capacitor(RC)modelofNOTgatewhengiveninput0
1à0 0à1
inputchanges
R
C
Whentheinputchangesfrom1to0,thereisadelaybeforetheoutputoftheNOTgatereaches1
drainingthecapacitorwheninputgoes0à1
0à1
1à0 0à1
![Page 22: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/22.jpg)
Backuptotheleveloflogicgates• InCS2630,whenwethinkaboutdelay,we’llusethefollowingsimplifiedmodel• propagationdelayishigherformorecomplexgates• propagationdelayincreaseswiththenumberofinputstoagate
• e.g.,2-inputORgateisfasterthana3-inputORgate• propagationdelayofasequenceofgatesisadditive• allinputsmustbeavailablebeforelogicgatebeginscomputing
T=0 T=0.5 T=1 T=1.5
Example:assumedelayofinverteris0.5ns
![Page 23: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/23.jpg)
Delayofaddercircuit
+
Sum0
A0 B00
+
Sum1
A1 B1
+
Sum2
A2 B2
+
Sum31
A31 B31
…
1-bitadderdelay:sum=21-bitadderdelay:carry=1
Peerinstruction:delaytogetSum31?
![Page 24: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/24.jpg)
Delayofaddercircuit
+
Sum0
A0 B00
+
Sum1
A1 B1
+
Sum2
A2 B2
+
Sum31
A31 B31
…
1-bitadderdelay:sum=21-bitadderdelay:carry=1
Thisadderiscalled“ripplecarryadder”
![Page 25: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/25.jpg)
Next…• Wenowknowhowonekindofadderworksandhowlongittakestocomputetheresult• Canwebuildfasteradders?Yes!Usehierarchy/trees
![Page 26: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/26.jpg)
Administrivia• Reminders:• extraofficehour4-5pmtodayforHW3• DYBthisweekdedicatedtoreview• MidtermonMonday3/6:opennoteopenbook,nodevices
![Page 27: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/27.jpg)
Carry-selectadder
![Page 28: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/28.jpg)
Peerinstruction
WhatisthedelayfromthetimeAandBareavailabletowhenSumisavailable?
delays:sum:1carry:1mux:1
![Page 29: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/29.jpg)
Administrivia• Reminders:• DYBtonight6-7pmdedicatedtoreview
• bringyourprioritizedlistofspecificproblemsorquestionsthatyou’dliketoreview
• itwillbemostusefulifyoutakethepracticeexam(s)first• MidtermonMonday3/6:opennoteopenbook,nodevices
![Page 30: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/30.jpg)
Peerinstruction
WhatisthedelayfromthetimeAandBareavailabletowhenSumisavailable?
delays:sum:1carry:1mux:1
1
1
22
3
3
1
1
11
2
4
4
timesignalisavailableshowninred/bold
![Page 31: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/31.jpg)
http://www-inst.eecs.berkeley.edu/~cs150/sp13/agenda/lec/lec20-adders.pdf
computecarries
usecarriestofinishthesums
Bestcasedelayofadders?O(logn)pmeans“propagateacarry”gmeans“generateacarry”
important:pandgarenotfunctionsofc
![Page 32: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/32.jpg)
Bestcasedelayofadders?O(logn)
http://www-inst.eecs.berkeley.edu/~cs150/sp13/agenda/lec/lec20-adders.pdf
computecarries
usecarrys tofinishthesums
criticalpath
![Page 33: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/33.jpg)
Multiplication• Evaluate50110 x42210 onpaper
• Evaluate11002 x10012 onpaper
![Page 34: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/34.jpg)
Aside:usefullogiccircuitnotation
![Page 35: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/35.jpg)
Shiftingbyaconstant
![Page 36: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/36.jpg)
Variableshifter:firstattemptwith1-bitmuxes
![Page 37: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/37.jpg)
Variableshifter,similardesignwith8-bitmux
Canyouthinkofadesignthatavoidsusingahuge8-bitx8-choicemux?
e.g.,usingonly8-bitx2-choicemuxes andhardwiredshifters?
hardwiredshiftsbyeachpossibleshiftamount
pickwhichoneusingtheshiftamount
![Page 38: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/38.jpg)
Multi-stageshifterusingthemagicofbinarydecision-making• Hint:RecalltheenvelopesfromHW1
anothersolution(butusesmore2-inputMUXs)istobuildthe8-inputMUXonthepreviousslideusing2-inputMUXs,likeasoccertournamentwith8teamsandonechampion
![Page 39: Many ways to build logic out of MOSFETshomepage.cs.uiowa.edu/~bdmyers/cs2630_sp17/public/... · 2017. 3. 1. · Back up to the level of logic gates •In CS2630, when we think about](https://reader035.vdocuments.us/reader035/viewer/2022071508/612972a5e7eced36460a03c9/html5/thumbnails/39.jpg)
Peerinstruction• Builda2-bitmultiplier(4-bitoutput)• youmayuseanynumberof
• exampletestcases:• 01*01=0001• 10*01=0010• 10*11=0110• 11*11=1001