![]() |
Computer Laboratory ECAD and Architecture Practical Classes |
Computer Laboratory > Teaching > Course material 2008–09 > ECAD Labs > ECAD Lab 2 - Game of Life > Painting cells
The next task is to make use of the mouse, so that when you click on a square the state changes from dead to alive, or vice-versa. This will be accomplished using assembler which will run on the MIPS processor, so you'll be pleased to know that there shouldn't be any need to re-compile the Verilog files, which takes a while.
SOPC component addressesThe SOPC component module mentioned on the previous page contains modules that the 7-segment displays and LEDs have been wired into. These have been mapped to addresses as follows:
Important: currently, if you perform 2 consecutive loads from this module, the first value returned is always zero. To fix this, place a nop in-between the load instructions.
The codeYou should now be ready to write the code that will change a cell when it is clicked on. Open up the assembly file life.S from the toolset directory, and insert your code where marked in order to perform the required task. There should be a main loop that iterates over and over checking the current value for the mouse-click, and when this changes, you should jump to a function that actually performs the change. You may find the MIPS page useful. The grid state is stored in the Dual-Ported RAM. The MIPS sees this starting at address |