Pseudo-ops, Debugging, etc.

Slides:



Advertisements
Similar presentations
CS 300 – Lecture 19 Intro to Computer Architecture / Assembly Language C Coding & The Simulator Caches.
Advertisements

P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
Lecture 18 Page 1 CS 111 Online Design Principles for Secure Systems Economy Complete mediation Open design Separation of privileges Least privilege Least.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Fractions, Decimals, and Percent By: Jack M 1 _____ %
ICAPRG301A Week 4Buggy Programming ICAPRG301A Apply introductory programming techniques Program Bugs US Navy Admiral Grace Hopper is often credited with.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
1 CS232: Computer Architecture II Fall 2011 Intel i7 Quad-core.
Intermediate 2 Computing Unit 2 - Software Development Topic 2 - Software Development Languages and Environments.
Testing CSE 160 University of Washington 1. Testing Programming to analyze data is powerful It’s useless (or worse!) if the results are not correct Correctness.
Control Structures Computer Organization I 1 October 2009 © McQuain, Feng & Ribbens Conditional Control Structure if ( i < j ) goto A; else.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
TDD Unit tests from a slightly different point of view Katie Dwyer.
Mental Arithmetic Strategies Scotts Primary School. Mental Arithmetic Scheme.
Virtual Memory: Implementing Paging
Memory – Caching: Writes
Programs, Instructions, and Registers
Component 1.6.
Assembler, Compiler, MIPS simulator
14 Compilers, Interpreters and Debuggers
C – Multi-file development and make
CS/COE 0447 (term 2181) Jarrett Billingsley
Mental Arithmetic Strategies
Pseudo-ops and Bitwise Operations
BIT116: Scripting Lecture 06
Hexadecimal, Signed Numbers, and Arbitrariness
Virtual Memory: the Page Table and Page Swapping
CS/COE 0449 (term 2174) Jarrett Billingsley
Introduction to programming
CS/COE 1541 (term 2174) Jarrett Billingsley
Functions and the Stack
Pipelining – Out-of-order execution and exceptions
Engineering and Debugging an App Chapter 15
CS/COE 1541 (term 2174) Jarrett Billingsley
Testing and Debugging.
CS/COE 0447 (term 2181) Jarrett Billingsley
Machine code Recall that all a computer recognises is binary code.
Binary Addition and Subtraction
A451 Theory – 7 Programming 7A, B - Algorithms.
How to multiply decimals by whole numbers and by other decimals!!
Programs – Dynamic Linking and Loading
The Interconnect, Control, and Instruction Decoding
Proofreading Tips: First, I would say try to get someone else to read what you wrote. A fresh pair of eyes will often see a mistake that you have skipped.
Introduction CSE 1310 – Introduction to Computers and Programming
Binary, Hex, and Arbitrariness
Teaching Computing to GCSE
Testing UW CSE 160 Spring 2018.
Teaching Computing to GCSE
Pick up the handout on your way in!!
CS/COE 0449 Jarrett Billingsley
Words and Actions Can Hurt
Testing UW CSE 160 Winter 2016.
Bitwise Operations and Bitfields
More Functions and the Stack
CSCE 489- Problem Solving Programming Strategies Spring 2018
File Management How to stay organized 1. Click the Slide Show Tab
CS/COE 0447 Jarrett Billingsley
Multiplication and Division
Programming.
The Register File and ALU
Multicycle and Microcode
FSMs, Multiplication, and Division
Arithmetic and Decisions
Pipelining, Superscalar, and Out-of-order architectures
Tonga Institute of Higher Education IT 141: Information Systems
LONG MULTIPLICATION is just multiplying two numbers.
Conditionals and Functions
Tonga Institute of Higher Education IT 141: Information Systems
Conditional Control Structure
Presentation transcript:

Pseudo-ops, Debugging, etc. CS/COE 0447 Jarrett Billingsley

Class announcements CS447

Pseudo-ops (pseudo-instructions) CS447

I lied. move li la mul a, b, c blt/gt/le/ge lw _, (t0) lw _, var many of the instructions you've learned so far do not really exist. these are pseudo-ops. they're convenient shorthand for common operations, for our squishy human brains why did we learn these? they're useful they hide some of the confusing ugliness of the "real" instruction set they let me teach things in a better order move li la mul a, b, c blt/gt/le/ge lw _, (t0) lw _, var CS447

What's really going on here? they're translated by the assembler into real MIPS instructions never touch the 'at' register – it's used by the assembler for this you can see the real instructions in the Execute tab's code view - you will see some online resources where they don't use any pseudoinstructions and I don't really know why - but doing e.g. "add a0, zero, t0" is longer and doesn't convey intent like "move a0, t0" so CS447

Do we have to know what the real instructions are?? nnnooooooooooooo (dumb details you will never use) but you'll notice that sometimes, "one" instruction is more than one. this illustrates an important concept: abstraction is about hiding details… but it always incurs a cost. abstraction makes it easier to understand a program's behavior, but harder to predict its performance. also, it's way easier to improve the performance of abstract code than it is to abstract high-performance code. - performance isn't always the goal – it rarely is – but if it is a goal, keep this in mind. CS447

Why have pseudo-ops at all? changing hardware is hard, changing software is easy rather than embedding all these instructions in hardware… we make software (the assembler) that handles it for us what if we could make our own pseudo-ops? (you can!) (look up macros in the MARS help) - macros are NOT functions, they're smart copy-and-paste - doing complicated things with macros is difficult because you have to hard-code registers into them – not great CS447

Debugging CS447

What is debugging? How many perfect, 100% correct programs have you written? How about on the first try? Guess what: no one does. Debugging is not just "fixing bugs." It helps you… …understand your program more deeply. …question your assumptions about how the computer works. …consider possible cases you had forgotten to handle. - and it helps you realize that although you fixed this one bug, oh no, you made the same mistake in 300 places throughout your code D: CS447

"printf debugging" System.out.println("got here4"); it's a little trickier in assembly, but… well, check out print_str_macro.asm on the examples page. hey, this might be useful for more than just debugging… CS447

Breakpoints see this "Bkpt" column on the left? a breakpoint makes the program pause when that line is about to be run. a lot of "I got here" prints can be replaced by these. you can resume running after it pauses. CS447

Well, that's… MIPS CS447

Wait, really? yeah. assembly is not a complex language. but that's what makes it so hard to use. now gaze into the project 1 abyss and scream no okay let's do some practice and answer questions CS447