UNB/ CS/ David Bremner/ teaching/ cs3613/ assignments/ Verilog Assignment



Problem description

Using verilog, build a complete specification for a treadmill controller. The treadmill that you are to design has 6 input buttons (all single bit signals) and a single bit clock input (clk):

start – start the treadmill
stop – stop the treadmill
speed_inc – increase the speed of the treadmill
speed_dec – decrease the speed of the treadmill
incline_inc – increase the incline of the treadmill
incline_dec – decrease the incline of the treadmill

When the start button is pushed, a timer will start (from 00:00) counting the number of minutes and seconds that the person has been exercising for. Initially, the speed of the treadmill will be 1.0 km/hr and the incline of the treadmill will be 0 degrees. To increase/decrease the speed, the user will push the speed_inc/speed_dec button respectively. Each push of the button will result in a change of 0.1 km/hr in the speed. The maximum speed is 20.0 km/hr. The minimum speed is 0.0 km/hr. The incline of the treadmill is increased/decreased by pushing the incline_inc/incline_dec buttons respectively. Each push of the button will change the slope by 0.1 degree. The maximum slope is 10 degrees, and the minimum slope is 0 degrees.

The outputs from the treadmill include the following:

    motor – This single bit signal is a pulse width modulation of
       the speed. The motor has a maximum speed of 20 km/hr. So,
       if you want the motor to go 10 km/hr, you need to signal a
       ‘1’ to the motor 50% of the time. If you want to travel at
       5 km/hr then you need to signal a ‘1’ to the motor 25% of
       the time.
    slope – The binary value of the current slope.
    Speed – The current speed in binary (ie 0.5km/hr is 000101).
    Minutes – the number of minutes spent on the treadmill (in binary).
    Seconds – the number of seconds spent on the treadmill (in
               binary). Together with Minutes this represents the
               MM:SS time!
    Distance – the distance that has been run so far (in binary)
               to 1/100th of a km.

When the timer reaches 60:00 or the stop button is pressed the treadmill stops – the signals to the motor stop and the value of the shifter goes to 0. The other outputs remain constant until the start button is pushed again.

HINT You can use a fixed rate to your clock input to activate the circuit and count time (i.e. 5kHz means the clock signal alternates between ‘0’ and ‘1’ where it will be a ‘1’ exactly 5000 times each second).

To verify your circuit you can use a simulator. It is suggested that you use the verilog compiler/simulator available from

 http://code.google.com/p/odin-ii/

What to hand in

For obvious reasons, we won't be using the Racket handin server this assignment. Send a zip file or a gzipped tar file of your verilog source to the instructor by email, before the deadline.