Baud Rate (Bits Per Second) Factor To Nominal (Baud Rate / 9600) Remarks
Baud Rate (Bits Per Second) Factor To Nominal (Baud Rate / 9600) Remarks
Baud Rate (Bits Per Second) Factor To Nominal (Baud Rate / 9600) Remarks
Project specifications:
This project aims at building a simple hardware description of a sequential circuit in Verilog
HDL which goal is to produce clock signals for serial communication baud rate generators.
Asynchronous serial communication requires clocks to be generated for being able to recover
the information from the received bits. The requirements are:
Support multiple baud rates (symbols or bits per second)
A clock signal of frequency 16 times the baud rate frequency should be generated
for every supported baud rate value.
The supported bit rates are given in the table below. They are all based on the nominal baud
rate of 9600 bits per second
Baud Rate (bits Factor to Nominal Remarks
per second) (Baud Rate / 9600)
9600 1 Nominal
19200 2 2x times
38400 4 4x times
115200 12 12x times
Our circuit is used to generate different clock of different clock frequencies as mentioned
above. We have chosen the system clock frequency as 125 MHz. The design style should be
based on the use of synchronous frequency division counters along with simple change
detection circuits.
We have made four blocks for the four different clock generation namely clk1152, clk384,
clk192 and clk96. These signals are used to produce clocks of different frequency according to
the specifications mentioned above. So we have used 4 different counters to produce the
respective clocks. Their division factors using system clock as 125 MHz are shown below:
The first clock output circuit will generate clk1152. Its frequency is
f 1152=115200 ×16=1,843,200=1.8432 MHz
To generate this clock signal output, a counter is used to divides the system clock by the
following factor:
f system
N= =33.9≈ 34
f 1152 × 2
The factor 2 in the denominator is used to guarantee a 50% duty cycle. Similarly,
To generate this clock signal output, a counter is used to divides the system clock by the
following factor:
f system
N= =101.7 ≈ 102
f 384 × 2
To generate this clock signal output, a counter is used to divides the system clock by the
following factor:
f system
N= =203.45 ≈ 203
f 192 ×2
Division factor for 9600 baud rate:
The first clock output circuit will generate clk96. Its frequency is
To generate this clock signal output, a counter is used to divides the system clock by the
following factor:
f system
N= =406.9 ≈ 407
f 96 × 2
Design HDL code:
So there are different parts of the HDL code , below is the brief description of each part :
Then there is parameter declaration and different counter variables which is being declared as
register.
parameter DIV1=34;
reg[5:0] cnt1;
reg[1:0] cnt2;
reg[2:0] cnt3;
reg[3:0] cnt4;
Here we have decided the DIV1 parameter should be 34 according to 115200 baud rate as
calculated above.
Then there comes the main four always block which is the main building of the code. In each
blocks we have generated clock of different frequencies with the help of counter as mentioned
above. Each always block is running on positive edge of the 125 MHz Clk which is being
produced in the testbench.
Test bench and its features:
In order to simulate and test the circuit, a testbench should be developed. The testbench needs
to:
instantiate the design and connect its inputs and outputs
create the input clock with the appropriate frequency
// Inputs
reg clk;
reg reset;
// Outputs
wire clk1152;
wire clk384;
wire clk192;
wire clk96;
initial begin
clk=0;
reset=0;
#15 reset=1;
#80 reset = 0;
end
always
#40 clk=~clk;
initial
#200000 $finish;
initial
begin
$dumpfile("dump.vcd");
$dumpvars(1, bdgentb);
end
endmodule
First we have declared inputs of design module as reg and outputs as wire, then we have
instantiated the design module with correct port association. Our timescale directive is
100ps/100ps which means #1 delay is equal to 100ps delay and precision is of 100ps.
So then the initial block where we initialise the system clock as 0 and made reset =0. Then we
made reset high at 1500ps and low at 8000ps. Then comes the always block which is used to
produce clock of 125 MHz frequency. After that there are two initial blocks first one is used to
finish the simulation at 20000000ps and second one is used to save all the signal transition into
wave files.
SIMULATION WAVEFORM:
So we run simulation up to 19,996,000ps which made it possible to view all the clocks of
different frequencies in one window. First row gives Clk of 125 MHz frequency.
Based on which different rows show different clocks of given frequencies. Simulation shows
the output as expected as clk1152 should be of highest frequency and subsequent clocks will be
of lower frequencies.
Discussion and issues faced:
There were many issues faced during the making of the project:
First we have to find division factor for given clock frequency which is the little
difficult task to perform.
Then we faced problem in deciding length of the counter variables as one time during
the simulation it was not showing the correct output because the length of the one of
counter variables was less.
We have an issue during port association in the test bench as we have not declared the
one of the inputs.
Rest all the things went good , project is completed successfully with correct output waveform.
APPENDIX:
https://www.edaplayground.com/x/7KgU
input clk,reset;
output reg clk1152,clk384,clk192,clk96;
parameter DIV1=34;//fsystem/f1152*2,fsystem=125Mhz
reg[5:0] cnt1;
reg[1:0] cnt2;
reg[2:0] cnt3;
reg[3:0] cnt4;
endmodule
module bdgentb;
// Inputs
reg clk;
reg reset;
// Outputs
wire clk1152;
wire clk384;
wire clk192;
wire clk96;
initial begin
clk=0;
reset=0;
#15 reset=1;
#80 reset = 0;
end
always
#40 clk=~clk;
initial
#200000 $finish;
initial
begin
$dumpfile("dump.vcd");
$dumpvars(1, bdgentb);
end
endmodule