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
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
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
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
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
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
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
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?
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?
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?
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?
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
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
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
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
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
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
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
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
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à
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
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
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
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
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
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
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
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