Docsity

Binary Numbers and Base Conversion in CSE369 and CSE410, Exercises of Voice

Toggle sidebar
bg1
CSE369, Autumn 2016L01: Intro, Combinational Logic CSE410, Winter 2017L02: Binary Numbers
BinaryNumbers
CSE410Winter2017
Instructor: TeachingAssistants:
JustinHsia KathrynChan,KevinBi,RyanWong,WaylonHuang,Xinyu Sui
PoliceseekAmazonEchodatainmurdercase
Amazon's Echo devices and its virtual assistant are meant to help find answers by
listening for your voice commands. However, police in Arkansas want to know if one of
the gadgets overheard something that can help with a murder case.
"You have an expectation of privacy in your home,
and I have a big problem that law enforcement can
use the technology that advances our quality of life
against us," defense attorney Kimberly Weber said.
•https://www.engadget.com/2016/12/27/
amazon‐echo‐audio‐data‐murder‐case/
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Binary Numbers and Base Conversion in CSE369 and CSE410 and more Exercises Voice in PDF only on Docsity!

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Binary Numbers CSE 410 Winter 2017 Instructor:

Teaching Assistants: Justin Hsia

Kathryn Chan, Kevin Bi, Ryan Wong, Waylon Huang, Xinyu Sui Police seek Amazon Echo data in murder case Amazon's Echo devices and its virtual assistant are meant to help find answers bylistening for your voice commands. However, police in Arkansas want to know if one ofthe gadgets overheard something that can help with a murder case."You have an expectation of privacy in your home,and I have a big problem that law enforcement canuse the technology that advances our quality of lifeagainst us," defense attorney Kimberly Weber said.^ •^ https://www.engadget.com/2016/12/27/amazon‐echo‐audio‐data‐murder‐case/

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Administrivia^ ^ Pre‐course Survey due today (1/6)^ ļ‚§^ Can find staff’s mini‐bios by clicking our faces on website^ ^ Homework 1 due Wednesday (1/11)^ ^ Lab 0 released today, due next Friday (1/13)^ ļ‚§^ Not a full lab – exploratory credit/no credit assignment in C

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Lecture Outline^ ^ Decimal, Binary, and Hexadecimal^ ^ Base Conversion^ ^ Binary Encoding^ ^ IEC Prefixes

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Decimal Numbering System^ ^ Ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9^ ^ Represent larger numbers as a sequence of digits^ ļ‚§^ Each digit is one of the available symbols^ ^ Example: 7061 in decimal (base 10)^ ļ‚§^7061

= (7^10

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Peer Instruction Question^ ^ What is 34

in base 10? 8

A. 32^10 B.^3410 C.^710 D. 28^10 E.^3510  Think on your own for a minute, then discuss withyour neighbor(s) ļ‚§^ Vote at http://PollEv.com/justinh

L01: Intro, Combinational Logic

10

  • CSE369, Autumn
  • CSE410, Winter
    • Binary and Hexadecimal  Binary is base 2 ļ‚§ Symbols: 0, 1 ļ‚§ Convention: L02: Binary Numbers
      • =
      • = 0b
        •  Example: What is 0b110 in base 10? ļ‚§ 0b110 = - = (1
          • 2 2 ) + (
          • 1 2 ) + (
          • 0 2 ) = -  Hexadecimal (hex, for short) is base 16 ļ‚§ Symbols? 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …? ļ‚§ Convention: - = - = 0x -  Example: What is 0xA5 in base 10? ļ‚§ 0xA5 = A - = (10 - 1 16 ) + ( - 0 16 ) =

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Lecture Outline^ ^ Decimal, Binary, and Hexadecimal^ ^ Base Conversion^ ^ Binary Encoding^ ^ IEC Prefixes

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Converting to Base 10^ ^ Can convert from any base

to^ base 10

ļ‚§^ 0b110 = 110

= (1^2

2 2 ) + (^

1 2 ) + (^

0 2 ) = 6^10

ļ‚§^ 0xA5 = A

= (10^16

10

^ We learned to think in base 10, so this is fairly naturalfor us ^ Challenge:

Convert into other bases (e.g. 2, 16)

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Converting from Decimal to Binary^ ^ Given a decimal number N:^ ļ‚§^ List increasing powers of 2 from

right to left

until^

N

ļ‚§^ Then from

left to right

, ask is that (power of 2)

N?

•^ If^ YES , put a 1 below and subtract that power from N •^ If^ NO , put a 0 below and keep going  Example: 13 to binary

4 2 =^

3 2 =8^2

2 1 =4^2

0 =2^2

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Converting from Decimal to Base B^ ^ Given a decimal number N:^ ļ‚§^ List increasing powers of B from

right to left

until^

N

ļ‚§^ Then from

left to right

, ask is that (power of B)

N?

-^ If^ YES , put

how many

of that power go into N and subtract from N

•^ If^ NO , put a 0 below and keep going  Example: 165 to hex

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Binary

Hex Practice

^ Convert 0b100110110101101^ ļ‚§^ How many digits?^ ļ‚§^ Pad:^ ļ‚§^ Substitute:

Base 10^

Base 2^ Base 16 0 0000

A

B

C

D

E

F

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Base Comparison^ ^ Why does all of this matter?^ ļ‚§^ Humans

think about numbers in

base

10 , but^

computers

ā€œthinkā€ about

numbers in

base 2

ļ‚§^ Binary encoding is what allowscomputers to do all of the amazingthings that they do!  You should have this tablememorized by the end of the class ļ‚§^ Might as well start now!

Base 10^

Base 2^ Base 16 0 0000

A

B

C

D

E

F

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Lecture Outline^ ^ Decimal, Binary, and Hexadecimal^ ^ Base Conversion^ ^ Binary Encoding^ ^ IEC Prefixes

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L02: Binary Numbers

Numerical Encoding^ ^ AMAZING FACT: You can represent

anything

countable using numbers!^ ļ‚§^ Need to agree on an encoding^ ļ‚§^ Kind of like learning a new language  Examples:^ ļ‚§^ Decimal Integers: 0

0b0, 1

0b1, 2

0b10, etc.

ļ‚§^ English Letters: CSE

0x435345, yay

0x

ļ‚§^ Emoticons:

😃^ 0x0,

šŸ˜ž^ 0x1,

šŸ˜Ž^ 0x2,

šŸ˜‡^ 0x3,

😈^ 0x4,

šŸ™‹^ 0x