210 likes | 218 Views
This article discusses the ethical considerations and potential consequences of releasing software that has not been fully tested, including the example of a medical device that caused harm. It also covers key concepts in computer engineering, such as abstraction, number representation, logic gates, memory, and finite state machines.
E N D
CS/ECE 252, Fall 2016 Kai Zhao Computer Sciences Department University of Wisconsin – Madison Introduction to Computer Engineering
Releasing Untested Software • Boss pressuring you to release software • Every day delay is $1 million in sales • Is it okay to release software not fully tested? • What if it’s a medical device? • A number of patients receive up to 100x the intended dose of radiation therapy in 1985-1987. 3 died as a direct results and 21 died the following years
Ethics Wrapup • Laws • Set of rules with civil and/or criminal penalties • can be enforced by governmental bodies • Ethics • Set of standards, usually voluntary • Discussion • Usually, no clear right and wrong • Choose between competing interests
Recap Story behind Quote of the Day Quote of the Day: “It is a good thing for an uneducated man to read books of quotations.” -- Sir Winston Churchill 1874 - 1965
Operating System CS537 Chapter 1: Abstraction and Complexity • Abstraction helps us manage complexity • Complex interfaces • Specify what to do • Hide details of how Application Program CS302 Compiler CS536 Machine Language (ISA) CS/ECE354 • Goal: Use abstractions yet still understand details Computer Architecture CS/ECE552 Scope of this course Digital Design CS/ECE352 Electronic circuits ECE340
Chapter 2: Number Representation • 2’s complement representation
Chapter 2: Hexadecimal and Operations Hexadecimal table Addition 01101000(104) 11110110(-10) + 11110000(-16) + (-9) 01011000(98) (-19)
Chapter 3: Transistor Supply Voltage Output Gate Gate Output Ground N-type transistor P-type transistor
Chapter 3: implementing truth tables w/ logic gates 1. AND combinations that yield a "1" in the truth table. 2. OR the resultsof the AND gates.
Chapter 3: Memory • R is used to “reset” or “clear” the element – set it to zero. • S is used to “set” the element – set it to one. • If both R and S are one, out could be either zero or one. • “quiescent” state -- holds its previous value • note: if a is 1, b is 0, and vice versa 1 1 0 1 1 0 1 0 1 out 1 out 0 0 1 1
Chapter 3: Finite State Machine A description of a system with the following components: • A finite number of states • A finite number of external inputs • A finite number of external outputs • An explicit specification of all state transitions • An explicit specification of what causes eachexternal output value.
Chapter 6: Programming via Iterative Refinement Decompose task into a few simpler subtasks. There are three basic ways to decompose a task:
Chapter 6: Debug by Tracing execute instruction sequences set/display registers set/display memory set breakpoints
Chap7: Char Count in Assembly Language (1 of 3) ; ; Program to count occurrences of a character in a file. ; Character to be input from the keyboard. ; Result to be displayed on the monitor. ; Program only works if no more than 9 occurrences are found. ; ; ; Initialization ; .ORIG x3000 AND R2, R2, #0 ; R2 is counter, initially 0 LD R3, PTR ; R3 is pointer to characters GETC ; R0 gets character input LDR R1, R3, #0 ; R1 gets first character ; ; Test character for end of file ; TEST ADD R4, R1, #-4 ; Test for EOT (ASCII x04) BRz OUTPUT ; If done, prepare the output
Chap7: Char Count in Assembly Language (2 of 3) ; ; Test character for match. If a match, increment count. ; NOT R1, R1 ADD R1, R1, R0 ; If match, R1 = xFFFF NOT R1, R1 ; If match, R1 = x0000 BRnp GETCHAR ; If no match, do not increment ADD R2, R2, #1 ; ; Get next character from file. ; GETCHAR ADD R3, R3, #1 ; Point to next character. LDR R1, R3, #0 ; R1 gets next char to test BRnzp TEST ; ; Output the count. ; OUTPUT LD R0, ASCII ; Load the ASCII template ADD R0, R0, R2 ; Covert binary count to ASCII OUT ; ASCII code in R0 is displayed. HALT ; Halt machine
Chapter 9.2 Subroutines ; CountChar: subroutine to count occurrences of a charCountChar ST R3, CCR3 ; save registers ST R4, CCR4ST R7, CCR7 ; JSR alters R7ST R1, CCR1 ; save original string ptr AND R4, R4, #0 ; initialize count to zeroCC1 JSR FirstChar; find next occurrence (ptr in R2) LDR R3, R2, #0 ; see if char or null BRz CC2 ; if null, no more chars ADD R4, R4, #1 ; increment count ADD R1, R2, #1 ; point to next char in string BRnzp CC1CC2 ADD R2, R4, #0; move return val (count) to R2 LD R3, CCR3 ; restore regs LD R4, CCR4 LD R1, CCR1 LD R7, CCR7 RET ; and return
Chapter 8: I/O Control/Status Registers • CPU tells device what to do -- write to control register • CPU checks whether task is done -- read status register Data Registers • CPU transfers data to/from device Device electronics • performs actual operation • pixels to screen, bits to/from disk, characters from keyboard Graphics Controller Control/Status CPU Electronics display Output Data