Silicon Chip – April 2019

(Ben Green) #1

siliconchip.com.au Australia’s electronics magazine April 2019 63


ROM decodes the horizontal character
sub-position into a single bit; it is ef-
fectively an eight-to-one multiplexer.
The output of the font ROM is a single
bit indicating whether the foreground
or background should be displayed for
the current pixel.


Colour


In a similar fashion to the way the
video RAM is read, data is read from
the colour RAM to determine the
combination of foreground and back-
ground colours to be displayed at the
current scan position. This is a sepa-
rate RAM block that uses the same ad-
dress and clock lines as video RAM
as its input. The output of the colour
RAM is fed to the colour decoder.
The colour decoder has a pair of
small 6x16 bit ROMs, which are initial-
ised by the beige blocks above them.
These decode the 4-bit colour palette
index value into the necessary output
pin states to generate that specific col-
our in the palette. The two blocks are
identical; one is used to decode the
foreground colour and one the back-
ground colour, to simplify the follow-
ing logic.
The colours have been chosen based
on those used in the venerable Com-


modore 64, which also had a 16-col-
our display.
To the right of the ROMs are a row
of multiplexers, one for each output
pin involved in driving the VGA col-
our lines. The multiplexer chooses be-
tween the foreground and background
colours according to the line from the
font ROM.
This is followed by an AND gate.
The data from the multiplexer is
ANDed with a bit that indicates if the
current scan position is inside the
central 512x384 pixel box, in which
case the foreground or background
colour is produced. Otherwise, the
result is low, so the outputs of all the
AND gates are low and therefore all
the output pins are low and black is
displayed.
Finally, a D-flipflop is used to buff-
er this signal into the output pins, so
that their states only change on the
pixel clock. This ensures our pixels
are not subject to jitter and thus line
up squarely on the screen. The result
is a very stable display.

Installing the software on
your computer
To build this project, you need to
install the IceStudio integrated devel-

opment environment (IDE) software.
There are versions available for Linux,
Windows and macOS. If you’ve been
reading our FPGA tutorial, starting
on page 32, you may have already in-
stalled it. Otherwise, follow the instal-
lation instructions at: https://github.
com/FPGAwars/icestudio
We used version 0.4.0. Once in-
stalled, you should also install the
toolchain and enable the driver for the
iCEstick (only needed on Windows).
If you’re unsure how to do this, read
the aforementioned tutorial, which ex-
plains this in detail, or read the IceS-
tudio documentation at: https://icestu-
dio.readthedocs.io/en/latest/
Now download the “iCEstick VGA
Terminal.ice” file from our website
and open it in IceStudio. You will see
something similar to what’s shown in
Screen1 above, and you can now ex-
amine the blocks in closer detail.
If you need to change any of the
configuration parameters, such as the
serial port baud rate, these are ‘hard
coded’ into the project, so you will
need to change the .ice file using the
IDE graphical interface.
Other settings that can be changed
include the colour palette and font
glyphs. Details on how to change all
these parameters are given below.
By default, the serial interface is
connected to iCEstick’s USB/serial
converter IC, but this could be rema-
pped to an external I/O pin for inter-
facing with a microcontroller such as
an Arduino board or MicroMite.

Construction
As you can see from the PCB over-
lay diagram, Fig.2, there are few com-
ponents on the board so it shouldn’t
take long to build.
The board is coded 02103191 and
measures 49.5 x 32mm.
Start by fitting the two 68resistors;
these are closest to CON2. Bend the
legs at right angles, put through the
holes and splay the legs to hold in
place. Solder and trim the leads just
above the solder fillet on the reverse
of the board. Fit the 560Ω and 1.1kΩ
resistors using a similar procedure.
Now mount the VGA socket next,
ensuring it is properly seated and
flush with the PCB. Solder the larger
mechanical pins, turning up your sol-
dering iron temperature if necessary.
Carefully solder the fine pins of
the signal lines to avoid bridging ad-
jacent pins.

Screen6: these
are the colour
combinations that
can be displayed
by the iCEstick
VGA Terminal.
The characters
shown at each
column are
combined with
the Control key
to create the
foreground colour
shown in many
serial terminal
programs. These
16 colours are
selected from a
set of 64 possible
colours; you can
modify the ROM
values in the
IceStudio project
to choose different
ones.
Free download pdf