SlideShare a Scribd company logo
1 of 17
1
Verilog HDLVerilog HDL
Lecture 7
2
Logical Operators
• && → logical AND
• | | → logical OR
• ! → logical NOT
• Operands evaluated to ONE bit value: 0, 1 or x
• Result is ONE bit value: 0, 1 or x
• A= 6; A&&B → 1&&0 → 0
• B = 0; A | | !B → 1| |1 → 1
• C= x; C | | B → x | | 0 → x, C&&B = 0
Lecture 7
3
Bitwise Operators
• & → bitwise AND
• | → bitwise OR
• ~ → bitwise NOT
• ^ → bitwise XOR
• ~^ or ^~ → bitwise XNOR
• Operation on bit by bit basis
Lecture 7
4
Bitwise Operators
•
Lecture 7
5
Reduction Operators
• & → AND
• | → OR
• ~& → NAND
• ~| → NOR
• ^ → XOR
• ~^ or ^~ → XNOR
• One multi-bit operand → One single-bit result
• a = 4’b1001;
• c = |a ; // c = 1|0|0|1 = 1
Lecture 7
6
Shift Operators
• >> → shift right
• << → shift left
• Result is same size as first operand, always zero filled
• a = 4’b1010;
• d = a>>2; //d= 0010
• c = a<<1; //c= 0100
Lecture 7
7
Concatenation Operator
• {op1, op2, ..} → concatenates op1, op2, .. to single
number
• Operands must be sized !!
reg a;
reg [2:0] b, c;
..
a = 1’b 1;
b = 3’b 010;
c = 3’b 101;
catx = {a, b, c}; //catx = 1_010_101
Lecture 7
8
Concatenation Operator
caty = {b, 2’b11, a};//caty = 010_11_1
catz = {b, 1}; // WRONG !!
• Replication ..
catr = {4{a}, b, 2{c}};
// catr = 1111_010_101101
Lecture 7
9
Example of Replication
We want to multiply A and B 5-bits numbers.
Lecture 7
10
Replication: Verilog Code of Multiplier
module mul_5x5(A, B, mul_out); // Multiplier Unsigned X
Unsigned Number
input [4:0] A, B ;
output [9:0] mul_out ;
wire [4:0] pp0, pp1, pp2, pp3, pp4 ;
wire [9:0] mul_out ;
assign ppo = A & {5{B[0]}} ;
assign pp1 = A & {5{B[1]}} ;
assign pp2 = A & {5{B[2]}} ;
assign pp3 = A & {5{B[3]}} ;
assign pp4 = A & {5{B[4]}} ;
assign mul_out = pp0 + {pp1, 1’b0} + {pp2, 2’b0} + {pp3,
3’b0} +{pp4, 4’b0} ;
endmodule
Lecture 7
11
Relational Operators
• > → greater than
• < → less than
• >= → greater or equal than
• <= → less or equal than
• Result is one bit value: 0, 1 or x
1 > 0 → 1
’b1x1 <= 0 → x
10 < z → x
Lecture 7
12
Equality Operators
• == → logical equality
• != → logical inequality
• === → case equality
• !== → case inequality
• 4’b 1z0x == 4’b 1z0x → x
• 4’b 1z0x != 4’b 1z0x → x
• 4’b 1z0x === 4’b 1z0x → 1
• 4’b 1z0x !== 4’b 1z0x → 0
Lecture 7
13
Conditional Operator
• cond_expr ? true_expr : false_expr
• Like a 2-to-1 mux ..
Lecture 7
14
Arithmetic Operators
• +, -, *, /, %
• If any operand is x the result is x
• Negative registers:
• regs can be assigned negative but are
treated as unsigned
reg [15:0] regA;
Lecture 7
15
Arithmetic Operators
regA = -16’d12;
//stored as 216
-12 = 65524
regA/3 evaluates to 21841
•Negative integers:
• can be assigned negative values
• different treatment depending on base
specification or not
Lecture 7
16
Arithmetic Operators
reg [15:0] regA;
integer intA;
..
intA = -12/3;
//evaluates to –4 (no base
spec)
intA = -’d12/3;
//evaluates to 1431655761
(base spec) Lecture 7
17
Operator Precedence
Lecture 7

More Related Content

What's hot

Pertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometri
Pertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometriPertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometri
Pertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometriadi darmawan
 
Pendahuluan dan himpunan
Pendahuluan dan himpunanPendahuluan dan himpunan
Pendahuluan dan himpunanL N
 
representasi floating point
representasi floating pointrepresentasi floating point
representasi floating pointAngling_seto
 
Brief Review of Fourier Analysis
Brief Review of Fourier AnalysisBrief Review of Fourier Analysis
Brief Review of Fourier Analysisop205
 
Recursive pertemuan 5
Recursive pertemuan 5Recursive pertemuan 5
Recursive pertemuan 5Basiroh M.Kom
 
Modul 2-spektrum-dari-bentuk-gelombang-
Modul 2-spektrum-dari-bentuk-gelombang-Modul 2-spektrum-dari-bentuk-gelombang-
Modul 2-spektrum-dari-bentuk-gelombang-AndiRahmania Rahma
 
Gerbang logika dasar
Gerbang logika dasarGerbang logika dasar
Gerbang logika dasarYusuf Tiar
 
Graf-2020-Bagian3.pptx
Graf-2020-Bagian3.pptxGraf-2020-Bagian3.pptx
Graf-2020-Bagian3.pptxNurlaelaJuanda
 
PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013
PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013
PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013ahyu99
 
[RPL2] Class Diagram dan Konsep Object Oriented (1)
[RPL2] Class Diagram dan Konsep Object Oriented (1)[RPL2] Class Diagram dan Konsep Object Oriented (1)
[RPL2] Class Diagram dan Konsep Object Oriented (1)rizki adam kurniawan
 
2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)Kelinci Coklat
 

What's hot (20)

Matdis-Relasi Fungsi
Matdis-Relasi FungsiMatdis-Relasi Fungsi
Matdis-Relasi Fungsi
 
Operasi himpunan
Operasi himpunanOperasi himpunan
Operasi himpunan
 
Register
RegisterRegister
Register
 
Pertemuan 3 Interpretasi Sinyal
Pertemuan 3 Interpretasi SinyalPertemuan 3 Interpretasi Sinyal
Pertemuan 3 Interpretasi Sinyal
 
Jaringan perceptron & matlab
Jaringan perceptron & matlabJaringan perceptron & matlab
Jaringan perceptron & matlab
 
maksimum dan minimum
maksimum dan minimummaksimum dan minimum
maksimum dan minimum
 
Pertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometri
Pertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometriPertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometri
Pertemuan 1-fungsi-invers-eksponensial-logaritma-dan-trigonometri
 
2a. fungsi invers
2a. fungsi invers2a. fungsi invers
2a. fungsi invers
 
Pendahuluan dan himpunan
Pendahuluan dan himpunanPendahuluan dan himpunan
Pendahuluan dan himpunan
 
Certainty Factor Theory
Certainty Factor TheoryCertainty Factor Theory
Certainty Factor Theory
 
Algoritma Pemrograman - Perintah Input/Output
Algoritma Pemrograman - Perintah Input/OutputAlgoritma Pemrograman - Perintah Input/Output
Algoritma Pemrograman - Perintah Input/Output
 
representasi floating point
representasi floating pointrepresentasi floating point
representasi floating point
 
Brief Review of Fourier Analysis
Brief Review of Fourier AnalysisBrief Review of Fourier Analysis
Brief Review of Fourier Analysis
 
Recursive pertemuan 5
Recursive pertemuan 5Recursive pertemuan 5
Recursive pertemuan 5
 
Modul 2-spektrum-dari-bentuk-gelombang-
Modul 2-spektrum-dari-bentuk-gelombang-Modul 2-spektrum-dari-bentuk-gelombang-
Modul 2-spektrum-dari-bentuk-gelombang-
 
Gerbang logika dasar
Gerbang logika dasarGerbang logika dasar
Gerbang logika dasar
 
Graf-2020-Bagian3.pptx
Graf-2020-Bagian3.pptxGraf-2020-Bagian3.pptx
Graf-2020-Bagian3.pptx
 
PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013
PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013
PPT MATEMATIKA PEMINATAN KELAS XII KURIKULUM 2013
 
