Presentation is loading. Please wait.

Presentation is loading. Please wait.

March 2005 1R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Class on Wednesday – “Lab time” in OSS 230Class on Wednesday – “Lab.

Similar presentations


Presentation on theme: "March 2005 1R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Class on Wednesday – “Lab time” in OSS 230Class on Wednesday – “Lab."— Presentation transcript:

1 March 2005 1R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Class on Wednesday – “Lab time” in OSS 230Class on Wednesday – “Lab time” in OSS 230 ExamExam Data RepresentationData Representation C and Assignment 11C and Assignment 11

2 March 2005 2R. Smith - University of St Thomas - Minnesota LAB Time – Assignment #11 Assignment #11 will be due Midnight, Wed.Assignment #11 will be due Midnight, Wed. I’ve borrowed OSS 230 for next WednesdayI’ve borrowed OSS 230 for next Wednesday Class will be a “Lab Session” in OSS 230Class will be a “Lab Session” in OSS 230 You can work on Assignment #11You can work on Assignment #11 You can ask for programming helpYou can ask for programming help

3 March 2005 3R. Smith - University of St Thomas - Minnesota Exam Stats 80 points total Median score: -9 (89%)

4 March 2005 4R. Smith - University of St Thomas - Minnesota Comments on Answers #1 – everyone got In/Out right#1 – everyone got In/Out right –For the instructions – top 3 rows match bottom 3 rows (why?) –Individual mistakes seemed random – lots of the #2 – formats without registers (so what?)#2 – formats without registers (so what?) –Register location only matters when registers are used #3 – using MOV as an example#3 – using MOV as an example –MOV is the Pentium Load/Store – should use arithmetic #4, 5 – everyone found the section in the book#4, 5 – everyone found the section in the book #6 – Most people got this#6 – Most people got this #7 – Omitting the 512 bits of data#7 – Omitting the 512 bits of data –Index and offset bits NOT included in references

5 March 2005 5R. Smith - University of St Thomas - Minnesota More Answer Comments #8 – Full credit if #7 was multiplied by 4#8 – Full credit if #7 was multiplied by 4 –Should have 4 index values and 4 ‘valid’ bits #9-11 – Most people got this right#9-11 – Most people got this right #12 – Not in the book; in the lectures#12 – Not in the book; in the lectures –Page table size <> page table offset, but I accepted either

6 March 2005 6R. Smith - University of St Thomas - Minnesota Data Representation Implicit in a lot we’ve doneImplicit in a lot we’ve done How do we choose a representationHow do we choose a representation –Range of numbers to solve the problem –Types of data used in solving the problem –Amounts of data Numerical size/format is a classic problemNumerical size/format is a classic problem –Fixed vs floating –Number of bits of precision

7 March 2005 7R. Smith - University of St Thomas - Minnesota Other Representations Text representation: solved by traditionText representation: solved by tradition –There used to be lots of text formats EBCDIC, BCD, TTY codes, ASCIIEBCDIC, BCD, TTY codes, ASCII –ASCII is now the least common denominator The one dispute: how to mark the end of a lineThe one dispute: how to mark the end of a line –Unicode is a growing contender (what IS Unicode?) Text-to-Binary: hex, octal, decimal, bits?Text-to-Binary: hex, octal, decimal, bits?

8 March 2005 8R. Smith - University of St Thomas - Minnesota Choosing a representation What does the application work with?What does the application work with? –Numbers? What rangesWhat ranges Role of fractions and fractional precisionRole of fractions and fractional precision External representation: decimal, hex, octal, binary..?External representation: decimal, hex, octal, binary..? –Text? What languages?What languages? –Unicode vs ASCII Form of text?Form of text? –Straight strings? –Blocks of text? –How to handle newlines? –Symbolic values? – it’s up to you, then

9 March 2005 9R. Smith - University of St Thomas - Minnesota I/O makes a program ‘interesting’ #include #include getchar() returns the next charactergetchar() returns the next character –Greater than zero is a character –Treat 0 as end of file –Look for ‘\n’ to find the end of a line putchar(ch) writes the character ‘ch’ to outputputchar(ch) writes the character ‘ch’ to output –Again, ‘\n’ starts a new line printf(“Text string\n”)printf(“Text string\n”) –Prints text strings –Can also do outbound number conversion

10 March 2005 10R. Smith - University of St Thomas - Minnesota Inbound Number Conversion A good exerciseA good exercise –Gets us thinking about the difference between numbers and their representations –We can generalize this to all bases Num = (Num * Base) + (NextChar – ‘0’)Num = (Num * Base) + (NextChar – ‘0’) Just loop till NextChar isn’t a digit.Just loop till NextChar isn’t a digit.

11 March 2005 11R. Smith - University of St Thomas - Minnesota Parts of the problem Distinguish digits and non-digitsDistinguish digits and non-digits Convert digits to binary representationConvert digits to binary representation Where does the typed number end?Where does the typed number end? What variables do we need?What variables do we need? What kind of loop do we use?What kind of loop do we use? How do we prove it worked?How do we prove it worked? –printf(“Converted value: %d \n”);

12 March 2005 12R. Smith - University of St Thomas - Minnesota Embellishments Variable base conversion (base 2 thru 9)Variable base conversion (base 2 thru 9) How do we do hex and beyond?How do we do hex and beyond?

13 March 2005 13R. Smith - University of St Thomas - Minnesota That’s it. Questions?Questions? Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.


Download ppt "March 2005 1R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Class on Wednesday – “Lab time” in OSS 230Class on Wednesday – “Lab."

Similar presentations


Ads by Google