SlideShare a Scribd company logo
A 2 X 1 M U LT I P L E X E R
S Y S T E M V E R I L O G
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
This Tutorial covers:
logic — four-state integer type where the four possible states are:
• 1 (high; True);
• 0 (low; False;
• x (unknown) — this means that the state is unknown; Verilog initializes four-state
types to X.
• z (high impedance) — this means that the state is disconnected and is essentially
“floating.”
output, input — describe the ports associated with a module and
provides a way to communicate with a module
assign — continuous assignment statement in system verilog
module — for simulation of digital circuits in software and synthesis
of digital circuits in hardware
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
module mux2_1(out, i0, i1, sel);
output logic out;
input logic i0, i1, sel;
assign out = (i1 & sel) | (i0 & ~sel);
endmodule
Creates a block of code which can be
instantiated (i.e. used) as many times as
needed in highboy other files in a
design. This module is named mux2_1
and has four ports (out, i0, i1, sel)
which allow other modules to
communicate with it.
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
module mux2_1(out, i0, i1, sel);
output logic out;
input logic i0, i1, sel;
assign out = (i1 & sel) | (i0 & ~sel);
endmodule
out is an output of the module
mux2_1. out is of the variable type
logic and can have four possible
values: z, x, 0, or 1
i0, i1, sel1 are inputs to the module
mux2_1. These three inputs are also of
the variable type logic and can have
four possible values: z, x, 0, or 1
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
module mux2_1(out, i0, i1, sel);
output logic out;
input logic i0, i1, sel;
assign out = (i1 & sel) | (i0 & ~sel);
endmodule
assigns out
the value of
(i1*sel) + (i0*sel’)
where * or & indicates AND;
+ or | indicates OR;
’ (~) indicates NOT (INVERT)
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
module mux2_1_testbench();
logic i0, i1, sel;
logic out;
mux2_1 dut (.out, .i0, .i1, .sel);
initial begin
sel=0; i0=0; i1=0; #10;
sel=0; i0=0; i1=1; #10;
sel=0; i0=1; i1=0; #10;
sel=0; i0=1; i1=1; #10;
sel=1; i0=0; i1=0; #10;
sel=1; i0=0; i1=1; #10;
sel=1; i0=1; i1=0; #10;
sel=1; i0=1; i1=1; #10;
end
endmodule
Creates variables i0, i1, sel, and out of
variable type logic
Creates a block of code that can be used to
simulate another module (in this case,
mux2_1_testbench() will simulate the
mux2_1 created on the preceding slides)
Sets up the mux2_1 for testing/simulating
and names it dut.
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
module mux2_1_testbench();
logic i0, i1, sel;
logic out;
mux2_1 dut (.out, .i0, .i1, .sel);
initial begin
sel=0; i0=0; i1=0; #10;
sel=0; i0=0; i1=1; #10;
sel=0; i0=1; i1=0; #10;
sel=0; i0=1; i1=1; #10;
sel=1; i0=0; i1=0; #10;
sel=1; i0=0; i1=1; #10;
sel=1; i0=1; i1=0; #10;
sel=1; i0=1; i1=1; #10;
end
endmodule
At time = 0: sel i0 i1 = 000
At time = 10 time units: sel i0 i1 = 001
At time = 20 time units: sel i0 i1 = 010
And so on….
This block of code assigns binary values to
the three inputs of dut: i0, i1, sel; i0, i1, sel
are defined as inputs in the mux2_1 module
shown on the preceding slides.
S Y S T E M V E R I L O G
A 2 X 1 M U LT I P L E X E R
In this introductory tutorial,
we have created a 2X1
multiplexer in System Verilog
and created a testbench to
simulate all possible input
combinations in ModelSim.
out
i0
i1
sel
Click here for
More Tutorials on
Digital Logic & Circuits
Ad

More Related Content

What's hot (20)

Embedded System Programming on ARM Cortex M3 and M4 Course
Embedded System Programming on ARM Cortex M3 and M4 CourseEmbedded System Programming on ARM Cortex M3 and M4 Course
Embedded System Programming on ARM Cortex M3 and M4 Course
FastBit Embedded Brain Academy
 
ASIC Design Flow | Physical Design | VLSI
ASIC Design Flow | Physical Design | VLSI ASIC Design Flow | Physical Design | VLSI
ASIC Design Flow | Physical Design | VLSI
Jayant Suthar
 
gate level modeling
gate level modelinggate level modeling
gate level modeling
VandanaBR2
 
System verilog verification building blocks
System verilog verification building blocksSystem verilog verification building blocks
System verilog verification building blocks
Nirav Desai
 
Demultiplexer with vhdl code
Demultiplexer  with vhdl codeDemultiplexer  with vhdl code
Demultiplexer with vhdl code
Vishal Bait
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
Dr. Swaminathan Kathirvel
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
SKUP1
 
Gate Diffusion Input Technology (Very Large Scale Integration)
Gate Diffusion Input Technology (Very Large Scale Integration)Gate Diffusion Input Technology (Very Large Scale Integration)
Gate Diffusion Input Technology (Very Large Scale Integration)
Ashwin Shroff
 
ALU
ALUALU
ALU
Ramasubbu .P
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
anand hd
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
Mantra VLSI
 
Verilog hdl design examples
Verilog hdl design examplesVerilog hdl design examples
Verilog hdl design examples
dennis gookyi
 
Programs of VHDL
Programs of VHDLPrograms of VHDL
Programs of VHDL
Rkrishna Mishra
 
Minterm and maxterm
Minterm and maxtermMinterm and maxterm
Minterm and maxterm
parsa.khan64
 
2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification
Usha Mehta
 
Vhdl lab manual
Vhdl lab manualVhdl lab manual
Vhdl lab manual
Mukul Mohal
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Maryala Srinivas
 
Verilog Tasks & Functions
Verilog Tasks & FunctionsVerilog Tasks & Functions
Verilog Tasks & Functions
anand hd
 
VLSI Training presentation
VLSI Training presentationVLSI Training presentation
VLSI Training presentation
Daola Khungur
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
Sudhanshu Janwadkar
 
Embedded System Programming on ARM Cortex M3 and M4 Course
Embedded System Programming on ARM Cortex M3 and M4 CourseEmbedded System Programming on ARM Cortex M3 and M4 Course
Embedded System Programming on ARM Cortex M3 and M4 Course
FastBit Embedded Brain Academy
 
ASIC Design Flow | Physical Design | VLSI
ASIC Design Flow | Physical Design | VLSI ASIC Design Flow | Physical Design | VLSI
ASIC Design Flow | Physical Design | VLSI
Jayant Suthar
 
gate level modeling
gate level modelinggate level modeling
gate level modeling
VandanaBR2
 
System verilog verification building blocks
System verilog verification building blocksSystem verilog verification building blocks
System verilog verification building blocks
Nirav Desai
 
Demultiplexer with vhdl code
Demultiplexer  with vhdl codeDemultiplexer  with vhdl code
Demultiplexer with vhdl code
Vishal Bait
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
SKUP1
 
Gate Diffusion Input Technology (Very Large Scale Integration)
Gate Diffusion Input Technology (Very Large Scale Integration)Gate Diffusion Input Technology (Very Large Scale Integration)
Gate Diffusion Input Technology (Very Large Scale Integration)
Ashwin Shroff
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
anand hd
 
Verilog hdl design examples
Verilog hdl design examplesVerilog hdl design examples
Verilog hdl design examples
dennis gookyi
 
Minterm and maxterm
Minterm and maxtermMinterm and maxterm
Minterm and maxterm
parsa.khan64
 
2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification
Usha Mehta
 
Verilog Tasks & Functions
Verilog Tasks & FunctionsVerilog Tasks & Functions
Verilog Tasks & Functions
anand hd
 
VLSI Training presentation
VLSI Training presentationVLSI Training presentation
VLSI Training presentation
Daola Khungur
 

Similar to System Verilog (Tutorial -- 2X1 Multiplexer) (20)

System Verilog (Tutorial -- 4X1 Multiplexer)
System Verilog (Tutorial -- 4X1 Multiplexer)System Verilog (Tutorial -- 4X1 Multiplexer)
System Verilog (Tutorial -- 4X1 Multiplexer)
Denise Wilson
 
SKEL 4273 CAD with HDL Topic 3
SKEL 4273 CAD with HDL Topic 3SKEL 4273 CAD with HDL Topic 3
SKEL 4273 CAD with HDL Topic 3
alhadi81
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
Shankar Bhukya
 
correctionTD-1-vhdl2947.pptx
correctionTD-1-vhdl2947.pptxcorrectionTD-1-vhdl2947.pptx
correctionTD-1-vhdl2947.pptx
MbarkiIsraa
 
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
SantoshDeshmukh36
 
Reliable and Concurrent Software - Erlang
Reliable and Concurrent Software - ErlangReliable and Concurrent Software - Erlang
Reliable and Concurrent Software - Erlang
ssuser2637a1
 
Logic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional LogicLogic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional Logic
Gouda Mando
 
L29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
L29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiL29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
L29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
rishaddesai420
 
MULTIPLEXER_DICA UNIT III-III.pptx
MULTIPLEXER_DICA UNIT III-III.pptxMULTIPLEXER_DICA UNIT III-III.pptx
MULTIPLEXER_DICA UNIT III-III.pptx
sowjanyaatiparthi
 
Short Notes on Verilog and SystemVerilog
Short Notes on Verilog and SystemVerilogShort Notes on Verilog and SystemVerilog
Short Notes on Verilog and SystemVerilog
Jason J Pulikkottil
 
Verilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdfVerilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdf
DrViswanathKalannaga1
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
sagar414433
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
sagar414433
 
Kts c6-vhdl
Kts c6-vhdlKts c6-vhdl
Kts c6-vhdl
Wang Ruan
 
ANN (Artificial Neural Network )- Deep Learning
ANN (Artificial Neural Network )- Deep LearningANN (Artificial Neural Network )- Deep Learning
ANN (Artificial Neural Network )- Deep Learning
lhonapadmayuky699
 
Ver2.ppt
Ver2.pptVer2.ppt
Ver2.ppt
GulAhmad16
 
Lec-02.pdf
Lec-02.pdfLec-02.pdf
Lec-02.pdf
MuhammadLatifZia
 
Combinational logic circuit by umakant bhaskar gohatre
Combinational logic circuit by umakant bhaskar gohatreCombinational logic circuit by umakant bhaskar gohatre
Combinational logic circuit by umakant bhaskar gohatre
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
dokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdfdokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdf
Velmathi Saravanan
 
minimization technique.ppt
minimization technique.pptminimization technique.ppt
minimization technique.ppt
tahobah480
 
System Verilog (Tutorial -- 4X1 Multiplexer)
System Verilog (Tutorial -- 4X1 Multiplexer)System Verilog (Tutorial -- 4X1 Multiplexer)
System Verilog (Tutorial -- 4X1 Multiplexer)
Denise Wilson
 
SKEL 4273 CAD with HDL Topic 3
SKEL 4273 CAD with HDL Topic 3SKEL 4273 CAD with HDL Topic 3
SKEL 4273 CAD with HDL Topic 3
alhadi81
 
correctionTD-1-vhdl2947.pptx
correctionTD-1-vhdl2947.pptxcorrectionTD-1-vhdl2947.pptx
correctionTD-1-vhdl2947.pptx
MbarkiIsraa
 
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
SantoshDeshmukh36
 
Reliable and Concurrent Software - Erlang
Reliable and Concurrent Software - ErlangReliable and Concurrent Software - Erlang
Reliable and Concurrent Software - Erlang
ssuser2637a1
 
Logic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional LogicLogic Design - Chapter 5: Part1 Combinattional Logic
Logic Design - Chapter 5: Part1 Combinattional Logic
Gouda Mando
 
L29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
L29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiL29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
L29-memory arrays.pptxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
rishaddesai420
 
MULTIPLEXER_DICA UNIT III-III.pptx
MULTIPLEXER_DICA UNIT III-III.pptxMULTIPLEXER_DICA UNIT III-III.pptx
MULTIPLEXER_DICA UNIT III-III.pptx
sowjanyaatiparthi
 
Short Notes on Verilog and SystemVerilog
Short Notes on Verilog and SystemVerilogShort Notes on Verilog and SystemVerilog
Short Notes on Verilog and SystemVerilog
Jason J Pulikkottil
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
sagar414433
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
sagar414433
 
ANN (Artificial Neural Network )- Deep Learning
ANN (Artificial Neural Network )- Deep LearningANN (Artificial Neural Network )- Deep Learning
ANN (Artificial Neural Network )- Deep Learning
lhonapadmayuky699
 
dokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdfdokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdf
Velmathi Saravanan
 
minimization technique.ppt
minimization technique.pptminimization technique.ppt
minimization technique.ppt
tahobah480
 
Ad

More from Denise Wilson (20)

Sexual Harassment in Academia
Sexual Harassment in AcademiaSexual Harassment in Academia
Sexual Harassment in Academia
Denise Wilson
 
Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?
Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?
Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?
Denise Wilson
 
Is Sexual Harassment Different among Different Age Groups?
Is Sexual Harassment Different among Different Age Groups?Is Sexual Harassment Different among Different Age Groups?
Is Sexual Harassment Different among Different Age Groups?
Denise Wilson
 
Is Sexual Harassment Different by Race and Ethnicity?
Is Sexual Harassment Different by Race and Ethnicity?Is Sexual Harassment Different by Race and Ethnicity?
Is Sexual Harassment Different by Race and Ethnicity?
Denise Wilson
 
Is Sexual Harassment Different for Men vs. Women?
Is Sexual Harassment Different for Men vs. Women?Is Sexual Harassment Different for Men vs. Women?
Is Sexual Harassment Different for Men vs. Women?
Denise Wilson
 
What do Student Evaluations of Teaching Really Measure?
What do Student Evaluations of Teaching Really Measure?What do Student Evaluations of Teaching Really Measure?
What do Student Evaluations of Teaching Really Measure?
Denise Wilson
 
Student Teaching Evaluations: Friend or Foe?
Student Teaching Evaluations: Friend or Foe?Student Teaching Evaluations: Friend or Foe?
Student Teaching Evaluations: Friend or Foe?
Denise Wilson
 
Women in the Engineering Workplace
Women in the Engineering WorkplaceWomen in the Engineering Workplace
Women in the Engineering Workplace
Denise Wilson
 
Boeing 737 Max Accidents
Boeing 737 Max AccidentsBoeing 737 Max Accidents
Boeing 737 Max Accidents
Denise Wilson
 
Electricity production windpower
Electricity production windpowerElectricity production windpower
Electricity production windpower
Denise Wilson
 
Environmental Impacts of Electricity Production
Environmental Impacts of Electricity ProductionEnvironmental Impacts of Electricity Production
Environmental Impacts of Electricity Production
Denise Wilson
 
Economic Considerations in Engineering Design
Economic Considerations in Engineering DesignEconomic Considerations in Engineering Design
Economic Considerations in Engineering Design
Denise Wilson
 
Social Considerations in Engineering Design
Social Considerations in Engineering DesignSocial Considerations in Engineering Design
Social Considerations in Engineering Design
Denise Wilson
 
Environmental Considerations in Electronic Product Design
Environmental Considerations in Electronic Product DesignEnvironmental Considerations in Electronic Product Design
Environmental Considerations in Electronic Product Design
Denise Wilson
 
Basic Engineering Design (Part 8)): Redesigning & Iterating
Basic Engineering Design (Part 8)):  Redesigning & IteratingBasic Engineering Design (Part 8)):  Redesigning & Iterating
Basic Engineering Design (Part 8)): Redesigning & Iterating
Denise Wilson
 
