• Non ci sono risultati.

Esercitazione: tabelle di verità, costrutti condizionali e cicli

N/A
N/A
Protected

Academic year: 2021

Condividi "Esercitazione: tabelle di verità, costrutti condizionali e cicli"

Copied!
167
0
0

Testo completo

(1)

Prima&esercitazione&

Prima&esercitazione&

Riccardo(Ca*aneo(

Dipar/mento(di(Ele*ronica,(Informazione(e(Biomedica(( Politecnico(di(Milano&

Prima&esercitazione&

Prima&esercitazione&

Riccardo(Ca*aneo(

(

Dipar/mento(di(Ele*ronica,(Informazione(e(Biomedica(

Politecnico(di(Milano&

1

Esercitazione: tabelle di verità, costrutti condizionali e cicli

Alessandro A. Nacci

alessandro.nacci@polimi.it

(2)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

2

Agenda

(5’) Algebra di Boole e gli operatori logici (20’) Esercizio 1: Tabella di verità

(20’) Esercizio 2: Tabella di verità (5’) Un programma in C

(15’) Esercizio 3: caratteri MaIuScOli (15’) Pausa

(20’) Esercizio 3: caratteri MaIuScOli con ciclo while (20’) Esercizio 4: ciclo while con contatori

(30’) Esercizio 5: trova il maggiore

(3)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Algebra di Boole e gli operatori logici

G. Boole

(4)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

Algebra di Boole e gli operatori logici

G. Boole

(5)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

(6)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

A B A and B

0 0 0 0 1 0 1 0 0 1 1 1

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

(7)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

A B A and B

0 0 0 0 1 0 1 0 0 1 1 1

A B A or B

0 0 0 0 1 1 1 0 1 1 1 1

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

(8)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

A B A and B

0 0 0 0 1 0 1 0 0 1 1 1

A B A or B

0 0 0 0 1 1 1 0 1 1 1 1

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

C’è altro?

(9)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

A B A and B

0 0 0 0 1 0 1 0 0 1 1 1

A B A or B

0 0 0 0 1 1 1 0 1 1 1 1

A B A nand B

0 0 1

0 1 1

1 0 1

1 1 0

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

C’è altro?

(10)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

A B A and B

0 0 0 0 1 0 1 0 0 1 1 1

A B A or B

0 0 0 0 1 1 1 0 1 1 1 1

A B A nor B

0 0 1

0 1 0

1 0 0

1 1 0

A B A nand B

0 0 1

0 1 1

1 0 1

1 1 0

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

C’è altro?

(11)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

3

Un breve ripasso…

A B A and B

0 0 0 0 1 0 1 0 0 1 1 1

A B A or B

0 0 0 0 1 1 1 0 1 1 1 1

A B A xor B

0 0 0 0 1 1 1 0 1 1 1 0 A B A nor B

0 0 1

0 1 0

1 0 0

1 1 0

A B A nand B

0 0 1

0 1 1

1 0 1

1 1 0

Algebra di Boole e gli operatori logici

G. Boole

A not A

0 1

1 0

C’è altro?

(12)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

4

Agenda

(5’) Algebra di Boole e gli operatori logici (20’) Esercizio 1: Tabella di verità

(20’) Esercizio 2: Tabella di verità (5’) Un programma in C

(15’) Esercizio 3: caratteri MaIuScOli (15’) Pausa

(20’) Esercizio 3: caratteri MaIuScOli con ciclo while (20’) Esercizio 4: ciclo while con contatori

(30’) Esercizio 5: trova il maggiore

(13)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Esercizio 1

(14)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Esercizio 1

(15)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Esercizio 1

(16)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Esercizio 1

(17)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Esercizio 1

(18)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Esercizio 1

(19)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

5

D = (A and B) or (not(C) and A)

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure un numero che non é primo e contemporaneamente pari

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure un numero che non é primoC e contemporaneamente pariA

Esercizio 1

(20)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

Esercizio 1: Tabella di verità

(21)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(22)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(23)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(24)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(25)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C)

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(26)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(27)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(28)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(29)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A 0 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(30)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(31)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(32)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(33)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(34)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(35)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(36)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(37)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(38)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(39)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(40)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(41)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(42)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(43)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(44)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(45)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(46)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(47)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(48)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(49)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(50)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(51)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(52)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(53)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(54)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(55)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(56)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(57)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(58)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(59)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(60)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(61)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(62)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(63)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1 1

1 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(64)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1 1

1 1 1 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(65)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1 1

1 1 1 1 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(66)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1 1

1 1 1 1 0 0

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(67)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

6

A B C A and B not(C) not(C) and A (A and B) or not(C) and A

0 0 0 0 1 0 0

0 0 1 0 0 0 0

0 1 0 0 1 0 0

0 1 1 0 0 0 0

1 0 0 0 1 1 1

1 0 1 0 0 0 0

1 1 0 1 1 1 1

1 1 1 1 0 0 1

Esercizio 1: Tabella di verità

D = (A and B) or (not(C) and A)

(68)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

7

Agenda

(5’) Algebra di Boole e gli operatori logici (20’) Esercizio 1: Tabella di verità

(20’) Esercizio 2: Tabella di verità (5’) Un programma in C

(15’) Esercizio 3: caratteri MaIuScOli (15’) Pausa

(20’) Esercizio 3: caratteri MaIuScOli con ciclo while (20’) Esercizio 4: ciclo while con contatori

(30’) Esercizio 5: trova il maggiore

(69)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Esercizio 2

(70)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure primo; e contemporaneamente uno che non sia: pari e divisibile per 9 oppure primo

Esercizio 2

(71)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure primo; e contemporaneamente uno che non sia: pari e divisibile per 9 oppure primo

Esercizio 2

(72)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure primo; e contemporaneamente uno che non sia: pari e divisibile per 9 oppure primo

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure primoC; e contemporaneamente uno che non sia: pariA e divisibile per 9B oppure

primoC

Esercizio 2

(73)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure primo; e contemporaneamente uno che non sia: pari e divisibile per 9 oppure primo

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure primoC; e contemporaneamente uno che non sia: pariA e divisibile per 9B oppure

primoC

Esercizio 2

(74)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure primo; e contemporaneamente uno che non sia: pari e divisibile per 9 oppure primo

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure primoC; e contemporaneamente uno che non sia: pariA e divisibile per 9B oppure

primoC

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure primoC; e contemporaneamente uno che non sia: pariA e divisibile per 9B oppure

primoC

Esercizio 2

(75)

Prima&esercitazione&

2

Riccardo Cattaneo

-  Studente PhD al NECSTLab

-  Autonomic (Operating) Systems (CHANGE project)

-  Reconfigurable architectures for HPC systems (FASTER project)

- exaFPGA (accelerazione hardware)

Ciao!

8

Ipotesi: l’utente deve inserire un intero pari e divisibile per 9 oppure primo; e contemporaneamente uno che non sia: pari e divisibile per 9 oppure primo

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure primoC; e contemporaneamente uno che non sia: pariA e divisibile per 9B oppure

primoC

Ipotesi: l’utente deve inserire un intero pariA e divisibile per 9B oppure primoC; e contemporaneamente uno che non sia: pariA e divisibile per 9B oppure

primoC

Esercizio 2

Riferimenti

Documenti correlati

Esegui tutti gli incroci possibili tra: individuo dalla pelle con lentiggini – individuo dalla pelle senza lentiggini e indica la % del fenotipo nella generazione filiale F

La  domanda  chiede  di  individuare,  fra  quattro  opzioni, quale titolo alternativo a “Carta contro  pixel” potrebbe essere adatto per sintetizzare il 

Sfruttando la legge dei gas perfetti

Il programma riceve come primo parametro sulla riga di comando il nome del file contenente la mappa dei posti, come secondo parametro il tipo di posto da assegnare (un

— quindi per la prima coppia di aggettivi dovrai sommare il numero barrato nella scheda A con quelli delle schede B e C, riferiti sempre alla stessa coppia di

La programmazione dei controlli fiscali di Agenzia delle Entrate e Guardia di Finanza deve assicurare una vigilanza sistemica (basate su analisi di rischio) sulle imprese che

2.1 Per tutti gli adempimenti concernenti l’assegnazione di alloggi in sub-locazione a nuclei familiari in dipendenza di sopraggiunte necessità abitative, come

Dati due segnali A e B, si implementi un circuito che calcoli A XNOR B senza usare porte composte (NAND, NOR, XOR, XNOR), si derivi la tabella di verità e si osservi la funzione