Professional Documents
Culture Documents
Fpga Applications
Fpga Applications
input clk;
input reset;
input d;
output q;
reg q;
begin
if (reset)
q <= 1'b0;
else
end
endmodule
// Testbench #11 D=1; // t=11
#1 reset=0; // t=21
mod-64 counter in a structural fashion. Write a verilog code for the mod-64 counter and show with
3) Design a state-machine for the sequential circuit shown in Fig.1. Write a verilog module and show
4) Design a state-machine for the sequential circuit shown in Fig.2. Write a verilog module and show
5) Design a 4-bit binary ripple counter using D-FFs. Develop a verilog module and verify the perfor-
6) Design a 4-bit 4-state ring counter. Write a verilog module of your design and verify the performance
8) Design a 4-bit binary serial-in, serial-out shift register using D-FFs. Write a verilog module of your
9) Design a 4-bit binary serial-in, parallel-out shift register using D-FFs. Write a verilog module of
your design and verify the performance through a verilog test bench.
`timescale 1ns/1ps
module shift (
input D,
Q[3]<=D;
Q[2]<=Q[3];
Q[1]<=Q[2];
Q[0]<=Q[1];
end
endmodule
`timescale 1ns/1ps
module testbench;
reg clk=1;
reg D=0;
wire [3:0] Q;
wire Q0,Q1,Q2,Q3;
assign Q0=Q[0];
assign Q1=Q[1];
assign Q2=Q[2];
assign Q3=Q[3];
shift s1(
.clk(clk),
.D(D),
.Q(Q));
initial begin
$monitor("%d %b %b %d",$time,clk,D,Q);
end
always
initial
endmodule
10) Design a 4-bit binary parallel-in, serial-out shift register using D-FFs. Write a verilog module of
your design and verify the performance through a verilog test bench.
11) Design a 4-bit binary parallel-in, parallel-out shift register using D-FFs. Write a verilog module of
your design and verify the performance through a verilog test bench.