Basic Engineering Design (Part 7): Presenting the Solution
Basic Engineering Design (Part 7): Presenting the SolutionBasic Engineering Design (Part 7): Presenting the Solution
Basic Engineering Design (Part 7): Presenting the Solution
Denise Wilson
 
Basic Engineering Design (Part 6): Test and Evaluate
Basic Engineering Design (Part 6): Test and EvaluateBasic Engineering Design (Part 6): Test and Evaluate
Basic Engineering Design (Part 6): Test and Evaluate
Denise Wilson
 
Basic Engineering Design (Part 5): Constructing a Prototype
Basic Engineering Design (Part 5): Constructing a PrototypeBasic Engineering Design (Part 5): Constructing a Prototype
Basic Engineering Design (Part 5): Constructing a Prototype
Denise Wilson
 
Basic Engineering Design (Part 4): Selecting the Best Solution
Basic Engineering Design (Part 4): Selecting the Best SolutionBasic Engineering Design (Part 4): Selecting the Best Solution
Basic Engineering Design (Part 4): Selecting the Best Solution
Denise Wilson
 
Basic Engineering Design (Part 3): Designing Solutions
Basic Engineering Design (Part 3): Designing SolutionsBasic Engineering Design (Part 3): Designing Solutions
Basic Engineering Design (Part 3): Designing Solutions
Denise Wilson
 
