Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Verilog, Design, verify and implement a triangular sequence generator. It generates a sequence of numbers that periodically increase and decrease between two configurable limits
In Verilog, Design, verify and implement a triangular sequence generator. It generates a sequence of numbers that periodically increase
and decrease between two configurable limits limith and limitl The sequence rate is one number per second. The binary sequence of
numbers, bcd is outputted for display as segbcd Figure shows an example of triangular sequence that varies between and The bottom
waveform is the analog signal that would be generated by a DAC whose input is the bcd sequence. Figure
The default limit values are for limitl and for limith and they are set each time the reset is applied. To change the limits use
the push button in this order. Set din to a desired value for the low limit and push the push button to set the limitl value to din value. Then
change the din value to the desired high limit and with a second push set the limith value this new din value. The current din value is displayed
through segdin output. After configuration is done, the push button is ignored.
triangle
The top level design, named triangle, has sequential blocks and one dual port ROM memory Figure
Figure : All sequential blocks are clocked by the same input clock and share the reset sinal rst active
pulsegen: To easy the design of the circuit, the pulse generator, pulsegen, generates a periodic sequence of pulses, at a rate of one pulse per
second, each pulse lasting only one clock cycle. The pulsegen is a counter that generates one pulse at each clock cycles. However,
to make possible the verification of the circuit, this number is not given as an explicit literal in HDL description but as a parameter declared
inside the pulsegen module:
The parameter value may be changed from the testbench to much lower values, suitable for verification otherwise the simulation will run for
hours to count million pulses!The pulsegen output, pulse, is used to enable the counting of the cntbcd counter.
cntbcd:
Whenever its cen input is active, it increments or decrements, according to dir input. If dir is it increments. If dir is it decrements.
fsmcnt
This automaton controls the sequence generated by cntbcd changing its direction of counting such that to keep the bcd sequence between
the limits limitland limith Whenever bcd value reaches one of the limits the counting direction, dir, is reversed.
fsmctrl
Another automaton controls the configuration process. It keeps two registers, limith and limitl whose values are changed according to the
configuration protocol described above. At the reset, their values are set to the default ones, and Two successive push update the values
of the limits after which the new limit values stay stable until reset. Keep in mind that the push button is active and that a push is
completed after the button is released.
rom
The ROM memory is a dual port read only memory. It may be initialized through the $ Sreadmemh or $readmemb tasks with proper values for
digit display. Alternatively, the initialization of the memory content may be done with an init process:
Verification
Write a testbench with the following test scenario:
apply reset
wait for clock cycles
set din and apply push for a couple of cycles
change din to a high limit and apply push for a couple of cycles
let the simulation run for some other clock cycles
In the testbench module redefine the pulsegen parameter, such that is generates a pulse at each clock cycles instead of one at each
cycles:
Implementation : Using the recommended board display digits, push buttons, switches and clock sources see Figure implement
the triangle toplevel design module.
Interfaces
pulsegenrst clk pulse with an internal parameter named CYCLE
cntbcdrst clk cen, dir, value fsmcntrst clk limith limitl value, dir fsmctrlrst clk push, din, limith limitl
romxaddra douta, addrb, doutb trianglerst clk push, din, segdin, segbcd with the pulsegen instance name pulsegen and a bit
connection named bcd triangletb with the triangle instance name dut
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started