[RPL2] Class Diagram dan Konsep Object Oriented (1)
[RPL2] Class Diagram dan Konsep Object Oriented (1)[RPL2] Class Diagram dan Konsep Object Oriented (1)
[RPL2] Class Diagram dan Konsep Object Oriented (1)
 
2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)
 

Viewers also liked

Sec3 chapter5 bonding singapore_slideshare
Sec3 chapter5 bonding singapore_slideshareSec3 chapter5 bonding singapore_slideshare
Sec3 chapter5 bonding singapore_slideshareAdrian Peeris
 
Bmc social studies_chapter3_healthcare(spore&uk systems)
Bmc social studies_chapter3_healthcare(spore&uk systems)Bmc social studies_chapter3_healthcare(spore&uk systems)
Bmc social studies_chapter3_healthcare(spore&uk systems)Adrian Peeris
 
Florante at laura
Florante at lauraFlorante at laura
Florante at lauraRubyClaire
 
Sec3 english language_comprehension(thesummaryqn)
Sec3 english language_comprehension(thesummaryqn)Sec3 english language_comprehension(thesummaryqn)
Sec3 english language_comprehension(thesummaryqn)Adrian Peeris
 
Poap de 2º eso a 3º eso 2016 2017
Poap de 2º eso  a 3º eso 2016 2017Poap de 2º eso  a 3º eso 2016 2017
Poap de 2º eso a 3º eso 2016 2017Panchobordon
 
Singular and plural nouns for first graders
Singular and plural nouns for first gradersSingular and plural nouns for first graders
Singular and plural nouns for first gradersMe-an Cupo
 
Bmc social studies_chapter2b_governance in singapore(poppolicies)
Bmc social studies_chapter2b_governance in singapore(poppolicies)Bmc social studies_chapter2b_governance in singapore(poppolicies)
Bmc social studies_chapter2b_governance in singapore(poppolicies)Adrian Peeris
 
Bmc cold war lect 4_cuban_missilecrisis
Bmc cold war lect 4_cuban_missilecrisisBmc cold war lect 4_cuban_missilecrisis
Bmc cold war lect 4_cuban_missilecrisisAdrian Peeris
 
Onset and rime For First Graders
Onset and rime For First GradersOnset and rime For First Graders
Onset and rime For First GradersMe-an Cupo
 
Rules in forming the plural of noun (grade 1-2)
Rules in forming the plural of noun (grade 1-2)Rules in forming the plural of noun (grade 1-2)
Rules in forming the plural of noun (grade 1-2)Me-an Cupo
 
Sec3 chapter6 diplomacy & deterrence(singapore)_slideshare
Sec3 chapter6 diplomacy & deterrence(singapore)_slideshareSec3 chapter6 diplomacy & deterrence(singapore)_slideshare
Sec3 chapter6 diplomacy & deterrence(singapore)_slideshareAdrian Peeris
 
Making inferences
Making inferencesMaking inferences
Making inferencesMe-an Cupo
 
Kinds of nouns according to number (grade 1)
Kinds of nouns according to number (grade 1)Kinds of nouns according to number (grade 1)
Kinds of nouns according to number (grade 1)Me-an Cupo
 
Elements of the Story: Problem and solution
Elements of the Story: Problem and solution Elements of the Story: Problem and solution
Elements of the Story: Problem and solution Me-an Cupo
 
Bmc o&n english_language_composition(situational writing)(formal letter)_slid...
Bmc o&n english_language_composition(situational writing)(formal letter)_slid...Bmc o&n english_language_composition(situational writing)(formal letter)_slid...
Bmc o&n english_language_composition(situational writing)(formal letter)_slid...Adrian Peeris
 

Viewers also liked (16)

Sec3 chapter5 bonding singapore_slideshare
Sec3 chapter5 bonding singapore_slideshareSec3 chapter5 bonding singapore_slideshare
Sec3 chapter5 bonding singapore_slideshare
 
Bmc social studies_chapter3_healthcare(spore&uk systems)
Bmc social studies_chapter3_healthcare(spore&uk systems)Bmc social studies_chapter3_healthcare(spore&uk systems)
Bmc social studies_chapter3_healthcare(spore&uk systems)
 
Florante at laura
Florante at lauraFlorante at laura
Florante at laura
 
Sec3 english language_comprehension(thesummaryqn)
Sec3 english language_comprehension(thesummaryqn)Sec3 english language_comprehension(thesummaryqn)
Sec3 english language_comprehension(thesummaryqn)
 
