Due Friday, Feburary 6th (writeup and demo in KLab by 6:30pm)
This lab is worth 10 points.
You can do this lab in groups.
A few things that have come up:
Before you begin, you'll want to walk through the tutorial.
In this lab, you'll be writing code for a simple timer device. The timer is one of the memory mapped devices available via the LC4 ISA and the only one you can reasonably write yourself.
Four files have been supplied for you:
When you create your project, you can simply copy these files into the project directory and then add them. Your job is to write the module code for timer.v.
The timer device has the following interface:
You should implement this interface using the given Nbit_reg register primitives and combinational logic.
The timer device is instantiated by a harness module which connects the timer to buttons and LED's on the daughter board (the little board that connects to the side of the main board). In addition to instantiating the timer, the harness module connects BTN5 to LED8 on the daughter board so that the LED will light up when the button is pressed. You can use this function to test the board and your setup before you have even coded up your timer.
As for the timer, the write_interval and read_status signals are connected to BTN1 and BTN2, respectively. The status_out signal is connected to LED1. The interval_in bus is connected to a hardwired value of 3000 ms (i.e., 3 seconds). The desired behavior of the timer is as follows. You push BTN1 to write the 3 second interval to the timer. 3 seconds later, the timer should "go off" and LED1 should light. Pressing BTN2 should reset the timer (and turn off LED1) if the timer has gone off. Otherwise, it should do nothing. In other words, LED1 should light 3 seconds after the timer was reset regardless of how many times BTN2 was pressed in the meantime.
The clock the harness is connected to is the 32MHz system "ACE" clock. You will need to figure out to convert a number specified in ms (e.g., 3000) to clock ticks.
Important
You can use behavioral verilog and the Nbit_reg module provided to you.
Note
The LED outputs and the switches are both use "active low" signaling. That is, the LED turns on when its signal is a 0 and the LED is off when its signal is a 1. Similarly, The switches return a 1 when off and a 0 when on. This can be ultra-confusing until you get used to it. You'll need to take this into account when writing your Verilog.
When you've completed and tested your design, demo your design to one of the TAs. They will verify the design works correctly and ask you a few questions about the design. If you pass the demo, they will check you off.
Turn in the follow items in class: