Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Icarus Verilog tutorial With ScreenShots

Status
Not open for further replies.

blooz

Advanced Member level 2
Joined
Dec 29, 2010
Messages
560
Helped
121
Reputation
242
Reaction score
116
Trophy points
1,343
Location
India
Activity points
4,985
Here is the Icarus Verilog tutorial With Screen shots


A 4 bit Counter is used
//Save As counter.v
///////////////////////////


// 4 bit Counter


module counter(clk,q,reset);
input clk;
input reset;
output reg [3:0] q;
initial
begin
q=4'b0000;
end

always@( posedge clk)
begin
if (reset==1'b1)
q=4'b0000;
else
q=q+1;

end

endmodule


///////////////////////////



//Testbench

//Save as countertb.v
////////////////////////////////
`timescale 1ns/1ns


module countertb();

reg clk;
reg reset;

wire [3:0] q;

counter instance0(.clk(clk),.q(q),.reset(reset));

initial
begin
clk=1'b0;
reset=1'b1;
#10 reset=1'b0;
#1600 ;
$finish;
end

initial
begin
forever #20 clk=~clk;
end

initial
begin
$monitor("time=>%tns q=>%b",$time,q);
end

endmodule


//////////////////////////////////
 

steps

1.Save the Design files to a Folder ,say y:\Work_Space

2.type cmd run

3.navigate to the folder y:\work_space

4.Compile the files with icarus verilog as iverilog -o result counter.v countertb.v

5.then run simulation vvp result
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top