Poap de 2º eso a 3º eso 2016 2017
Poap de 2º eso  a 3º eso 2016 2017Poap de 2º eso  a 3º eso 2016 2017
Poap de 2º eso a 3º eso 2016 2017
 
Bmc cold war lect 3
Bmc cold war lect 3Bmc cold war lect 3
Bmc cold war lect 3
 
Singular and plural nouns for first graders
Singular and plural nouns for first gradersSingular and plural nouns for first graders
Singular and plural nouns for first graders
 
Bmc social studies_chapter2b_governance in singapore(poppolicies)
Bmc social studies_chapter2b_governance in singapore(poppolicies)Bmc social studies_chapter2b_governance in singapore(poppolicies)
Bmc social studies_chapter2b_governance in singapore(poppolicies)
 
Bmc cold war lect 4_cuban_missilecrisis
Bmc cold war lect 4_cuban_missilecrisisBmc cold war lect 4_cuban_missilecrisis
Bmc cold war lect 4_cuban_missilecrisis
 
Onset and rime For First Graders
Onset and rime For First GradersOnset and rime For First Graders
Onset and rime For First Graders
 
Rules in forming the plural of noun (grade 1-2)
Rules in forming the plural of noun (grade 1-2)Rules in forming the plural of noun (grade 1-2)
Rules in forming the plural of noun (grade 1-2)
 
Sec3 chapter6 diplomacy & deterrence(singapore)_slideshare
Sec3 chapter6 diplomacy & deterrence(singapore)_slideshareSec3 chapter6 diplomacy & deterrence(singapore)_slideshare
Sec3 chapter6 diplomacy & deterrence(singapore)_slideshare
 
Making inferences
Making inferencesMaking inferences
Making inferences
 
Kinds of nouns according to number (grade 1)
Kinds of nouns according to number (grade 1)Kinds of nouns according to number (grade 1)
Kinds of nouns according to number (grade 1)
 
Elements of the Story: Problem and solution
Elements of the Story: Problem and solution Elements of the Story: Problem and solution
Elements of the Story: Problem and solution
 
Bmc o&n english_language_composition(situational writing)(formal letter)_slid...
Bmc o&n english_language_composition(situational writing)(formal letter)_slid...Bmc o&n english_language_composition(situational writing)(formal letter)_slid...
Bmc o&n english_language_composition(situational writing)(formal letter)_slid...
 

Similar to Verilog HDL logical and bitwise operators

GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEWshyamuopten
 
C++ Programming Basics.pptx
C++ Programming Basics.pptxC++ Programming Basics.pptx
C++ Programming Basics.pptxZntalemAbebe
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3rohassanie
 
Ruby Basics by Rafiq
Ruby Basics by RafiqRuby Basics by Rafiq
Ruby Basics by RafiqRafiqdeen
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
 
Reducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGAReducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGAnehagaur339
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.comBaileya55
 
vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1MANDHASAIGOUD1
 
The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185Mahmoud Samir Fayed
 
Python PCEP Logic Bit Operations
Python PCEP Logic Bit OperationsPython PCEP Logic Bit Operations
Python PCEP Logic Bit OperationsIHTMINSTITUTE
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operatorsAswin Pv
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 studrohassanie
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statementsCtOlaf
 
GSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comGSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comclaric119
 
GSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comGSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comclaric169
 

Similar to Verilog HDL logical and bitwise operators (20)

Assic 7th Lecture
Assic 7th LectureAssic 7th Lecture
Assic 7th Lecture
 
C Operators
C OperatorsC Operators
C Operators
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEW
 
C++ Programming Basics.pptx
C++ Programming Basics.pptxC++ Programming Basics.pptx
C++ Programming Basics.pptx
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
 
3306617
33066173306617
3306617
 
Ruby Basics by Rafiq
Ruby Basics by RafiqRuby Basics by Rafiq
Ruby Basics by Rafiq
 
verilog_1.ppt
verilog_1.pptverilog_1.ppt
verilog_1.ppt
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Reducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGAReducing computational complexity of Mathematical functions using FPGA
Reducing computational complexity of Mathematical functions using FPGA
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.com
 
vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1
 
The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185
 
