DIY-Calculator Hardware:FPGA Project

From DIY-Calculator_Hardware

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:16, 14 October 2006
Hzulu (Talk | contribs)

← Previous diff
Revision as of 15:25, 14 October 2006
Hzulu (Talk | contribs)

Next diff →
Line 5: Line 5:
Additionally to the CPU and ROM and RAM there will be special logic for the switch matrix, for LCD output, and a UART for RS-232 communication to the host PC. Additionally to the CPU and ROM and RAM there will be special logic for the switch matrix, for LCD output, and a UART for RS-232 communication to the host PC.
 +----
-'''Project status''' (19.Jul.2006): concept proved, integration of the existing VHDL design (was done with Altera/Quartus) into ispLEVER+<div style="border:0; margin: 20px 20% 0px 0px;">
-'''Project status''' (7.Aug.2006): Simulation of the existing CPU design revealed big troubles. A new design of the CPU is being made.+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
 +<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(9.Oct.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +[[Image:SPI_ctrl-state-diagram.jpg|thumb|left| SPI controller]]
 +Added a controller module for SPI flash ROM (FPGA configuration ROM) access (see controller state diagram)
 +<br style="clear:left;" />
 +[[Image:read-signature.jpg|thumb|left| read flash signature]]
 +Here is the logic analyzer recording of the "Read Signature" command (with corresponding terminal log).
-'''Project status''' (31.Aug.2006): new CPU design is '''ready!''' (simulated and tested in a Lattice FPGA development board.)+At cursor 'A' the command ($AB) is issued to the flash controller, afterwards the command plus 3 dummy bytes (as per flash data sheet) are transmitted to the flash via the SPI interface. During this time the CPU waits for the response. At cursor 'B' the CPU detects that a new data byte from the flash is ready (reading $06 from the status port). At cursor 'C' the response is read ($13 for the used M25P80 chip).
-[[Image:CPU_under_test.JPG|thumb|left|CPU under test...]]+<br style="clear:left;" />
-Download the VHDL code from here: [[DIY-Calculator_Hardware:Downloads]]+[[Image:info-cmd.jpg|thumb|left| info command]]
- +
-Next steps are design/integration of:+
-* LCD controller+
-* UART+
-* Keypad controller+
- +
- +
-* stay tuned!+
<br style="clear:left;" /> <br style="clear:left;" />
 +</div>
 +</div>
-'''Project status''' (4.Sep.2006): LCD controller works with CPU! See logic analyzer screenshot: [[Image:LCD-access.jpg|thumb|left| "Hello World" program accessing LCD]]+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
 +<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(11.Sep.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +Keypad controller implemented. During work on the ROM monitor it was necessary to complete the DIY Calculator with the keypad. While the real PCB being still not available the Lattice development board features 12 buttons organized in a 3 by 4 column / row fashion. The keypad controller is currently designed with this configuration but behaves at the DIY Calculator side exactly like the virtual version does and the real version will. See modelsim screenshot:
-Notice that there are two access cycles to the LCD module with each character, one which actually writes the character and a second one which shifts the display left, resembling the display behaviour of desktop calculators.+[[Image:keypad.jpg|thumb|left| keypad controller]]
 +Two key presses are simulated: first key '5' and then key '9'. See the scan rows changing (e.g. row1, row1_last) detecting changes and generating the 'key_set' signal which latches the respective key code. This in turn causes the KEYPAD input port to change from $FF to the key code ('d_out' signal). When the CPU reads from KEYPAD (short pulse on 'sel' line) a pulse on 'beep' signal is generated and the KEYPAD port value is reset to $FF.
-Also note that during LCD accesses the CPU is effectively halted by the nWAIT signal which is generated by the LCD controller. Between LCD accesses there is activity on the CPU data and address bus, which indicates the loading of the next character, etc. View the "Hello World" program here: [[:Media:hello-tasm.lst|hello-tasm.lst]]+Note (with the first key press) the '5'-key is still depressed when the CPU reads the KEYPAD but no additional key events are generated. In the second case ('9'-key) the key is released before the CPU reads KEYPAD.
<br style="clear:left;" /> <br style="clear:left;" />
 +</div>
 +</div>
-'''Project status''' (6.Sep.2006): UART is working! See logic analyzer screenshots: [[Image:UART-tx.jpg|thumb|left| UART transmit character]]+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
- +<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(6.Sep.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +UART is working! See logic analyzer screenshots: [[Image:UART-tx.jpg|thumb|left| UART transmit character]]
Note the "tx_empty" signal which denotes an empty transmitter register. During the shifting-out of the character tx_empty goes low thereby indicating that the CPU must not write a next character. The CPU is busy during this phase with polling the UART status register waiting for tx_empty going high again. tx_empty may trigger an interrupt request, if enabled by software. Note the "tx_empty" signal which denotes an empty transmitter register. During the shifting-out of the character tx_empty goes low thereby indicating that the CPU must not write a next character. The CPU is busy during this phase with polling the UART status register waiting for tx_empty going high again. tx_empty may trigger an interrupt request, if enabled by software.
Line 37: Line 53:
<br style="clear:left;" /> <br style="clear:left;" />
[[Image:UART-rx.jpg|thumb|left| UART receive character]] [[Image:UART-rx.jpg|thumb|left| UART receive character]]
- 
Here the "rx_ready" is signal used for CPU handshake. When a character ('U' / $55 in the picture) is received rx_ready becomes high thus indicating to the CPU that a character is available n the UART for reading. When the CPU reads the character rx_ready goes low again. In the screen shot the CPU writes then the character to the LCD, which is easy recognizable as the CPU is halted during LCD access by means of the "nWAIT" signal. View the program listing here: [[:Media:uart-test.lst|uart-test.lst]] Here the "rx_ready" is signal used for CPU handshake. When a character ('U' / $55 in the picture) is received rx_ready becomes high thus indicating to the CPU that a character is available n the UART for reading. When the CPU reads the character rx_ready goes low again. In the screen shot the CPU writes then the character to the LCD, which is easy recognizable as the CPU is halted during LCD access by means of the "nWAIT" signal. View the program listing here: [[:Media:uart-test.lst|uart-test.lst]]
Line 43: Line 58:
<br style="clear:left;" /> <br style="clear:left;" />
Here is a screen shot of a terminal session and a photo of the test board: [[Image:terminal-screen.jpg|thumb|left|Terminal screen]] Here is a screen shot of a terminal session and a photo of the test board: [[Image:terminal-screen.jpg|thumb|left|Terminal screen]]
- 
[[Image:hello-world-on-LCD.jpg|thumb|left|"Hello World!" on LCD]] [[Image:hello-world-on-LCD.jpg|thumb|left|"Hello World!" on LCD]]
<br style="clear:left;" /> <br style="clear:left;" />
 +</div>
 +</div>
-'''Project status''' (11.Sep.2006): Keypad controller implemented. During work on the ROM monitor it was necessary to complete the DIY Calculator with the keypad. While the real PCB being still not available the Lattice development board features 12 buttons organized in a 3 by 4 column / row fashion. The keypad controller is currently designed with this configuration but behaves at the DIY Calculator side exactly like the virtual version does and the real version will. See modelsim screenshot: [[Image:keypad.jpg|thumb|left| keypad controller]]+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
 +<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(4.Sep.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +LCD controller works with CPU! See logic analyzer screenshot: [[Image:LCD-access.jpg|thumb|left| "Hello World" program accessing LCD]]
 +Notice that there are two access cycles to the LCD module with each character, one which actually writes the character and a second one which shifts the display left, resembling the display behaviour of desktop calculators.
 +Also note that during LCD accesses the CPU is effectively halted by the nWAIT signal which is generated by the LCD controller. Between LCD accesses there is activity on the CPU data and address bus, which indicates the loading of the next character, etc.
-Two key presses are simulated: first key '5' and then key '9'. See the scan rows changing (e.g. row1, row1_last) detecting changes and generating the 'key_set' signal which latches the respective key code. This in turn causes the KEYPAD input port to change from $FF to the key code ('d_out' signal). When the CPU reads from KEYPAD (short pulse on 'sel' line) a pulse on 'beep' signal is generated and the KEYPAD port value is reset to $FF. Note the (with the first key press) the '5'-key is still depressed when the CPU reads the KEYPAD but no additional key events are generated. In the second case ('9'-key) the key is released before the CPU reads KEYPAD.+View the "Hello World" program here: [[:Media:hello-tasm.lst|hello-tasm.lst]]
<br style="clear:left;" /> <br style="clear:left;" />
 +</div>
 +</div>
-'''Project status''' (9.Oct.2006): Added a controller module for SPI flash ROM (FPGA configuration ROM) access (see controller state diagram):+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
-[[Image:SPI_ctrl-state-diagram.jpg|thumb|left| SPI controller]]+<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(31.Aug.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +new CPU design is '''ready!''' (simulated and tested in a Lattice FPGA development board.)
 +[[Image:CPU_under_test.JPG|thumb|left|CPU under test...]]
 + 
 +Download the VHDL code from here: [[DIY-Calculator_Hardware:Downloads|Downloads]]
 + 
 +Next steps are design/integration of:
 +* LCD controller
 +* UART
 +* Keypad controller
 + 
 +* stay tuned!
<br style="clear:left;" /> <br style="clear:left;" />
 +</div>
 +</div>
-Here is the logic analyzer recording of the "Read Signature" command (with corresponding terminal log): [[Image:read-signature.jpg|thumb|left| read flash signature]] [[Image:info-cmd.jpg|thumb|left| info command]]+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
 +<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(7.Aug.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +Simulation of the existing CPU design revealed big troubles. A new design of the CPU is being made.
 +</div>
 +</div>
-At cursor 'A' the command ($AB) is issued to the flash controller, afterwards the command plus 3 dummy bytes (as per flash data sheet) are transmitted to the flash via the SPI interface. During this time the CPU waits for the response. At cursor 'B' the CPU detects that a new data byte from the flash is ready (reading $06 from the status port). At cursor 'C' the response is read ($13 for the used M25P80 chip).+<div style="background:#f9f9f9; padding:0; border:1px solid #aaaaaa; margin-bottom:15px;">
-<br style="clear:left;" />+<div style="background:#eeeeee; padding:0 0.4em 0 0.4em; border-bottom:1px solid #aaaaaa;">
 +'''Project status'''&nbsp;(19.Jul.2006):
 +</div>
 +<div style="padding:0.2em 0.4em 0.2em 0.4em;">
 +concept proved, integration of the existing VHDL design (was done with Altera/Quartus) into ispLEVER
 +</div>
 +</div>
 + 
 +</div>

Revision as of 15:25, 14 October 2006

The PCB will contain an FPGA chip in the 10K-gates size-class (Lattice LFEC10E-3F256C) with a 256 pin BGA footprint. The included JTAG connector makes this a development board for general use. With ispLEVER, the FPGA development software suite from Lattice Semiconductor, the FPGA design can be altered or a completely new design can be made. The entry level version of ispLEVER (ispLEVER-Starter) can be downloaded freely from Lattice. With Lattice's ispVM System the design can be transferred via JTAG to the DIY Calculator PCB.

The FPGA design of the DIY Calculator is based on the work of Steven Cooper, Carl Hoggins, Bjornar Prestegard, Svein Roar Kvaale, and Dr Albert Koelmans (instructor) of the University of Newcastle Upon Tyne, England.

Additionally to the CPU and ROM and RAM there will be special logic for the switch matrix, for LCD output, and a UART for RS-232 communication to the host PC.


Project status (9.Oct.2006):

 SPI controller
Enlarge
SPI controller

Added a controller module for SPI flash ROM (FPGA configuration ROM) access (see controller state diagram)

 read flash signature
Enlarge
read flash signature

Here is the logic analyzer recording of the "Read Signature" command (with corresponding terminal log).

At cursor 'A' the command ($AB) is issued to the flash controller, afterwards the command plus 3 dummy bytes (as per flash data sheet) are transmitted to the flash via the SPI interface. During this time the CPU waits for the response. At cursor 'B' the CPU detects that a new data byte from the flash is ready (reading $06 from the status port). At cursor 'C' the response is read ($13 for the used M25P80 chip).

 info command
Enlarge
info command


Project status (11.Sep.2006):

Keypad controller implemented. During work on the ROM monitor it was necessary to complete the DIY Calculator with the keypad. While the real PCB being still not available the Lattice development board features 12 buttons organized in a 3 by 4 column / row fashion. The keypad controller is currently designed with this configuration but behaves at the DIY Calculator side exactly like the virtual version does and the real version will. See modelsim screenshot:

 keypad controller
Enlarge
keypad controller

Two key presses are simulated: first key '5' and then key '9'. See the scan rows changing (e.g. row1, row1_last) detecting changes and generating the 'key_set' signal which latches the respective key code. This in turn causes the KEYPAD input port to change from $FF to the key code ('d_out' signal). When the CPU reads from KEYPAD (short pulse on 'sel' line) a pulse on 'beep' signal is generated and the KEYPAD port value is reset to $FF.

Note (with the first key press) the '5'-key is still depressed when the CPU reads the KEYPAD but no additional key events are generated. In the second case ('9'-key) the key is released before the CPU reads KEYPAD.

Project status (6.Sep.2006):

UART is working! See logic analyzer screenshots:
 UART transmit character
Enlarge
UART transmit character

Note the "tx_empty" signal which denotes an empty transmitter register. During the shifting-out of the character tx_empty goes low thereby indicating that the CPU must not write a next character. The CPU is busy during this phase with polling the UART status register waiting for tx_empty going high again. tx_empty may trigger an interrupt request, if enabled by software.

Line speed is 38.4 kbaud.

 UART receive character
Enlarge
UART receive character

Here the "rx_ready" is signal used for CPU handshake. When a character ('U' / $55 in the picture) is received rx_ready becomes high thus indicating to the CPU that a character is available n the UART for reading. When the CPU reads the character rx_ready goes low again. In the screen shot the CPU writes then the character to the LCD, which is easy recognizable as the CPU is halted during LCD access by means of the "nWAIT" signal. View the program listing here: uart-test.lst

Line speed is (as with transmit) 38.4 kbaud.

Here is a screen shot of a terminal session and a photo of the test board:
Terminal screen
Enlarge
Terminal screen
"Hello World!" on LCD
Enlarge
"Hello World!" on LCD


Project status (4.Sep.2006):

LCD controller works with CPU! See logic analyzer screenshot:
 "Hello World" program accessing LCD
Enlarge
"Hello World" program accessing LCD

Notice that there are two access cycles to the LCD module with each character, one which actually writes the character and a second one which shifts the display left, resembling the display behaviour of desktop calculators. Also note that during LCD accesses the CPU is effectively halted by the nWAIT signal which is generated by the LCD controller. Between LCD accesses there is activity on the CPU data and address bus, which indicates the loading of the next character, etc.

View the "Hello World" program here: hello-tasm.lst

Project status (31.Aug.2006):

new CPU design is ready! (simulated and tested in a Lattice FPGA development board.)

CPU under test...
Enlarge
CPU under test...

Download the VHDL code from here: Downloads

Next steps are design/integration of:

  • LCD controller
  • UART
  • Keypad controller
  • stay tuned!


Project status (7.Aug.2006):

Simulation of the existing CPU design revealed big troubles. A new design of the CPU is being made.

Project status (19.Jul.2006):

concept proved, integration of the existing VHDL design (was done with Altera/Quartus) into ispLEVER

Personal tools