Professional Documents
Culture Documents
Lab1 PDF
Lab1 PDF
Homework #1
1. Install and run iverilog and GTKWave for the input files listed below:
1. fibonacci.v and fibonacci_tb.v
2. halfadder.v . Write your own testbench.
3. fulladder.v . Write your own testbench. Write brief notes on how you think
simulation works in each of these cases. Note down problems that you face in installing and
using the tool. Write a 2 page report about your experiences in using the tools. Turn in a
neatly hand-written or a printed copy. Do not attach waveforms or Verilog source code.
fibonacci.v
`include "fibonacci.v"
//Test Bench
module fibonacci_tb; // stimulus for Fibonacci generator
reg clk, rst;
wire[7:0] fibseq;
initial begin
#0 clk=1'b0;
rst=1'b1;
#12 rst=1'b0;
#10 rst=1'b1;
#150 $finish; //at time=172 stop simulation
end
endmodule
halfadder.v
module halfadder (sum, cout, a, b);
//port list does not differentiate inputs and outputs
//do so now
input a,b;
output sum,cout;
assign sum = a ^ b;
module fulladder (output sum, output cout, input a, input b, input cin);
//port list differentiates inputs and outputs
//some tools expect the inputs and outputs to be declared as wires too
wire a,b,cin,sum,cout;
wire s1;
xor(s1,a,b);
xor(sum,s1,cin);
endmodule