Silicon Chip – April 2019

(Ben Green) #1

36 Silicon chip Australia’s electronics magazine siliconchip.com.au


can even be exported and used in an-
other project.
You can build just about any set of
logic using Verilog, including adders,
accumulators, multipliers, dividers,
multiplexers, memories, register files
and so on.
The various gates and other blocks
can be joined by wires. To create a
wire, move the mouse to an output pin
of a block until the pointer becomes a
black cross. Click, and drag the wire to
the input of another block and release.
We found the wires to be one of the
fiddliest parts of IceStudio. They can
only be dragged from output to input,
and often end up in awkward places.
They can be dragged to neaten the lay-
out or removed by hovering over the
wire, and then finding the small red
‘x’ and clicking on it.
The software has all the usual edit-
ing facilities such as copy, paste and
undo, and they all work rather well
once you get used to it. You can press
and hold the right mouse button to
pan around the window, and the scroll
wheel on the mouse allows zooming
in and out.
A full user guide is available on-
line at: https://icestudio.readthedocs.
io/en/latest/
Note that if you have used IceStudio
to enable its driver, you will need to
disable it to allow the Diamond Pro-
grammer to use its driver. The Tools →
Drivers → Disable menu is a bit cryp-
tic about this.
What you need to do is open De-
vice Manager, find the libusbK driver
entry, right click on it and uninstall it
(Screen3). Then unplug and replug the
iCEstick, and Windows will reinstall
the default drivers.
This isn’t necessary on macOS or


Linux, as the same drivers are used
for both software packages.

iCEcube2
iCEcube2 is proprietary software,
and while you can freely download
it and install it, a license key is need-
ed to run it. This is all available at no
cost, but you will need to create an ac-
count on the Lattice website to receive
a license key.
We found the process of setting up
an account and requesting a key a bit
slow, but it worked, and we got our
key in the end.
The key is tied to a specific Ethernet
MAC address, meaning you will need
multiple licenses if you want to run the
software on multiple computers. The
iCEcube2 version we downloaded was
around 750MB, and a separate down-
load of the “Diamond” programmer
application is needed too.
There are versions of iCEcube2 avail-
able for Windows and Linux, down-

loadable from: http://siliconchip.com.
au/link/aant
The separate programmer software
can be found at: http://siliconchip.com.
au/link/aanu
Ensure that you have the license file
for iCEcube2. There is a link on the
information page for iCEcube2 detail-
ing how to receive the license file via
email. Although the email notes that
the license file should be placed in the
\license directory of our install, there
did not appear to be such a directory.
Our install of iCEcube2 has the
path C:\lscc\iCEcube2.2017.08, so we
placed a copy of the license in both the
lscc and iCEcube2.2017.08 directories,
and everything seemed to work, al-
though it did sometimes complain that
the license file was missing.
We struggled to find simple exam-
ples that would work for the iCEstick
under iCEcube2, and certainly didn’t
find any on Lattice’s website. In the
end, we found a basic ‘blink’ example
at siliconchip.com.au/link/aanv, but
even this missed one or two steps, so
we had to modify it.
ICEcube2 uses VHDL, so if you pre-
fer VHDL over Verilog, this may be an
option, although VHDL is generally
stricter and more verbose than Verilog
(Editor’s note: in my opinion, Verilog
is superior, although they both have
roughly the same capabilities).
To use iCEcube2, first create a new
project, and fill in the details as shown
in the screen grab (Screen4), to match
the hardware of the iCEstick. Click OK,
and the ‘add files’ dialog box opens;
click “Finish”, as files can be added
from within the project.
You can download the “BLINK.

Screen5:
the iCEcube
window after
our project
has been
converted into
a bitstream.
Despite all
the red text,
everything
completed
without errors.
The Pin
Constraints
Editor is the
icon below
the left of the
Window menu.


Screen6: the Diamond Programmer window. Check the Device, Device family
and Cable settings to ensure they are correct. The Device Properties icon is
immediately below the Help menu item, while the Program button is the one
with the large green arrow.
Free download pdf