Python PCEP Logic Bit Operations
Python PCEP Logic Bit OperationsPython PCEP Logic Bit Operations
Python PCEP Logic Bit Operations
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operators
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statements
 
GSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comGSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.com
 
GSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comGSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.com
 

Recently uploaded

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Verilog HDL logical and bitwise operators

  • 2. 2 Logical Operators • && → logical AND • | | → logical OR • ! → logical NOT • Operands evaluated to ONE bit value: 0, 1 or x • Result is ONE bit value: 0, 1 or x • A= 6; A&&B → 1&&0 → 0 • B = 0; A | | !B → 1| |1 → 1 • C= x; C | | B → x | | 0 → x, C&&B = 0 Lecture 7
  • 3. 3 Bitwise Operators • & → bitwise AND • | → bitwise OR • ~ → bitwise NOT • ^ → bitwise XOR • ~^ or ^~ → bitwise XNOR • Operation on bit by bit basis Lecture 7
  • 5. 5 Reduction Operators • & → AND • | → OR • ~& → NAND • ~| → NOR • ^ → XOR • ~^ or ^~ → XNOR • One multi-bit operand → One single-bit result • a = 4’b1001; • c = |a ; // c = 1|0|0|1 = 1 Lecture 7
  • 6. 6 Shift Operators • >> → shift right • << → shift left • Result is same size as first operand, always zero filled • a = 4’b1010; • d = a>>2; //d= 0010 • c = a<<1; //c= 0100 Lecture 7
  • 7. 7 Concatenation Operator • {op1, op2, ..} → concatenates op1, op2, .. to single number • Operands must be sized !! reg a; reg [2:0] b, c; .. a = 1’b 1; b = 3’b 010; c = 3’b 101; catx = {a, b, c}; //catx = 1_010_101 Lecture 7
  • 8. 8 Concatenation Operator caty = {b, 2’b11, a};//caty = 010_11_1 catz = {b, 1}; // WRONG !! • Replication .. catr = {4{a}, b, 2{c}}; // catr = 1111_010_101101 Lecture 7
  • 9. 9 Example of Replication We want to multiply A and B 5-bits numbers. Lecture 7
  • 10. 10 Replication: Verilog Code of Multiplier module mul_5x5(A, B, mul_out); // Multiplier Unsigned X Unsigned Number input [4:0] A, B ; output [9:0] mul_out ; wire [4:0] pp0, pp1, pp2, pp3, pp4 ; wire [9:0] mul_out ; assign ppo = A & {5{B[0]}} ; assign pp1 = A & {5{B[1]}} ; assign pp2 = A & {5{B[2]}} ; assign pp3 = A & {5{B[3]}} ; assign pp4 = A & {5{B[4]}} ; assign mul_out = pp0 + {pp1, 1’b0} + {pp2, 2’b0} + {pp3, 3’b0} +{pp4, 4’b0} ; endmodule Lecture 7
  • 11. 11 Relational Operators • > → greater than • < → less than • >= → greater or equal than • <= → less or equal than • Result is one bit value: 0, 1 or x 1 > 0 → 1 ’b1x1 <= 0 → x 10 < z → x Lecture 7
  • 12. 12 Equality Operators • == → logical equality • != → logical inequality • === → case equality • !== → case inequality • 4’b 1z0x == 4’b 1z0x → x • 4’b 1z0x != 4’b 1z0x → x • 4’b 1z0x === 4’b 1z0x → 1 • 4’b 1z0x !== 4’b 1z0x → 0 Lecture 7
  • 13. 13 Conditional Operator • cond_expr ? true_expr : false_expr • Like a 2-to-1 mux .. Lecture 7
  • 14. 14 Arithmetic Operators • +, -, *, /, % • If any operand is x the result is x • Negative registers: • regs can be assigned negative but are treated as unsigned reg [15:0] regA; Lecture 7
  • 15. 15 Arithmetic Operators regA = -16’d12; //stored as 216 -12 = 65524 regA/3 evaluates to 21841 •Negative integers: • can be assigned negative values • different treatment depending on base specification or not Lecture 7
  • 16. 16 Arithmetic Operators reg [15:0] regA; integer intA; .. intA = -12/3; //evaluates to –4 (no base spec) intA = -’d12/3; //evaluates to 1431655761 (base spec) Lecture 7