Sexual Harassment in Academia
Sexual Harassment in AcademiaSexual Harassment in Academia
Sexual Harassment in Academia
Denise Wilson
 
Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?
Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?
Is Sexual Harassment different for Gender and Sexual Minorities (LGBTQ)?
Denise Wilson
 
Is Sexual Harassment Different among Different Age Groups?
Is Sexual Harassment Different among Different Age Groups?Is Sexual Harassment Different among Different Age Groups?
Is Sexual Harassment Different among Different Age Groups?
Denise Wilson
 
Is Sexual Harassment Different by Race and Ethnicity?
Is Sexual Harassment Different by Race and Ethnicity?Is Sexual Harassment Different by Race and Ethnicity?
Is Sexual Harassment Different by Race and Ethnicity?
Denise Wilson
 
Is Sexual Harassment Different for Men vs. Women?
Is Sexual Harassment Different for Men vs. Women?Is Sexual Harassment Different for Men vs. Women?
Is Sexual Harassment Different for Men vs. Women?
Denise Wilson
 
What do Student Evaluations of Teaching Really Measure?
What do Student Evaluations of Teaching Really Measure?What do Student Evaluations of Teaching Really Measure?
What do Student Evaluations of Teaching Really Measure?
Denise Wilson
 
Student Teaching Evaluations: Friend or Foe?
Student Teaching Evaluations: Friend or Foe?Student Teaching Evaluations: Friend or Foe?
Student Teaching Evaluations: Friend or Foe?
Denise Wilson
 
