11 Pages

C_LC3examples

Course: CIT 593, Fall 2009
School: UPenn
Rating:
 
 
 
 
 

Word Count: 496

Document Preview

to/from C LC3 CIT 593 1 Example 1 int main() { int a = 0; int b = 5; int b = 2; int d = 1; a = b + c + d; } Assume that, a, b, c, d are initialized for you Write the LC3 code for a=b+c+d Answer on next slide. 2 Solution Example 1 a=b+c +d R5 LDR LDR LDR ADD ADD STR R1, R5, #2 R2, R5, #1 R3, R5, #0 R1, R1, R2 R1, R1, R3 R1, R5, #3 ;R1 = b ; R2 = c; ; R3 = d ; R1 = b + c ; R1 = R1 + d ; Store a d= 1 c=2...

Register Now

Unformatted Document Excerpt

Coursehero >> Pennsylvania >> UPenn >> CIT 593

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
to/from C LC3 CIT 593 1 Example 1 int main() { int a = 0; int b = 5; int b = 2; int d = 1; a = b + c + d; } Assume that, a, b, c, d are initialized for you Write the LC3 code for a=b+c+d Answer on next slide. 2 Solution Example 1 a=b+c +d R5 LDR LDR LDR ADD ADD STR R1, R5, #2 R2, R5, #1 R3, R5, #0 R1, R1, R2 R1, R1, R3 R1, R5, #3 ;R1 = b ; R2 = c; ; R3 = d ; R1 = b + c ; R1 = R1 + d ; Store a d= 1 c=2 b=5 a=0 Local variables get put onto stack in the order in which they appear. Since d is last, it goes on top of the stack 3 Example 2 int a[10] int x = 5; . Also assume that array a is initialized Write the LC3 equivalent code for a[x] = a[x + 1] Answer on next slide. 4 Solution Example 2 a[x] = a[x + 1] LDR R0, R5, #0 ; R0 = x ADD R0, R0, #1 ; R0 = x+1 ADD R1, R5, #1 ; R1 = &a[0] ADD R1, R0, R1 ; R1 =&a[x+1] LDR R2, R1, #0 ; R2 = a[x + 1] LDR R0, R5, #0 ; R0 = x ADD R1, R5, #1 ; R1 = &a[0] ADD R1, R0, R1 ; R1 = &a[x] STR R2, R1, #0 ; a[x] = R2 = a[x+1] 5 R5 x a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9] Example 3 struct temp{ int lowT; int highT; }; typedef struct temp T; int main( ){ T day; int avg; day.lowT = -1; .(1) day.highT = 15; .(2) .. return 0; } Write LC3 code for C code shown in lines (1) and (2) Answer on next slide. 6 Solution to Example day.lowT 3 = -1 & day.highT = 15 R5 AND R0, R0, #0 ADD R0, R0, #-1 AND R1, R1, #0 ADD R1, R1, #15 ADD R2, R5, #1 ;R2 = start of struct STR R0, R2, #0 ;day.lowT = R0 STR R1, R2, #1 ;day.highT = R1 avg day.lowT day.lowT day.highT day.highT 7 Example 4 In main( ) , the local variables are defined in the following order int a; int * b; int c ; Below is the LC3 code ADD R0,R5, #2 STR R0, R5, #1 LDR R1, R5, #1 LDR R1, R1, #0 ADD R1, R1, #1 STR R1, R5, #0 The LC3 code is doing something with a, b, c. Translate the LC3 code to C Answer on next slide. 8 Solution to Example 4 Equivalent C code b = &a; c = *b + 1; ADD R0,R5, #2 ; R0 = &a = addr of a STR R0, R5, #1 ; b = &a LDR R1, R5, #1 ; R1 = &a LDR R1, R1, #0 ; R1 = *b i.e. value of a ADD R1, R1, #1 ; R1 ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UPenn - CIT - 595
Sequential Logic CircuitsOutput depends on stored information (current state) and may be on current inputsExample:state = Score board of basketball game (number of points, time remaining, possession) input = which team scored the point output =
UPenn - CIT - 07
Data StructuresC allows a programmer to build a type that is a combination of more basic data type The collection of basic data types is called as data structureChapter 19 Data StructuresBased on slides McGraw-Hill Additional material 2004/2005
UPenn - CIT - 593
Data StructuresC allows a programmer to build a type that is a combination of more basic data type The collection of basic data types is called as data structureChapter 19 Data StructuresBased on slides McGraw-Hill Additional material 2004/2005
UPenn - CIT - 595
Motivation for Examining PerformanceHardware performance is often key to the effectiveness of an entire system of hardware and software Why certain piece of software performs the way it does? Why one instruction set can be implemented to perform bet
UPenn - CIT - 07
Assembly: Human-Readable Machine LanguageComputers like ones and zeros 0001110010000110 Humans like readable form Chapter 7Assembly LanguageADDOpcodeR6, R2, R6Dest Src1 Src2; increment index reg.CommentAssembler A program that turns h
UPenn - CIT - 593
Assembly: Human-Readable Machine LanguageComputers like ones and zeros 0001110010000110 Humans like readable form Chapter 7Assembly LanguageADDOpcodeR6, R2, R6Dest Src1 Src2; increment index reg.CommentAssembler A program that turns h
UPenn - CIT - 07
I/OFrom chapter 8 we know that I/O access is privileged as it involves accessing device registers. Normal programs asks another privileged program such as OS to perform I/O on its behalfChapter 18 I/O Part IBased on slides McGraw-Hill Modified
UPenn - CIT - 593
I/OFrom chapter 8 we know that I/O access is privileged as it involves accessing device registers. Normal programs asks another privileged program such as OS to perform I/O on its behalfChapter 18 I/O Part IBased on slides McGraw-Hill Modified
UPenn - CIT - 595
Outsourcing:The Rise of the EastHardware and Software JobsToday, if you tell people youre a programmer, theyll ask you how long you have until your employment benefits run out. Bill Blunden What is the future of American IT jobs? What are the
UPenn - CIT - 595
EvolvableHardwareBrenda Lin Mai IrieEvolvableHardware?!?In Most Simplest Terms: Reconfigurable Device + Evolutionary AlgorithmOkayWhat would you use it for? Circuit Design for Problems That are Difficult to Solve Using Conventional Methods Au
UPenn - CIT - 595
NoraApsel AdamRothblattWhat is User Interface Design? The process of planning and designing how users interact with computer systems. Applies to a wide variety of systems. Examples: Software Websites Remote Controls KiosksHuman-Computer In
UPenn - CIT - 07
Parallel Architectures in BiotechnologyNina Baron-HionisParallel Architecture OverviewTaxonomy SISD SIMD MISD MIMDCentralized Shared Memory Fewer then 3 dozen processors Share a single memory No processor has priority to use Does n
UPenn - CIT - 595
Parallel Architectures in BiotechnologyNina Baron-HionisParallel Architecture OverviewTaxonomy SISD SIMD MISD MIMDCentralized Shared Memory Fewer then 3 dozen processors Share a single memory No processor has priority to use Does n
UPenn - CIT - 593
#before: data1#Location Valuebf8ed457 abf8ed458 bbf8ed459 cbf8ed45a dbf8ed45b e#before: data2#bf8ed452 abf8ed453 bbf8ed454 cbf8ed455 dbf8ed456 ebf8ed
UPenn - CIS - 110
Midterm Grading Guidelines1a) All or nothing1b) -2 if no explanation -1 or -2 depending on the reasoning1c) -1 point for not providing definition of a constant -1 point for incorrect example of a constant3) -1 for saying only odd fo
UPenn - CIS - 110
CIS110 Summer 2008 Final Grading Guidelines1a,b,d All or nothing1c. -2 if 0 is not one of the answer -2 if n*(n+1) is not one of the answers2. -2 for each wrong true/false3a, b, c. -1.5 for wrong reason -1 for wrong location of
UPenn - CIS - 110
-Final base score stats:-min: 44.00max: 86.00mean: 67.92median: 70.50modes: [ there are too many ]std_dev: 11.70Histogram: 85.5- 90.0 : * 81.0- 85.5 : * 76.5- 81.0 : * 72.0- 76.5 : * 67.5- 72.0 : * 63.0- 67.5 : * 58.5- 6
UPenn - CIS - 110
-Midterm base score stats:-min: 35.00max: 64.50mean: 50.95median: 50.50modes: [47.00;55.50]std_dev: 8.84Histogram: 66.5- 70.0 : 63.0- 66.5 : * 59.5- 63.0 : * 56.0- 59.5 : 52.5- 56.0 : * 49.0- 52.5 : * 45.5- 49.0 : *
UPenn - CIS - 110
-Homework: Number Personalities base score stats:-min: 34.00max: 100.00mean: 84.48median: 92.00modes: [92.00;96.00;100.00]std_dev: 18.99Histogram: 95.0-100.0 : * 90.0- 95.0 : * 85.0- 90.0 : * 80.0- 85.0 : * 75.0- 80.0 :
UPenn - CIT - 07
Pointers and ArraysWe've seen examples of both of these in our LC-3 programs; now we'll see them in CChapter 16 Pointers and ArraysBased on slides McGraw-Hill Additional material 2004/2005 Lewis/Martin Modified by Diana PalsetiaPointerAddres
UPenn - CIT - 593
Pointers and ArraysWe've seen examples of both of these in our LC-3 programs; now we'll see them in CChapter 16 Pointers and ArraysBased on slides McGraw-Hill Additional material 2004/2005 Lewis/Martin Modified by Diana PalsetiaPointerAddres
UPenn - CIT - 593
Basic C ElementsVariables A data item upon which the programmer performs an operationChapter 12 Variables and OperatorsOperators Predefined actions performed on data items Combined with variables to form expressions, statementsBased on slid
UPenn - CIT - 593
What to expect?1.5 Hour Exam, Closed book and notes Anything specific needed will be provided LC3 ISA instructions ASCII tableFinal Exam ReviewConcentrate on material after midterm Similar format seen on quizes and midterm But LC3 ISA instru
UPenn - CIT - 595
HOMEBREW COMPUTING AND THE NINTENDO DS:Programming and Controlling a Dedicated-Purpose Computer SystemCraig Schroeder and Luke Walker CIT 595, University of Pennsylvania April 28, 2008ABSTRACTPortable video game systems are not only a multibill
UPenn - CIT - 07
RAIDTechnologyandDataStorageTodayJeffreyDoto BrandonKrakowskyth April15 ,2007AbstractWithinformationgenerationanddatatransferspeedatanalltimehigh,datastorageis fastbecomingoneofthefastestgrowingindustriesintheworld.Enterpriselevel corporations,e
UPenn - CIT - 595
RAIDTechnologyandDataStorageTodayJeffreyDoto BrandonKrakowskyth April15 ,2007AbstractWithinformationgenerationanddatatransferspeedatanalltimehigh,datastorageis fastbecomingoneofthefastestgrowingindustriesintheworld.Enterpriselevel corporations,e
UPenn - CIT - 07
CIT 595Grid ComputingVincent PoonUniversity of PennsylvaniaOby SumampouwUniversity of PennsylvaniaABSTRACT Grid computing brings the diverse resources of multiple administrative domains to bear on large scale computing problems. Recent advan
UPenn - CIT - 595
CIT 595Grid ComputingVincent PoonUniversity of PennsylvaniaOby SumampouwUniversity of PennsylvaniaABSTRACT Grid computing brings the diverse resources of multiple administrative domains to bear on large scale computing problems. Recent advan
UPenn - CIT - 595
System Software: Programming ToolsProgramming tools carry out the mechanics of software creation within the confines of the operating system and hardware environmentProgramming ToolsCIT 595 Spring 2008These include:Compiler & Assembler Transla
UPenn - CIT - 07
CIT595 ProjectA Study of Wearable ComputingBy: Fatima Boujarwah Laxmi Nair Kok Sung WonAbstractAs computers move from the desktop, to the palm top, and onto our bodies and into our everyday lives, infinite opportunities arise to realize applic
UPenn - CIT - 595
CIT595 ProjectA Study of Wearable ComputingBy: Fatima Boujarwah Laxmi Nair Kok Sung WonAbstractAs computers move from the desktop, to the palm top, and onto our bodies and into our everyday lives, infinite opportunities arise to realize applic
UPenn - CIT - 593
I/OFrom chapter 8 we know that I/O access is privileged as it involves accessing device registers. Normal programs asks another privileged program such as OS to perform I/O on its behalfChapter 18 I/O in C + MiscBased on slides McGraw-Hill Modif
UPenn - CIT - 595
Microprogrammed ControlEach machine instruction is in turn implemented by a series of instructions called microinstructions A microinstructions encodes Control signal for carry out a particular stage in the instruction cycle Next (likely) microinst
UPenn - CIT - 595
Speech RecognitionAlexis Baird and Michael Gibney CIT595 Final Project Proposal April 28th, 2008Table of ContentsSample Speech Recognizer Outputpage 3 Introduction.page 4 Applications.page 4 From Analog to Digital.page 5 Analysis of Phonemes.pag
UPenn - CIT - 595
MotivationData that is either transmitted over communication channel (e.g. bus) or stored in memory is not completely error freeError Detection and CorrectionCIT 595 Spring 2008Error can caused by: 1. Transmission ErrorsSignal distortion or at
UPenn - CIT - 595
What Do We Know?Already discovered: Gates (AND, OR.) Combinational logic circuits (decoders, mux) Memory (latches, flip-flops) Sequential logic circuits (state machines) Simple processors (programmable traffic sign)Processor Data Path and Con
UPenn - CIS - 630
Lecture notes by Edward Loper Course: CIS 630 (NLP Seminar: Structural Representations) Professor: Joshi Institution: University of Pennsylvania1Monday, January 15, 20010.1 Representationally Oriented Grammars(or Grammars for Analysis, Grammar
UPenn - CIS - 570
Lecture notes by Edward Loper Course: CIS 570 (Modern Programming Language Implementation) Professor: E Christopher Lewis Institution: University of Pennsylvaniahttp:/www.cis.upenn.edu/~eclewis/cis5701Monday, January 15, 2001Assignments: m
UPenn - LING - 554
Lecture notes by Edward Loper Course: Ling 554 (Type-Logical Semantics) Professor: Bob Carpenter Institution: University of Pennsylvania1Tuesday, October 3, 2000 1 Review of update semanticsdistinction between world knowledge & discoures l
UPenn - CIS - 630
Lecture notes by Edward Loper Course: CIS 630 (Lexical Semantics) Professor: Martha Plamer Institution: University of Pennsylvania1Tuesday, October 3, 2000 1 Karin Kipper: Word Sense DisambiguationComparison of 3 dierent approaches to word sens
UPenn - CIS - 639
Lecture notes by Edward Loper Course: CIS 639 (Statistical Approaches guage Processing) Professor: Mitch Marcus Institution: University of Pennsylvaniahttp:/www.cis.upenn.edu/~mitch/cis639.htmltoNaturalLan-1Logisticsgo over section III o
UPenn - CIS - 620
Lecture notes by Edward Loper Course: CIS 620 (Advanced Topics in AI) Professors: Michael Kearns and Lawrence Saul Institution: University of Pennsylvaniahttp:/www.cis.upenn.edu/~mkearns/teaching/cis620/cis620.html1Wednesday, January 9, 2002 1
UPenn - LING - 590
Lecture notes by Edward Loper Course: Ling 590 (Pragmatics I) Professor: Ellen Prince Institution: University of PennsylvaniaCheck the web page! check on ling talks? email to manager@ling.upenn.edu ask to be added to the pennguists mailing list.1
UPenn - CIS - 630
Lecture notes by Edward Loper Course: CIS 630 (Machine Learning Seminar) Professor: Fernando Pererez Institution: University of Pennsylvania1LogisticsOce hours: wed before class1.1Projectwrite a summary/somehting that will stand the test
UPenn - CIS - 700
AMPLITUDE CONVERGENCE IN CHILDRENS CONVERSATIONAL SPEECH WITH ANIMATED PERSONASRachel Coulston, Sharon Oviatt and Courtney DarvesDepartment of Computer Science and Engineering Oregon Health & Science University +1-503-748-1602; {rachel|oviatt|court
UPenn - CIS - 700
Mining a Lexicon of Technical Terms and Lay EquivalentsNoemie Elhadad and Komal Sutaria Computer Science Department The City College of New York New York, NY 10031 noemie@cs.ccny.cuny.edu, kdsutaria@gmail.com AbstractWe present a corpus-driven meth
UPenn - CIS - 430
A taxonomy of web searchbroder@us.ibm.com(Most of the work presented here was done while the author was with the AltaVista corporation.Andrei Broder IBM ResearchAbstract:Classic IR (information retrieval) is inherently predicated on users sear
UPenn - CIS - 700
(Proceedings, 1996 International Symposium on Spoken Dialogue, ISSD-96. Philadelphia, PA, pp. 41-44. Copyright 1996 by the Acoustical Society of Japan.)LEXICAL ENTRAINMENT IN SPONTANEOUS DIALOGSusan E. Brennan Department of Psychology State Unive
UPenn - CIS - 700
HOW DO SYSTEM QUESTIONS INFLUENCE LEXICAL CHOICES IN USER ANSWERS? J. Gustafson1, A. Larsson1, R. Carlson1 and K. Hellman2Department of Speech, Music and Hearing, KTH Box 70014, S-10044 Stockholm, Sweden Tel.:+46 8 790 7879 Fax: +46 8 790 7854 E-mai
UPenn - CIS - 700
Comprehending Technical Texts: Predicting and Dening Unfamiliar TermsNoemie Elhadad, Ph.D.Department of Computer Science, City College of New York, New York, NYWe investigate how to improve access to medical literature for health consumers. Our f
UPenn - CIS - 700
Modality Convergence in a Multimodal Dialogue SystemLinda Bell1, Johan Boye2, Joakim Gustafson1 and Mats Wirn2Centre for Speech Technology, KTH Drottning Kristinas vg 31, S-100 44 Stockholm, Sweden bell@speech.kth.se, jocke@speech.kth.se Telia Rese
UPenn - CIS - 700
gTheories of Discourse for modelling Conjunctive CohesionAdvaith SiddharthanResearch Associate Computer LaboratoryAdvaith Siddharthan May 17, 2006 p.1/48OverviewgTerminology Coherence vs Cohesion Conjunctive vs Anaphoric Rhetorical Structur
UPenn - CIS - 700
Read-X: Automatic Evaluation of Reading Difficulty of Web TextEleni Miltsakaki Graduate School of Education University of Pennsylvania, USA elenimi@gse.upenn.edu Audrey Troutt School of Engineering and Applied Science University of Pennsylvania, USA
UPenn - CIS - 700
Measuring Coherence1Running head: TEXTUAL COHERENCE USING LATENT SEMANTIC ANALYSISThe Measurement of Textual Coherence with Latent Semantic AnalysisPeter W. Foltz New Mexico State UniversityWalter Kintsch and Thomas K. Landauer University o
UPenn - CIS - 430
Language Identi cation: Examining the IssuesPenelope Sibun and Je rey C. Reynar y The Institute for the Learning Sciences Northwestern University 1890 Maple Avenue Evanston, IL 60201y zzDept. of Computer and Information Science University of Pe
UPenn - CIS - 430
Entropy of Search Logs: How Hard is Search? With Personalization? With Backoff?University of Illinois at Urbana Champaign Urbana,IL 61801Qiaozhu Mei qmei2@uiuc.educhurch@microsoft.eduthese large investments be wiped out if a small cache of a
UPenn - CIS - 430
CIS430November6,2008 EmilyPitler3NamedEntities 1or2words Ambiguousmeaning Ambiguousintent45MeiandChurch,WSDM20086Beitzelet.al.SIGIR2004 AmericaOnline,weekinDecember2003 Popularqueries: 1.7wordsOverall: 2.2words7Le
UPenn - CIS - 430
Some int er est ing dir ect ions in Aut omat ic Summar izat ionAnnie L ouis CI S 430 12/02/081Todays lect ur eM ult i-st r at egy summar izat ionI s one met hod enough?Per for mance Confidence Est imat ionWould be nice t o have an indicat io
UPenn - CIS - 430
Text categorization Feature selection: chi square test1JointProbabilityDistributionThejointprobabilitydistributionforasetofrandomvariablesX1Xn givestheprobabilityofeverycombinationofvaluesP(X1,.,Xn) Sneeze Cold 0.08 Cold 0.01Sneeze 0.01 0.9
UPenn - CIS - 430
Discourse, coherence and anaphora resolutionLecture 161What is discourse? Anypiece of text consisting of more than one sentence now our lectures revolved mainly around topics concerning word-level or sentence-level analysis. Until2Disc
UPenn - CIS - 430
ProbabilityTheory BayesTheoremandNaveBayes classification1DefinitionofProbabilityProbabilitytheoryencodesourknowledge orbeliefaboutthecollectivelikelihoodof theoutcomeofanevent. Weuseprobabilitytheorytotrytopredict whichoutcomewilloccurforagiven