SlideShare a Scribd company logo
1 of 2
Download to read offline
The following is the verilog code for a 15 bit 2 to 1 multiplexer. When the selector is 0 the
output f is i0 and when the selector is 1 the output is i1.
module mux2to1(i0, i1, s, f);
input i0, i1, s;
outputf;
assignf= s ? i1 : i0;
endmodule
Modify this code to build a 15 bit 4 to 1 multiplexer. The multiplexer will! have the following
specification:
Four 15 bit data inputs, W0, W1, W2 and W3.
One 25 bit selector input, S[1..0].
One 15 bit output, F.
When S [1..0] = 00 the output will be W0.
When S [1..0] = 01 the output will be W1.
When S [1..0] = 10 the output will be W2.
When S [1..0] = 11 the output will beW3.
Solution
module mux41(W0,W1,W2,W3,S,F);
input [14:0]W0;
input [14:0]W1;
input [14:0]W2;
input [14:0]W3;
input [1:0] s;
output [14:0] F;
reg [14:0] F;
always @(*) //It includes all Inputs.
begin
case (S)
2'b00 : F = w0;
2'b01 : F = W1;
2'b10 : F = W2;
2'b11 : F = W3;
endcase
end
endmodule

More Related Content

Similar to The following is the verilog code for a 15 bit 2 to 1 multiplexer. W.pdf

digital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdfdigital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdf
somanathbtech
 
digital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdfdigital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdf
somanathbtech
 

Similar to The following is the verilog code for a 15 bit 2 to 1 multiplexer. W.pdf (7)

Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
digital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdfdigital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdf
 
digital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdfdigital-electronics_9 encoder and decoder pdf
digital-electronics_9 encoder and decoder pdf
 
combinational circuits dispositivos .ppt
combinational circuits dispositivos .pptcombinational circuits dispositivos .ppt
combinational circuits dispositivos .ppt
 
unit 3.pptx
unit 3.pptxunit 3.pptx
unit 3.pptx
 
Number System[HEXADECIMAL].pptx
Number System[HEXADECIMAL].pptxNumber System[HEXADECIMAL].pptx
Number System[HEXADECIMAL].pptx
 
Assignment#4b
Assignment#4bAssignment#4b
Assignment#4b
 

More from amplefashionhousepvt

The following information was obtained from the accounts of Airlines.pdf
The following information was obtained from the accounts of Airlines.pdfThe following information was obtained from the accounts of Airlines.pdf
The following information was obtained from the accounts of Airlines.pdf
amplefashionhousepvt
 
The following are the balances in the accounts for Joan Miller Adver.pdf
The following are the balances in the accounts for Joan Miller Adver.pdfThe following are the balances in the accounts for Joan Miller Adver.pdf
The following are the balances in the accounts for Joan Miller Adver.pdf
amplefashionhousepvt
 

More from amplefashionhousepvt (10)

the following just needs answer an exmaple pleaseConic Secti.pdf
the following just needs answer an exmaple pleaseConic Secti.pdfthe following just needs answer an exmaple pleaseConic Secti.pdf
the following just needs answer an exmaple pleaseConic Secti.pdf
 
The following is a histogram showing the distribution of the ave.pdf
The following is a histogram showing the distribution of the ave.pdfThe following is a histogram showing the distribution of the ave.pdf
The following is a histogram showing the distribution of the ave.pdf
 
The following information was obtained from the accounts of Airlines.pdf
The following information was obtained from the accounts of Airlines.pdfThe following information was obtained from the accounts of Airlines.pdf
The following information was obtained from the accounts of Airlines.pdf
 
The following hypothetical data ws collected from a simple random sa.pdf
The following hypothetical data ws collected from a simple random sa.pdfThe following hypothetical data ws collected from a simple random sa.pdf
The following hypothetical data ws collected from a simple random sa.pdf
 
The following events have their initial impact on which of the follo.pdf
The following events have their initial impact on which of the follo.pdfThe following events have their initial impact on which of the follo.pdf
The following events have their initial impact on which of the follo.pdf
 
The following functions, provided by financial intermediaries, enabl.pdf
The following functions, provided by financial intermediaries, enabl.pdfThe following functions, provided by financial intermediaries, enabl.pdf
The following functions, provided by financial intermediaries, enabl.pdf
 
The following data are supposedly from a Weibull distribution 15.4.pdf
The following data are supposedly from a Weibull distribution  15.4.pdfThe following data are supposedly from a Weibull distribution  15.4.pdf
The following data are supposedly from a Weibull distribution 15.4.pdf
 
The following data are from an experiment designed to investigate th.pdf
The following data are from an experiment designed to investigate th.pdfThe following data are from an experiment designed to investigate th.pdf
The following data are from an experiment designed to investigate th.pdf
 
The following data apply to Jacobus and Associates (millions of doll.pdf
The following data apply to Jacobus and Associates (millions of doll.pdfThe following data apply to Jacobus and Associates (millions of doll.pdf
The following data apply to Jacobus and Associates (millions of doll.pdf
 
The following are the balances in the accounts for Joan Miller Adver.pdf
The following are the balances in the accounts for Joan Miller Adver.pdfThe following are the balances in the accounts for Joan Miller Adver.pdf
The following are the balances in the accounts for Joan Miller Adver.pdf
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Recently uploaded (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 

The following is the verilog code for a 15 bit 2 to 1 multiplexer. W.pdf

  • 1. The following is the verilog code for a 15 bit 2 to 1 multiplexer. When the selector is 0 the output f is i0 and when the selector is 1 the output is i1. module mux2to1(i0, i1, s, f); input i0, i1, s; outputf; assignf= s ? i1 : i0; endmodule Modify this code to build a 15 bit 4 to 1 multiplexer. The multiplexer will! have the following specification: Four 15 bit data inputs, W0, W1, W2 and W3. One 25 bit selector input, S[1..0]. One 15 bit output, F. When S [1..0] = 00 the output will be W0. When S [1..0] = 01 the output will be W1. When S [1..0] = 10 the output will be W2. When S [1..0] = 11 the output will beW3. Solution module mux41(W0,W1,W2,W3,S,F); input [14:0]W0; input [14:0]W1; input [14:0]W2; input [14:0]W3; input [1:0] s; output [14:0] F; reg [14:0] F; always @(*) //It includes all Inputs. begin case (S) 2'b00 : F = w0; 2'b01 : F = W1; 2'b10 : F = W2; 2'b11 : F = W3; endcase