Women in the Engineering Workplace
Women in the Engineering WorkplaceWomen in the Engineering Workplace
Women in the Engineering Workplace
Denise Wilson
 
Boeing 737 Max Accidents
Boeing 737 Max AccidentsBoeing 737 Max Accidents
Boeing 737 Max Accidents
Denise Wilson
 
Electricity production windpower
Electricity production windpowerElectricity production windpower
Electricity production windpower
Denise Wilson
 
Environmental Impacts of Electricity Production
Environmental Impacts of Electricity ProductionEnvironmental Impacts of Electricity Production
Environmental Impacts of Electricity Production
Denise Wilson
 
Economic Considerations in Engineering Design
Economic Considerations in Engineering DesignEconomic Considerations in Engineering Design
Economic Considerations in Engineering Design
Denise Wilson
 
Social Considerations in Engineering Design
Social Considerations in Engineering DesignSocial Considerations in Engineering Design
Social Considerations in Engineering Design
Denise Wilson
 
Environmental Considerations in Electronic Product Design
Environmental Considerations in Electronic Product DesignEnvironmental Considerations in Electronic Product Design
Environmental Considerations in Electronic Product Design
Denise Wilson
 
Basic Engineering Design (Part 8)): Redesigning & Iterating
Basic Engineering Design (Part 8)):  Redesigning & IteratingBasic Engineering Design (Part 8)):  Redesigning & Iterating
Basic Engineering Design (Part 8)): Redesigning & Iterating
Denise Wilson
 
