Download - Nand2 tetris 1and2

Transcript
Page 1: Nand2 tetris 1and2

1

B3 shuya

The Elements of Computing System- Ⅰ.Boolean Logic Ⅱ.Boolean Arithmetic -

B3 shuya

Page 2: Nand2 tetris 1and2

2

Ⅰ. Boolean Logic

Page 3: Nand2 tetris 1and2

3Introduction

Every digital device is composed by chips. The component of chips is Logic Gate.

This chapter focus on Boolean Gatewhich is simple and physically represent bool function.

This chapter implement boolean gate by using simulator.I will show later how to use simulator.

3

Page 4: Nand2 tetris 1and2

3Boolean Algebra 4

1.1.1 Boolean Algebra

Boolean algebra uses binary values.

This is labeled true/false, 0/1, yes/no, on/off.

The expresion of Bool function

Truth Table

Boolean expression

Canonical representation

Truth Table

f(x, y, z) = (x+ y) · zBoolean expression

Canonical expression

f(x, y, z) = xyz + xyz + xyz

Page 5: Nand2 tetris 1and2

Composite implementation of a three-way And gate

3Logic Gate 5

1.1.2 Logic gateGate is a physical device which implements function.

The simplest gates of all are made from tiny switching devices,

called transistors.

Primitive gate

Composite gateThis gate is combination of Primitive one.

This assembly called Logic design.

Page 6: Nand2 tetris 1and2

6

Usage of Simulator

Page 7: Nand2 tetris 1and2

3Usage of Simulator 7

Environmental constructionDownload

http://www.nand2tetris.org/software/mac_guide.html Setup

$ cd /usr/local/bin$ ln -s ~/nand2tetris/tools/HardwareSimulator.sh HardwareSimulator$ chmod +x HardwareSimulator$ HardwareSimulator

Usage of SoftwareClick and load .hdl file. Click and load .tst file.

Run script

Page 8: Nand2 tetris 1and2

8

Ⅱ. Boolean Arithmetic

Page 9: Nand2 tetris 1and2

3Introduction

This chapter aims to make ALU.

All calculation on Computer executes by ALU.

The first section gives a brief Back-ground on how binary codes and Boolean arithmetic can be used.

The Specification section describes a succession ofadder chips.

9

Page 10: Nand2 tetris 1and2

3Usage of Simulator 10

Environmental constructionDownload

http://www.nand2tetris.org/software/mac_guide.html Setup

$ cd /usr/local/bin$ ln -s ~/nand2tetris/tools/HardwareSimulator.sh HardwareSimulator$ chmod +x HardwareSimulator$ HardwareSimulator

Usage of SoftwareClick and load .hdl file. Click and load .tst file.

Run script

Page 11: Nand2 tetris 1and2

3Boolean Arithmetic 11

Binary NumbersUnlike the decimal system, which is founded on base 10,

the bi-nary system is founded on base.

Binary AdditionA pair of binary numbers can be added digit by digit from right to

left, the same method used in decimal addition.

Page 12: Nand2 tetris 1and2

3Boolean Arithmetic 12

Signed Binary NumbersThe method used by almost all com-puters is called the

2’s complementmethod, also known asradix complement.

How to make 2’s complement

0101

1010

1011

Reverse bit order

1’s comlementmethod

add 1

2’s comlementmethod

Page 13: Nand2 tetris 1and2

3Adders 13

half adderThis is designed to add two bits

sum = LSB of a + b, carry = MSB of a + b

full adderThis is designed to add three bits

sum = LSB of a + b + c, carry = MSB of a + b + c

adderDesigned to add two n-bit numbers

out = a + b

Page 14: Nand2 tetris 1and2

3ALU 14

Arithmetic Logic UnitALU is component of PC. This executes boolean logic and arithmetic.

Previous gate is hold for any computer.

This section describes an ALU which is uniq one in this text.


Top Related