Create Your Own Core

From ICE Enterprises
Jump to navigation Jump to search

This tutorial is intended to demonstrate how to create a complete ICE Core. Focus was placed on reducing the verbosity of this document; therefore, it contains only slightly more information than necessary. It should be noted that this is ONE way to create an ICE Core, it is not the only way.

What this Tutorial Creates

This tutorial builds an ICE Core that simply doubles an input file. It is meant to be purely instructional. When complete, you will have the following cores:

JDK - the java reference implementation 
CPU - the native C implementation
VHS - the verilator HDL simulator implementation

Other cores (that aren't included in this tutorial) are:

GPU - the GPU implementation
MLS - the MatLab Simulink implementation
ICE - the ICE FPGA implementation

Notes

Here is the key for the symbols and notations used throughout this document:

$   are commands typed at a Linux terminal
nM> are commands typed at a NeXtMidas prompt
++  are lines added to an existing file (do not include '++' characters in the file)
!   are comments

This example assumes that you have downloaded the following files (to a directory labeled 'Downloads' in your home folder):

  • id_tutorial_1_0_1.tgz
  • ice364-01.zip
  • ice364-soc.zip

Note: We recommend that you always use the latest releases of ICE Software. This tutorial will work with the newest versions.

Installing the ICE Option Tree

If you already have an ICE Option Tree properly configured on your system then you may skip this section.

$ cd ~/Downloads
$ mv ice364-01.zip /midas/opt/
$ cd /midas/opt
$ rm icexxx
$ unzip ice364-01.zip
$ ln -sf ice364-01 icexxx
$ cd
$ nedit .cshrc
++  setenv ICEROOT /midas/opt/icexxx
$ source .cshrc

Installing and Configuring the ICE SOC Content

$ cd ~/Downloads
$ mv ice364-soc.zip /midas/opt
$ cd /midas/opt
$ rm socxxx
$ unzip ice364-soc.zip
$ mv soc soc364
$ ln -sf soc364 socxxx
$ cd socxxx
$ nedit xilinx
! NOTE: go to 'if' block under the line 'set pe = BAD' (~line 170 in ice364-soc)
++ if ( $sig =~ ??id) set pe = ICEDOUBLE
$ cd sim
$ nedit mdefs.h
! NOTE: create an 'else if' case for our core before the `endif (~line 64 in ice364-soc)
++ `elsif PE_ICEDOUBLE
++   `define ENGINE idengine
$ nedit verilator.args
! NOTE: tell verilator where our core resides
++ -v ../lib/idengine.v
$ cd ../lib
$ ln -sf /midas/opt/nmopts/nxm/idtree/cores/idengine.v
$ cd
$ nedit .cshrc
! NOTE: if you're on a 32 bit machine then change JAVABITS from 64 to 32
++  setenv VERILATOR_ROOT /opt/verilator
++  setenv JAVABITS 64
++  alias xi '/midas/opt/socxxx/xilinx'
$ source .cshrc

Creating the Example Core

In our case, we are simply copying the files to the correct directories.

$ nms
$ nm
nM> option/create idtree /midas/opt/nmopts/nxm/idtree
nM> nmend
$ sudo mkdir -p /opt/projects/icedouble_tutorial
$ whoami
xmidas
$ sudo chown -R xmidas:users /opt/projects/icedouble_tutorial
$ cd ~/Downloads
$ cp id_tutorial_1_0_1.tgz /opt/projects/icedouble_tutorial
$ cd /opt/projects/icedouble_tutorial
$ tar -xvzf id_tutorial_1_0_1.tgz
$ mkdir /midas/opt/nmopts/nxm/idtree/lib
$ mkdir /midas/opt/nmopts/nxm/idtree/cores
$ cd
$ mv nmstartup.mm nmstartup.backup
$ cp /opt/projects/icedouble_tutorial/nmstartup.mm .
$ cp /opt/projects/icedouble_tutorial/icedouble.java /midas/opt/nmopts/nxm/idtree/prim
$ cp /opt/projects/icedouble_tutorial/ICEDOUBLE.java /midas/opt/nmopts/nxm/idtree/lib
$ cp /opt/projects/icedouble_tutorial/ICEDOUBLE.c /midas/opt/nmopts/nxm/idtree/lib
$ cp /opt/projects/icedouble_tutorial/testicedouble.mm /midas/opt/nmopts/nxm/idtree/mcr
$ cp /opt/projects/icedouble_tutorial/testicedouble.mmp /midas/opt/nmopts/nxm/idtree/mcr
$ cp /opt/projects/icedouble_tutorial/idengine.v /midas/opt/nmopts/nxm/idtree/cores
$ cd /midas/opt/nmopts/nxm/idtree/inc
$ ln -sf /midas/opt/icexxx/inc/CoreDefs.h
$ ln -sf /midas/opt/icexxx/inc/CoreProtos.h
$ ln -sf /midas/opt/icexxx/inc/icecores.h
$ ln -sf /midas/opt/icexxx/inc/VCore.h
$ nms
$ nm

Defining and Compiling the Core

nM> update icedouble
Option tree (USER, SITE, UCL, etc): [IDTREE] -> idtree
ICEDOUBLE Abbreviation: [ICEDOUBLE] ->
Support (Any of: IPMHDOU) [M] -> p
Number of arguments [0] -> 2
Default (TAG=value or - to remove) 1 [] -> in=
Default (TAG=value or - to remove) 2 [] -> out=
22S: OPT.PATH        = IDTREE,ICE,DSP,HWC,SYS
nM> update testicedouble
Option tree (USER, SITE, UCL, etc): [IDTREE] -> idtree
TESTICEDOUBLE Abbreviation: [TESTICEDOUBLE] ->
Support (Any of: IPMHDOU) [M] ->
Number of arguments [0] ->
22S: OPT.PATH        = IDTREE,ICE,DSP,HWC,SYS
nM> xi make sim ssid ICEDOUBLE
nm> nmd lib idtree
nM> ln -sf /midas/opt/icexxx/lib/libICEDOUBLE\$VHS_lin64.so
nM> make all ice
nM> make all idtree
nM> exit
$ nm

Running the Example

nM> testicedouble