Basic Engineering Design (Part 7): Presenting the Solution
Basic Engineering Design (Part 7): Presenting the SolutionBasic Engineering Design (Part 7): Presenting the Solution
Basic Engineering Design (Part 7): Presenting the Solution
Denise Wilson
 
Basic Engineering Design (Part 6): Test and Evaluate
Basic Engineering Design (Part 6): Test and EvaluateBasic Engineering Design (Part 6): Test and Evaluate
Basic Engineering Design (Part 6): Test and Evaluate
Denise Wilson
 
Basic Engineering Design (Part 5): Constructing a Prototype
Basic Engineering Design (Part 5): Constructing a PrototypeBasic Engineering Design (Part 5): Constructing a Prototype
Basic Engineering Design (Part 5): Constructing a Prototype
Denise Wilson
 
Basic Engineering Design (Part 4): Selecting the Best Solution
Basic Engineering Design (Part 4): Selecting the Best SolutionBasic Engineering Design (Part 4): Selecting the Best Solution
Basic Engineering Design (Part 4): Selecting the Best Solution
Denise Wilson
 
Basic Engineering Design (Part 3): Designing Solutions
Basic Engineering Design (Part 3): Designing SolutionsBasic Engineering Design (Part 3): Designing Solutions
Basic Engineering Design (Part 3): Designing Solutions
Denise Wilson
 
Ad

Recently uploaded (20)

acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Slide share PPT of NOx control technologies.pptx
Slide share PPT of  NOx control technologies.pptxSlide share PPT of  NOx control technologies.pptx
Slide share PPT of NOx control technologies.pptx
vvsasane
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdfSmart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
PawachMetharattanara
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
Construction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.pptConstruction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.ppt
ssuser2ffcbc
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Journal of Soft Computing in Civil Engineering
 
