ELEC211-FOR EXAM

ELEC211 notes

Logic gates and combinational logic

image-20220207052528400

image-20220207052856561

其中,NAND 和 NOR 也被称为Universal gates,因为我们可以仅使用他们中的某一种来实现所有的布尔逻辑

image-20220207052641452

此处XOR逻辑=“取奇数输入”,少见。X = ((A XOR B) XOR C)

Combinational circuits 组合电路 •Present output depends only on present input •Combinational logic uses Boolean algebra:

*使用卡诺图化简通常比看这种表格来得更快。

image-20220207060955527

Sequential circuits 时序电路 •Present output values depend on present and past values •Circuit ‘remembers’ its own state

Minterms/Maxterms and implementing functions

Minterms: Sum of Products (SOP)

Maxterms: Product of Sums (POS)`

implementing functions:image-20220207062035564大概就是这个意思,不如卡诺图。

Karnaugh maps

image-20220207061940969

Multiplexer 数据选择器/多路开关

A multiplexer在多个输入中,依据数个控制用输入(control inputs)选择一个作为输出。(下图右)

image-20220207062343812

A multiplexer has: •At least two inputs •One or more control (select) inputs •One output

实现:

image-20220207062622460

image-20220207062652392

image-20220207062805667

Adder

image-20220516235100607

image-20220516235254924

image-20220516235125445

Parallel ripple carry adder

image-20220518164515904

‘carry look ahead’ adder

image-20220516235315544

image-20220516235330556

image-20220516235445540

Tristate gates 三态门(three state buffers)

States of Tristate gates:

1,0, high impedance (Hi-Z) 高阻抗 (断路

why?

当多个逻辑电路的输出合并到一条线上,他们的输出会产生冲突:同时短接高低电平,你到底算哪个呢?

此时,Hi-Z提供了解决冲突的方法:多了一种输出——断路。这就意味着,在多个输出里,如果只有一个具有0/1输出而其它都断路的话,那么总输出就必然与0/1输出一致。

实现:

image-20220207064301412

典中典4种情况:

image-20220501234937317

某种意义上起到了 multiplexer 的作用。

image-20220207064417877

Shannon’s Expansion

image-20220502002235553

Mealy / Moore machines

In Moore machines, output=f(current state)

In Mealy machines, output=f(current state, input)

ASM

image-20220502182756729

image-20220502181533422

one hot 和 state transition 是同一种表格

image-20220502183507258

image-20220516175142570

PLA table: 其实差不多,但是用于设计PLA:

image-20220516175440936

Quine-McCluskey

无 d

image-20220502004418648

image-20220502004444900

image-20220502004652794

image-20220502004806012

有 d,Incompletely Specified Functions

image-20220502005858583

image-20220502005913436

找到所有的PI 后,找EPI

image-20220516175827237

image-20220516175910307

然后找SOP

image-20220516175947445

Registers

use D Flip-Flops with Clock Enable

When Load is 1 the clock is enabled (CE) and the data applied to the D inputs will be loaded into the flip-flops.

When Load is 0 the register holds its data (memory).

image-20220502165855612

D Flip-Flop

image-20220502173400439

Minimum Clock Period = flip-flop propagation delay + setup time + propagation delay of other components in circuit

------------------------Microprocessor Systems------------------------

Shift-register

LSLS - logical shift left: abcdefghijkl => defghijkl000

LSRS - logical shift right: abcdefghijkl => 000abcdefghi

ASRS - Arithmetic shift right: abcdefghijkl => aaaabcdefghi *a是符号位

PORS - Rotate right: abcdefghijkl => jklabcdefghi *j当carry

addressing

after LDR rd, [rn]

registers value in registers memory value in memory
rd(initial) 0xABCDEFGH 0x00008000 12
rn 0x00008000 0x00008001 34
rd(Big endian) 0x12345678 0x00008002 56
rd(Little endian) 0x78563412 0x00008003 78

after STR rd, [rn]

registers value in registers memory Big endian Little endian
rd 0xABCDEFGH 0x00008000 AB GH
rn 0x00008000 0x00008001 CD EF
0x00008002 EF CD
0x00008003 GH AB

image-20220516211255051image-20220516211117350

REV ry, rx // Little endian <-> Big endian, y <-- x

LDR: load full word (32 bits)

LDRH: load half word (16 bits)(0000XXXX)

LDRB: load byte (8 bits)(000000XX)

LDRSH/LDRSB: load with the sign (S...SX...X)

STRH: Store half word

#的偏移也会随着存入数据的大小改变:

image-20220516230147833

instructions:

image-20220516201113088

Flags

注意, 当运算的结果产生进位或者减法运算没有借位的话C=1,其他情况C=0

image-20220503040616459

Carry vs Overflow

carry: 无符号溢出

Overflow:有符号溢出

Branch

B

B<cond>

image-20220518143137757

image-20220503041021715

image-20220503041143195

PC vs LR vs SR

PC: program counter, R15

存放下一次访存的地址。

SR: stack pointer

栈顶

LR: link register, R14

函数的返回地址

image-20220503042402206

image-20220503042148390

IEEE754 standard

image-20220503041927711