CS2340.006 Computer Architecture
Fall 2022

Instructor: John Cole
Section 006 Monday/Wednesday from 10:00 AM to 11:15 AM
Office and Hours  Room: ECS South 2.311

Teaching Assistant: None

Last update: 5/29//2022
Syllabus is on Coursebook Schedule
Textbook: Computer Organization and Design, MIPS Version, sixth edition, by Patterson & Hennesey

Some consider this to be a difficult course, in part because of the low level of abstraction.  It requires a lot of work and a different way of looking at computers and programming.  On the plus side, your instructor is available outside of class, conducts review sessions, and is very knowledgeable and helpful.  So get ready to work right down on the bare metal!

Given the low level of abstraction, a 32-bit value represents exactly one thing: a 32-bit value.  What it "means" is entirely up to you.  It may be a counter, the address of the start of a list of numbers, a subroutine return address, anything.  One of the things you will figure out quickly in this class is that if you don't understand C++ pointers you will be at a serious disadvantage. If you are not clear on binary arithmetic or basics like how many bits are in a byte, take some time to review. 

Up to this point, all of your programming courses have used high-level languages with many built-in functions, classes, and other constructs that hid the inner workings of the computer from you.  Those things are great, and make it easy to write code that focuses on the task at hand.  Consider, though, that someone had to write those library functions, or the low-level drivers in the operating system, or the embedded code in your thermostat, and often at least some of that is written in assembly language.  Also consider that if you are going to understand cybersecurity, this level of comprehension of how processors actually work is essential.  Thus the need for a course in the details of computer architecture.  And besides, are you not curious as what is really going on inside the box?

As to background, I have written a great many programs in various assembly languages, starting with the Univac 1108 mainframe and, most recently, MIPS in preparation for teaching this course.  You may also be aware that at least once a year I give an introductory tutorial on x86 assembly language to the Computer Security Group.  Thus one of the unstated objectives is to teach you how to write good assembly code, not just hack together something that mostly works. This means, among other things:
  • Writing modules that assemble separately
  • Writing clean, coherent, commented, readable code, not spaghetti code
  • Using the .eqv directive and constructs like '\n' instead of the number 10 so you don't have magic numbers in your code
  • Optimizing the use of registers to make your code run fast
  • Error handling
As with any course I teach, you will do a lot of programming, which is the only way to learn how to program. (As the immortal Fred Brooks told one of his classes, "If you want to learn software engineering you have got to go out there and do software engineering.") This course will also require considerable reading.  If you do not read the textbook, you will most likely fail the course.  Trying to slide by using only the PowerPoint slides is also a really bad idea. 

Since assembly language has no built-in functions the way Java and C++ do, you will have to write these.  The good news is that if you write, say, a string copy function, you can reuse it if you need it in another assignment for this class.  (You still can't use one someone else wrote.)

I will be taking attendance, and although it will not figure directly into your grade, I tend to be unsympathetic to poor students who miss a lot of classes.

Here is a link to a hilarious article on the value of systems programming, which goes to the edge of the abyss of how things work and dives in:
The Night Watch

Course Topics in Detail

This course will teach you how to understand and write programs in assembly language.  While this is specific to the MIPS processor, the general techniques will be applicable to most machines.  Topics include:

  1. Basic design of modern stored-program digital computers
  2. Numbering systems and numeric formats, including floating-point numbers represented in binary
  3. Instruction set architecture
  4. Register set
  5. Assembly-language directives
  6. System calls for operating system functions
  7. Translation from C to assembly language
  8. Translation from assembly language to machine code
  9. Performance calculation
  10. Memory hierarchy
  11. Processor data path and pipelining
Assembly language coding conventions

1. Use tabs.  Labels should be in column 1.  Instructions and directives should be tabbed to column 10 or 11.  Operands should be tabbed to column 18.

2. Comments on individual instructions should be tabbed to about column 30, and on the same line, not the line above.  Block comments should start with the # in column 1, a space, then the comment.

3. Use margins, especially for block comments.  Don't go past column 80.  New lines are cheap, and I don't want to side-scroll to read your comments.  This is assuming you write comments.  Uncommented code is wrong.

4. Do not indent assembly code.  There is no structuring the way you would structure C++ or Java, and it makes it less readable, not more.  See the Documentation Standards for clarification and examples.

5. Use meaningful labels.  "Do" and "while" and "loop" are not meaningful.  One convention is to use the name of the function, such as printArray, and internal labels use that name with numbers following.  Again, examples are in the documentation standards.

6. Re-read the slides from Appendix A.


Get the MIPS simulator here: http://courses.missouristate.edu/kenvollmar/mars/

Exam Rules