SlideShare a Scribd company logo
Verilog coding of DEMUX 1X8 using if else statement
module demux(d, sel, z);
input d;
input [2:0] sel;
output [7:0] z;
reg [7:0] z;
always @( d or sel)
begin
if( sel==3'b000)
z[0]=d;
else if( sel==3'b001)
z[1]=d;
else if( sel==3'b010)
z[2]=d;
else if( sel==3'b011)
z[3]=d;
else if( sel==3'b100)
z[4]=d;
else if( sel==3'b101)
z[5]=d;
else if( sel==3'b110)
z[6]=d;
else
z[7]=d;
end
endmodule
Verilog coding of DEMUX 1X8 using case statement
module demux(d, sel, z);
input d;
input [2:0] sel;
output [7:0] z;
reg [7:0] z;
always @( d or sel)
begin
case(sel)
3'b000 : z[0] = d;
3'b001 : z[1] = d;
3'b010 : z[2] = d;
3'b011 : z[3] = d;
3'b100 : z[4] = d;
3'b101 : z[5] = d;
3'b110 : z[6] = d;
3'b111 : z[7] = d;
endcase
end
endmodule
Ad

More Related Content

What's hot (20)

Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
Ron Liu
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
Bharti Airtel Ltd.
 
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
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
Muhammad Uzair Rasheed
 
Arithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CArithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded C
Vikas Dongre
 
Concepts of Behavioral modelling in Verilog HDL
Concepts of Behavioral modelling in Verilog HDLConcepts of Behavioral modelling in Verilog HDL
Concepts of Behavioral modelling in Verilog HDL
anand hd
 
Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder
Bharti Airtel Ltd.
 
06 floating point
06 floating point06 floating point
06 floating point
Piyush Rochwani
 
MULTIPLEXER
MULTIPLEXERMULTIPLEXER
MULTIPLEXER
Siddhi Shrivas
 
multiplexers and demultiplexers
 multiplexers and demultiplexers multiplexers and demultiplexers
multiplexers and demultiplexers
Unsa Shakir
 
Shift Registers
Shift RegistersShift Registers
Shift Registers
Abhilash Nair
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
E2MATRIX
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Maryala Srinivas
 
gate level modeling
gate level modelinggate level modeling
gate level modeling
VandanaBR2
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
Mantra VLSI
 
Demultiplexer presentation
Demultiplexer presentationDemultiplexer presentation
Demultiplexer presentation
Shaikat Saha
 
Lect 7: Verilog Behavioral model for Absolute Beginners
Lect 7: Verilog Behavioral model for Absolute BeginnersLect 7: Verilog Behavioral model for Absolute Beginners
Lect 7: Verilog Behavioral model for Absolute Beginners
Dr.YNM
 
Switch level modeling
Switch level modelingSwitch level modeling
Switch level modeling
Devi Pradeep Podugu
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoder
Unsa Shakir
 
Sequential circuits in Digital Electronics
Sequential circuits in Digital ElectronicsSequential circuits in Digital Electronics
Sequential circuits in Digital Electronics
Vinoth Loganathan
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
Ron Liu
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
Bharti Airtel Ltd.
 
Arithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CArithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded C
Vikas Dongre
 
Concepts of Behavioral modelling in Verilog HDL
Concepts of Behavioral modelling in Verilog HDLConcepts of Behavioral modelling in Verilog HDL
Concepts of Behavioral modelling in Verilog HDL
anand hd
 
Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder
Bharti Airtel Ltd.
 
multiplexers and demultiplexers
 multiplexers and demultiplexers multiplexers and demultiplexers
multiplexers and demultiplexers
Unsa Shakir
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
E2MATRIX
 
gate level modeling
gate level modelinggate level modeling
gate level modeling
VandanaBR2
 
Demultiplexer presentation
Demultiplexer presentationDemultiplexer presentation
Demultiplexer presentation
Shaikat Saha
 
Lect 7: Verilog Behavioral model for Absolute Beginners
Lect 7: Verilog Behavioral model for Absolute BeginnersLect 7: Verilog Behavioral model for Absolute Beginners
Lect 7: Verilog Behavioral model for Absolute Beginners
Dr.YNM
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoder
Unsa Shakir
 
Sequential circuits in Digital Electronics
Sequential circuits in Digital ElectronicsSequential circuits in Digital Electronics
Sequential circuits in Digital Electronics
Vinoth Loganathan
 

Viewers also liked (20)

Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer
Bharti Airtel Ltd.
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gates
Ricardo Castro
 
Dutch media landscape 2015 Q4 update by Starcom
Dutch media landscape 2015 Q4 update by Starcom Dutch media landscape 2015 Q4 update by Starcom
Dutch media landscape 2015 Q4 update by Starcom
starcomNL
 
Ea conference st albert feb 2014
Ea conference  st albert feb 2014Ea conference  st albert feb 2014
Ea conference st albert feb 2014
tobylscott
 
Aspire one series service guide
Aspire one series service guideAspire one series service guide
Aspire one series service guide
Setyo Prasadja
 
fdgdfgdfg
fdgdfgdfgfdgdfgdfg
fdgdfgdfg
sotirov
 
CV Roy Basoeki
CV Roy BasoekiCV Roy Basoeki
CV Roy Basoeki
time4web
 
Hwswb
HwswbHwswb
Hwswb
Saranya Ram
 
Lulusan SMK PI class of 2014
Lulusan SMK PI class of 2014Lulusan SMK PI class of 2014
Lulusan SMK PI class of 2014
SMK Prakarya Internasional [SMK PI]
 
Filtros de cabine
Filtros de cabineFiltros de cabine
Filtros de cabine
tuliovmg1
 
Creando Enlaces a Prueba de Penguin
Creando Enlaces a Prueba de PenguinCreando Enlaces a Prueba de Penguin
Creando Enlaces a Prueba de Penguin
Ignacio Santiago Pérez
 
Zhuangzi
ZhuangziZhuangzi
Zhuangzi
Ton Ball
 
C++ Chapter I
C++ Chapter IC++ Chapter I
C++ Chapter I
Sorn Chanratha
 
Configure h base hadoop and hbase client
Configure h base hadoop and hbase clientConfigure h base hadoop and hbase client
Configure h base hadoop and hbase client
Shashwat Shriparv
 
Rules around us
Rules around usRules around us
Rules around us
Оксана Димова
 
Monografia fic
Monografia ficMonografia fic
Monografia fic
romercen
 
Yg Ini 1
Yg Ini 1Yg Ini 1
Yg Ini 1
septiyan_123pradita
 
Chafer, 52 Bible Doctines: Man and sin part 2
Chafer, 52 Bible Doctines: Man and sin part 2Chafer, 52 Bible Doctines: Man and sin part 2
Chafer, 52 Bible Doctines: Man and sin part 2
Richard Chamberlain
 
Miquel Martí i Pol
Miquel Martí i PolMiquel Martí i Pol
Miquel Martí i Pol
Quim Civil
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer
Bharti Airtel Ltd.
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gates
Ricardo Castro
 
Dutch media landscape 2015 Q4 update by Starcom
Dutch media landscape 2015 Q4 update by Starcom Dutch media landscape 2015 Q4 update by Starcom
Dutch media landscape 2015 Q4 update by Starcom
starcomNL
 
Ea conference st albert feb 2014
Ea conference  st albert feb 2014Ea conference  st albert feb 2014
Ea conference st albert feb 2014
tobylscott
 
Aspire one series service guide
Aspire one series service guideAspire one series service guide
Aspire one series service guide
Setyo Prasadja
 
fdgdfgdfg
fdgdfgdfgfdgdfgdfg
fdgdfgdfg
sotirov
 
CV Roy Basoeki
CV Roy BasoekiCV Roy Basoeki
CV Roy Basoeki
time4web
 
Filtros de cabine
Filtros de cabineFiltros de cabine
Filtros de cabine
tuliovmg1
 
Configure h base hadoop and hbase client
Configure h base hadoop and hbase clientConfigure h base hadoop and hbase client
Configure h base hadoop and hbase client
Shashwat Shriparv
 
Monografia fic
Monografia ficMonografia fic
Monografia fic
romercen
 
Chafer, 52 Bible Doctines: Man and sin part 2
Chafer, 52 Bible Doctines: Man and sin part 2Chafer, 52 Bible Doctines: Man and sin part 2
Chafer, 52 Bible Doctines: Man and sin part 2
Richard Chamberlain
 
Miquel Martí i Pol
Miquel Martí i PolMiquel Martí i Pol
Miquel Martí i Pol
Quim Civil
 
Ad

More from Rakesh kumar jha (9)

matlab code of shifting and folding of two sequences
matlab code of shifting and folding of two sequencesmatlab code of shifting and folding of two sequences
matlab code of shifting and folding of two sequences
Rakesh kumar jha
 
MATLAB CODE OF Shifting sequence
MATLAB  CODE  OF Shifting sequenceMATLAB  CODE  OF Shifting sequence
MATLAB CODE OF Shifting sequence
Rakesh kumar jha
 
Matlab implementation of fast fourier transform
Matlab implementation of  fast fourier transformMatlab implementation of  fast fourier transform
Matlab implementation of fast fourier transform
Rakesh kumar jha
 
Verilog code for decoder
Verilog code for decoderVerilog code for decoder
Verilog code for decoder
Rakesh kumar jha
 
VERILOG CODE FOR Adder
VERILOG CODE FOR AdderVERILOG CODE FOR Adder
VERILOG CODE FOR Adder
Rakesh kumar jha
 
Reversible code converter
Reversible code converterReversible code converter
Reversible code converter
Rakesh kumar jha
 
Ujt
UjtUjt
Ujt
Rakesh kumar jha
 
Pin diode
Pin diodePin diode
Pin diode
Rakesh kumar jha
 
Schottky diode
Schottky diodeSchottky diode
Schottky diode
Rakesh kumar jha
 
Ad

Verilog coding of demux 8 x1

  • 1. Verilog coding of DEMUX 1X8 using if else statement module demux(d, sel, z); input d; input [2:0] sel; output [7:0] z; reg [7:0] z; always @( d or sel) begin if( sel==3'b000) z[0]=d; else if( sel==3'b001) z[1]=d; else if( sel==3'b010) z[2]=d; else if( sel==3'b011) z[3]=d; else if( sel==3'b100) z[4]=d; else if( sel==3'b101) z[5]=d; else if( sel==3'b110) z[6]=d; else z[7]=d; end endmodule
  • 2. Verilog coding of DEMUX 1X8 using case statement module demux(d, sel, z); input d; input [2:0] sel; output [7:0] z; reg [7:0] z; always @( d or sel) begin case(sel) 3'b000 : z[0] = d; 3'b001 : z[1] = d; 3'b010 : z[2] = d; 3'b011 : z[3] = d; 3'b100 : z[4] = d; 3'b101 : z[5] = d; 3'b110 : z[6] = d; 3'b111 : z[7] = d; endcase end endmodule