Latest Post
Verilog: XOR Gate Behavioral Modelling with Testbench Code
- Get link
- X
- Other Apps
Verilog Code XOR Gate Behavioral Modelling
module XOR_GATE (
input a, b,
output out );
reg out;
always @(a or b)
begin
if(a==b)
out = 1’b0;
else
out = 1’b1;
endmodule
//test-bench
initial begin
a=0; b=0;
#100; //wait 100ns for global reset to finish
//add stimulus here
#100 a=0; b=1;
#100 a=1; b=0;
#100 a=1; b=1;
end
initial begin
#100 $monitor(“a=%b, b=%b, out=%b”, a, b, out);
end
endmodule
Xilinx Output:
- Get link
- X
- Other Apps
Popular posts from this blog
Samir Palnitkar Solution Manual Free Download PDF of Verilog HDL
This is a solution guide to the exercises of the book "The Solution Manual of the Verilog HDL: A Guide to Digital Design and Synthesis by Samir Palnitkar". Following are the Solutions to Solution Manual on Verilog HDL: A Guide to Digital Design and Synthesis by Samir Palnitkar , exercises of all chapters in the book. Chapter 1 ----------------- No Exercises ---------------- Chapter 2 : Hierarchical Modeling Concepts Chapter 3 : Basic Concepts Chapter 4 : Modules and Ports Chapter 5: Gate-level Modeling Chapter 6 : Dataflow Modeling Chapter 7 : Behavioral Modeling Chapter 8 : Tasks and Functions Download Solution Manual: Click on this link (Mega.nz Link) [Solution Manual to Verilog HDL: A Guide to Digital Design and Synthesis by Samir Palnitkar] Preview of Solution Manual: For Verilog Programs: Go to Index of Verilog Programming Tags: Verilog HDL solutio...
VLSI: 4-1 MUX Dataflow Modelling with Testbench
Verilog Code for 4-1 MUX Dataflow Modelling module m41(out, i0, i1, i2, i3, s0, s1); output out; input i0, i1, i2, i3, s0, s1; assign y0 = (i0 & (~s0) & (~s1)); assign y1 = (i1 & (~s0) & s1); assign y2 = (i2 & s0 & (~s1)); assign y3 = (i3 & s0 & s1); assign out = (y0 | y1 | y2 | y3); endmodule //Testbench code for 4-1 MUX Dataflow Modelling initial begin // Initialize Inputs a = 1;b = 0;c = 0;d = 0;s0 = 0;s1 = 0; ...
VLSI: 8-3 Encoder Dataflow Modelling with Testbench
Verilog Code for 8-3 Encoder Dataflow Modelling module encoder_8_to_3( input d0, input d1, input d2, input d3, input d4, input d5, input d6, input d7, output q0, output q1, output q2 ); assign q0 = ( d1 | d3 | d5 | d7 ); assign q1 = ( d2 | d3 | d6 | d7 ); assign q2 = ( d4 | d6 | d5 | d7 ); endmodule //Testbench code for 8-3 Encoder Dataflow Modelling initial begin ...
VLSI: 3-8 Decoder Dataflow Modelling with Testbench
Verilog Code for 3-8 Decoder Dataflow Modelling module decoder3_to_8( input x, input y, input z, output d0, output d1, output d2, output d3, output d4, output d5, output d6, output d7 ); assign d0 = xn & yn & zn; assign d1 = xn & yn & z; assign d2 = xn & y & zn; assign d3 = xn & y & z; assign d4 = x & yn & z; assign d5 = x & yn & z; assign d6 = x & y & zn; assign d7 = x & y & z; assign xn = ~ x; assign yn = ~ y; assign zn = ~ z; endmodule //Testbench code for 3-8 Decoder Dataflow Modelling ...
Verilog: 4 to 1 Multiplexer Behavioral Modelling with Testbench Code
Verilog Code 4-1 Multiplexer Behavioral Modelling using Case Statement module Mux_4to1 ( input [3:0] i, input s1, s0, output out ); always @(i or s1 or s0) case({s1, s0}) 0 : out = i[0]; 1 : out = i[1]; 2 : out = i[2]; 3 : out = i[3]; default : out = 1’bx; endcase endmodule // test-bench initial begin i=1'b1010; s1=0; s0=0; #100; //wait 100ns for global reset to finish //add stimulus here #100 s1 = 0; s0= 1; #100 s1 = 1; s0= 0; #100 s1 = 1; s0= 1; end

Comments
Post a Comment