Working with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to ImplementationWorking with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to Implementation
Alabama Transportation Assistance Program
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
Guru Nanak Technical Institutions
 
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning ModelsMode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Journal of Soft Computing in Civil Engineering
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Slide share PPT of NOx control technologies.pptx
Slide share PPT of  NOx control technologies.pptxSlide share PPT of  NOx control technologies.pptx
Slide share PPT of NOx control technologies.pptx
vvsasane
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdfSmart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
PawachMetharattanara
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
Construction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.pptConstruction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.ppt
ssuser2ffcbc
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 

System Verilog (Tutorial -- 2X1 Multiplexer)

  • 1. A 2 X 1 M U LT I P L E X E R S Y S T E M V E R I L O G
  • 2. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R This Tutorial covers: logic — four-state integer type where the four possible states are: • 1 (high; True); • 0 (low; False; • x (unknown) — this means that the state is unknown; Verilog initializes four-state types to X. • z (high impedance) — this means that the state is disconnected and is essentially “floating.” output, input — describe the ports associated with a module and provides a way to communicate with a module assign — continuous assignment statement in system verilog module — for simulation of digital circuits in software and synthesis of digital circuits in hardware
  • 3. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R module mux2_1(out, i0, i1, sel); output logic out; input logic i0, i1, sel; assign out = (i1 & sel) | (i0 & ~sel); endmodule Creates a block of code which can be instantiated (i.e. used) as many times as needed in highboy other files in a design. This module is named mux2_1 and has four ports (out, i0, i1, sel) which allow other modules to communicate with it.
  • 4. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R module mux2_1(out, i0, i1, sel); output logic out; input logic i0, i1, sel; assign out = (i1 & sel) | (i0 & ~sel); endmodule out is an output of the module mux2_1. out is of the variable type logic and can have four possible values: z, x, 0, or 1 i0, i1, sel1 are inputs to the module mux2_1. These three inputs are also of the variable type logic and can have four possible values: z, x, 0, or 1
  • 5. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R module mux2_1(out, i0, i1, sel); output logic out; input logic i0, i1, sel; assign out = (i1 & sel) | (i0 & ~sel); endmodule assigns out the value of (i1*sel) + (i0*sel’) where * or & indicates AND; + or | indicates OR; ’ (~) indicates NOT (INVERT)
  • 6. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R module mux2_1_testbench(); logic i0, i1, sel; logic out; mux2_1 dut (.out, .i0, .i1, .sel); initial begin sel=0; i0=0; i1=0; #10; sel=0; i0=0; i1=1; #10; sel=0; i0=1; i1=0; #10; sel=0; i0=1; i1=1; #10; sel=1; i0=0; i1=0; #10; sel=1; i0=0; i1=1; #10; sel=1; i0=1; i1=0; #10; sel=1; i0=1; i1=1; #10; end endmodule Creates variables i0, i1, sel, and out of variable type logic Creates a block of code that can be used to simulate another module (in this case, mux2_1_testbench() will simulate the mux2_1 created on the preceding slides) Sets up the mux2_1 for testing/simulating and names it dut.
  • 7. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R module mux2_1_testbench(); logic i0, i1, sel; logic out; mux2_1 dut (.out, .i0, .i1, .sel); initial begin sel=0; i0=0; i1=0; #10; sel=0; i0=0; i1=1; #10; sel=0; i0=1; i1=0; #10; sel=0; i0=1; i1=1; #10; sel=1; i0=0; i1=0; #10; sel=1; i0=0; i1=1; #10; sel=1; i0=1; i1=0; #10; sel=1; i0=1; i1=1; #10; end endmodule At time = 0: sel i0 i1 = 000 At time = 10 time units: sel i0 i1 = 001 At time = 20 time units: sel i0 i1 = 010 And so on…. This block of code assigns binary values to the three inputs of dut: i0, i1, sel; i0, i1, sel are defined as inputs in the mux2_1 module shown on the preceding slides.
  • 8. S Y S T E M V E R I L O G A 2 X 1 M U LT I P L E X E R In this introductory tutorial, we have created a 2X1 multiplexer in System Verilog and created a testbench to simulate all possible input combinations in ModelSim. out i0 i1 sel Click here for More Tutorials on Digital Logic & Circuits
  翻译: