wk01-L01~ wk03-L04

Basic concepts

1 Properties of algorithms

  1. definiteness to describe the notion that each step is precisely stated.
  2. effective computability to describe the notion that each step can be carried out by a computer.
  3. ftniteness to describe the notion that the procedure terminates.

2 Assembly language

can not be ambiguous

3 ISA

Definition:

• The ISA is an abstract model of a computer that serves as the interface
between software and hardware
• It specifies the set of instructions carry out by the computer

Things specified

  1. ISA specifies the set of instructions the computer can carry out.
  2. ISA specifies the acceptable representation for operands(data types).
  3. ISA specifies the mechanisms that a computer can use to figure out where the operands are located(addressing modes).
  4. ISA specifies the number of unique locations that comprises the computer’s memory and the number of individual 0s and 1s that contained in each location.

Key Decisions

operations, operands, instruction set

Instruction cycle

在这里插入图片描述

4 High level and low level language

Difference: High level languages are easier to comprehend and are machine indepedent.

5 Why is nature language unsuitable for programming

They are ambiguous and computers can not interpret them.

6 Why is 2’s complement more widely used

  1. It is easier for arithmetic circuit to calculate.
  2. 2’s complement has only one representation for zero while 1’s complement and signed magnitute have two.

7 Turing Machine

one characteristic:

Turing thesis: be able to solve any kinds of problems if given enough time and memory because Turing Machine is programmable.
But this thesis has never been proved.

definition:

Abstract computer model: Performed logical operations
Hypothetical model: mathematically defined mechanical procedure (algorithm)
Infinite tape could be read, written to, and erased; precursor to today’s RAM

8 Matherboard

component: CPU, RAM, ROM, cache(缓存), Slots(插槽) for expansion
cards, Network interface card (NIC)(网卡)

CPU

  1. The Control Unit: Manages switches inside CPU.
  2. The System Clock: Moves CPU from one stage to the next, acts as metronome, keeping steady beat or tick.
    tick known as clock circle, set the pace.
    pace known as speed is measured in hertz
    tick 就是computer工作一次的时间,所谓工作一次就是所有的status改变一次(1到0,0到1,或不变)。其倒数是pace就是一秒内ticks/clock circles的个数,单位为Hz;表示CPU的工作速度。

9 Switches

  1. Vacuum Tubes: Take up a large amount of space/Produce heat and burn out frequently
  2. Transistors(silion):Smaller and faster/Produce less heat, can be switched quickly, and are less expensive

Integrated Circuits are not switches, they are the integration of large numbers of tiny transistors.

10 Abstraction Level

problem
algorithms
program
ISA:Intel x86
microarchitecture:Pentium II&III(奔腾),AMD Athlon(速龙)
circuits:ripple carry adder(行波进位加法器), lookahead carry adder(超前进位加法器)
devices:COMS,GaAs

Problem statement

• stated using “natural language”
• may be ambiguous, imprecise

11 Types of Computers

  1. Mainframe: Many users simultaneously, large memory and storage
  2. Supercomputer: Complex calculations and fast input/output speed
  3. Embedded system: Self-contained and is used to solve specific problems

12 Compiler and Assembler

Compiler:
‒ Compiler translates code written in a high level language to the ISA.
Assembler
‒ Assembler translates unique assembly language of a computer to its ISA

13 Sign-extension

Why is sign-extension important when performing arithmetic with 2’s complement number? (2 points)
It allows us to operate on bit patterns of different length.

14 Fixed-point & Floating-point

Fixed-point 优点

• Straight forward
• Easy
• No hardware support is required
• Fast/No complex arithmetic is required

Calculation

2’s complement representation / 1’s complement / signed magnitute

for n bit 2’s 2complement
precision: n-1 bits
range: -2^(n-1) ~ 2^(n-1)-1

2’s complement

一张图说明 2’s comp 中正负数二进制形式的关系

在这里插入图片描述
可见忽略符号位0~127这128个数字和-128~-1这128个数字的二进制编码是按顺序对应相等的(似乎并没有什么卵用的规律)

两个特殊的数
  1. 0:decimal 0的二的补数形式0000 0000的补码1111 1111 + 1 = 1 0000 0000忽略 carry out仍然是0000 000
  2. -128:-128的补数128并不在能表示的range内,但是巧妙的是1000 0000的补码0111 1111 + 1 = 1000 0000仍然是-128

Details

  1. 不同进制出现在同一个为题中一定要注明是什么进制
  2. overflow最好通过计算的实际意义来判断,即使进位到最高位之外只要没改变计算的意义都不算overflow
  3. 十六进制一定要写上0x
  4. null terminated string 默认最后有一个Null: 0000 0000
  5. 计算题单独将result写出来方便批改(注意题目中要求答案的格式)
  6. 计算题尽量化为十进制检验
  7. 只要将2‘s comp 扩展,必然要按照 sign extenion
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值