18.12.2012 Views

Creating Components in LatticeMico32 System (v6.1SP1)

Creating Components in LatticeMico32 System (v6.1SP1)

Creating Components in LatticeMico32 System (v6.1SP1)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong><br />

<strong>LatticeMico32</strong> <strong>System</strong><br />

Lattice Semiconductor Corporation<br />

5555 NE Moore Court<br />

Hillsboro, OR 97124<br />

(503) 268-8000<br />

November 15, 2006


Copyright<br />

Copyright © 2006 Lattice Semiconductor Corporation.<br />

This document may not, <strong>in</strong> whole or part, be copied, photocopied,<br />

reproduced, translated, or reduced to any electronic medium or mach<strong>in</strong>ereadable<br />

form without prior written consent from Lattice Semiconductor<br />

Corporation.<br />

Trademarks<br />

Lattice Semiconductor Corporation, L Lattice Semiconductor Corporation<br />

(logo), L (stylized), L (design), Lattice (design), LSC, E 2 CMOS, Extreme<br />

Performance, FlexiMAC, FlexiPCS, GAL, GDX, Generic Array Logic, HDL<br />

Explorer, IPexpress, ISP, ispATE, ispCLOCK, ispDOWNLOAD, ispGAL,<br />

ispGDS, ispGDX, ispGDXV, ispGDX2, ispGENERATOR, ispJTAG, ispLEVER,<br />

ispLEVERCORE, ispLSI, ispMACH, ispPAC, ispTRACY, ispTURBO,<br />

ispVIRTUAL MACHINE, ispVM, ispXP, ispXPGA, ispXPLD, LatticeEC,<br />

LatticeECP2, LatticeECP2M, LatticeECP, LatticeECP-DSP, LatticeMico8,<br />

<strong>LatticeMico32</strong>, LatticeSC, LatticeXP, MACH, MachXO, MACO, ORCA, PAC,<br />

PAC-Designer, PAL, Performance Analyst, PureSPEED, Silicon Forest,<br />

Speedlocked, Speed Lock<strong>in</strong>g, SuperBIG, SuperCOOL, SuperFAST,<br />

SuperWIDE, sysCLOCK, sysCONFIG, sysDSP, sysHSI, sysI/O, sysMEM, The<br />

Simple Mach<strong>in</strong>e for Complex Design, TransFR, UltraMOS, and specific<br />

product designations are either registered trademarks or trademarks of<br />

Lattice Semiconductor Corporation or its subsidiaries <strong>in</strong> the United States<br />

and/or other countries. ISP and Br<strong>in</strong>g<strong>in</strong>g the Best Together are service marks<br />

of Lattice Semiconductor Corporation.<br />

Other product names used <strong>in</strong> this publication are for identification purposes<br />

only and may be trademarks of their respective companies.<br />

Disclaimers<br />

NO WARRANTIES: THE INFORMATION PROVIDED IN THIS DOCUMENT<br />

IS “AS IS” WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY<br />

KIND INCLUDING WARRANTIES OF ACCURACY, COMPLETENESS,<br />

MERCHANTABILITY, NONINFRINGEMENT OF INTELLECTUAL<br />

PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO<br />

EVENT WILL LATTICE SEMICONDUCTOR CORPORATION (LSC) OR ITS<br />

SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER (WHETHER<br />

DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL,<br />

INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS,<br />

BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT<br />

OF THE USE OF OR INABILITY TO USE THE INFORMATION PROVIDED<br />

ON THIS SITE, EVEN IF LSC HAS BEEN ADVISED OF THE POSSIBILITY<br />

OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE<br />

EXCLUSION OR LIMITATION OF CERTAIN LIABILITY, SOME OF THE<br />

ABOVE LIMITATIONS MAY NOT APPLY TO YOU.<br />

LSC may make changes to these materials, specifications, or <strong>in</strong>formation, or<br />

to the products described here<strong>in</strong>, at any time without notice. LSC makes no<br />

commitment to update this documentation. LSC reserves the right to<br />

discont<strong>in</strong>ue any product or service without notice and assumes no obligation<br />

to correct any errors conta<strong>in</strong>ed here<strong>in</strong> or to advise any user of this document<br />

of any correction if such be made. LSC recommends its customers obta<strong>in</strong> the<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> ii


latest version of the relevant <strong>in</strong>formation to establish, before order<strong>in</strong>g, that the<br />

<strong>in</strong>formation be<strong>in</strong>g relied upon is current.<br />

Type Conventions Used <strong>in</strong> This Document<br />

Convention Mean<strong>in</strong>g or Use<br />

Bold Items <strong>in</strong> the user <strong>in</strong>terface that you select or click. Text that you type<br />

<strong>in</strong>to the user <strong>in</strong>terface.<br />

Variables <strong>in</strong> commands, code syntax, and path names.<br />

Ctrl+L Press the two keys at the same time.<br />

Courier Code examples. Messages, reports, and prompts from the software.<br />

... Omitted material <strong>in</strong> a l<strong>in</strong>e of code.<br />

.<br />

.<br />

.<br />

Omitted l<strong>in</strong>es <strong>in</strong> code and report examples.<br />

[ ] Optional items <strong>in</strong> syntax descriptions. In bus specifications, the<br />

brackets are required.<br />

( ) Grouped items <strong>in</strong> syntax descriptions.<br />

{ } Repeatable items <strong>in</strong> syntax descriptions.<br />

| A choice between items <strong>in</strong> syntax descriptions.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> iii


<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> iv


Contents<br />

<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 1<br />

Design Flow 1<br />

Create New Custom Component Flow 1<br />

Edit Exist<strong>in</strong>g Custom Component Flow 2<br />

Build<strong>in</strong>g and Add<strong>in</strong>g Your Component to MSB 3<br />

MSB <strong>Components</strong> 3<br />

Typical Component Folder and File Structure 4<br />

Import/Create Component Graphical Interface 5<br />

Component Tab 7<br />

Master/Slave Ports Tab 9<br />

External Ports Tab 13<br />

RTL Files Tab 15<br />

<strong>Creat<strong>in</strong>g</strong> Verilog RTL Files 17<br />

Parameters Tab 19<br />

Software Tab 21<br />

Software Files Tab 24<br />

References 25<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> v


Contents<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> vi


Design Flow<br />

<strong>Creat<strong>in</strong>g</strong> a Custom<br />

Component <strong>in</strong><br />

<strong>LatticeMico32</strong> <strong>System</strong><br />

1<br />

This document shows you how to create a custom component for <strong>in</strong>sertion<br />

<strong>in</strong>to a <strong>LatticeMico32</strong> <strong>System</strong> software Mico <strong>System</strong> Builder (MSB) platform<br />

us<strong>in</strong>g the Import/Create Custom Component dialog box.<br />

It is assumed that you already have the Verilog source code for the<br />

component that you wish to add. (Refer to the “WISHBONE Interconnect<br />

Architecture” chapter of the <strong>LatticeMico32</strong> Software Developer User’s Guide.)<br />

There are two design flows available with the MSB Import/Create Custom<br />

Component dialog box:<br />

� Create new custom component flow<br />

� Edit exist<strong>in</strong>g custom component flow<br />

Create New Custom Component Flow<br />

The follow<strong>in</strong>g is the design flow for creat<strong>in</strong>g new custom components:<br />

1. In the <strong>LatticeMico32</strong> <strong>System</strong> MSB perspective, open the “Import/Create<br />

New Component" dialog box.<br />

2. In the Component Tab, select the Create New Component option.<br />

3. In the Component Tab, enter the new component name and new<br />

component folder path.<br />

4. In the Master/Slave Ports tab, specify ports<br />

5. In the External Ports tab, specify external def<strong>in</strong>itions.<br />

6. In the RTL tab, import generated RTL files.<br />

7. In the Parameters Tab, specify parameters and GUI widgets.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 1


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Design Flow<br />

8. In the Software tab, enter DDStruct and DDInit <strong>in</strong>formation.<br />

9. In the Software Files tab, import software files.<br />

10. Click OK. The software:<br />

� Creates the component folder structure (refer to Figure 3 on page 4).<br />

� Creates the component description file (.xml) and<br />

adds it to the correct folder.<br />

� Adds Verilog wrapper file (.v) to <strong>in</strong>stantiate the<br />

top level of the design.<br />

� Copies the component RTL <strong>in</strong>to the rtl/verilog folder, as shown <strong>in</strong><br />

Figure 3 on page 4.<br />

� Creates a makefile (peripheral.mk). The makefile directs the C/C++<br />

SPE to C/assembly source files conta<strong>in</strong><strong>in</strong>g user def<strong>in</strong>ed APIs. An<br />

example of a makefile file is shown <strong>in</strong> Figure 1.<br />

Figure 1: Example of makefile<br />

#---------------------------------------------------------<br />

# Identify source-paths for this device's driver-sources,<br />

# compiled when build<strong>in</strong>g the library<br />

#---------------------------------------------------------<br />

LIBRARY_C_SRCS+= OpenCoresI2CMaster.c\<br />

OpenCoresI2CMasterService.c<br />

LIBRARY_ASM_SRCS +=<br />

Edit Exist<strong>in</strong>g Custom Component Flow<br />

The follow<strong>in</strong>g is the design flow for edit<strong>in</strong>g exist<strong>in</strong>g components:<br />

1. In the <strong>LatticeMico32</strong> <strong>System</strong> MSB perspective, open the “Import/Create<br />

New Component" dialog box.<br />

2. In the Component Tab, select the Open Component XML option.<br />

3. In the Component Tab, enter the component description file<br />

(.xml) name. The software log reads the component<br />

XML data, gets the RTL file names and gets the software file names.<br />

4. In the Component Tab, edit general requirements, such as component<br />

name.<br />

5. In the Master/Slave Ports tab, edit, add or delete Master/Slave ports<br />

6. In the External Ports tab, edit, add or delete external def<strong>in</strong>itions.<br />

7. In the RTL tab, delete the current RTL files or import different RTL files.<br />

8. In the Parameters Tab, edit, add or delete parameters and GUI widget.<br />

9. In the Software tab, edit, add or delete DDStruct and DDInit <strong>in</strong>formation.<br />

10. In the Software Files tab, delete current software files or import different<br />

software files.<br />

11. Click OK. The software regenerates the component folder structure, adds/<br />

removes files to/from the correct folders, recreates the wrapper files, and<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 2


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Build<strong>in</strong>g and Add<strong>in</strong>g Your Component to MSB<br />

recreates the component description file (.xml). The<br />

wrapper file to the top-level module will also be recreated with the edited<br />

<strong>in</strong>formation. Any data edited or added <strong>in</strong>dependent of the Import/Create<br />

Custom <strong>Components</strong> graphical user <strong>in</strong>terface (GUI) will be lost.<br />

Build<strong>in</strong>g and Add<strong>in</strong>g Your Component to MSB<br />

To build a custom component, you should run the <strong>LatticeMico32</strong> <strong>System</strong><br />

software and be <strong>in</strong> the MSB perspective. Refer to the <strong>LatticeMico32</strong><br />

Development Tools Installation Guide for <strong>in</strong>structions on <strong>in</strong>stall<strong>in</strong>g and start<strong>in</strong>g<br />

the <strong>LatticeMico32</strong> <strong>System</strong> software.<br />

MSB <strong>Components</strong><br />

The available <strong>LatticeMico32</strong> components are listed <strong>in</strong> the Available<br />

<strong>Components</strong> view <strong>in</strong> MSB, as shown <strong>in</strong> Figure 2.<br />

Figure 2: Available <strong>Components</strong> View <strong>in</strong> MSB<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 3


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Build<strong>in</strong>g and Add<strong>in</strong>g Your Component to MSB<br />

Typical Component Folder and File Structure<br />

Figure 3 shows a typical folder and file structure for a <strong>LatticeMico32</strong><br />

component.<br />

Figure 3: Typical Component Folder and File Structure<br />

<br />

.xml<br />

document<br />

drivers<br />

rtl<br />

.htm<br />

peripheral.mk<br />

device<br />

verilog<br />

.c<br />

.h<br />

service.c<br />

service.h<br />

.v<br />

.v<br />

Component folder<br />

Component description file<br />

“document” sub-folder<br />

HTML file<br />

“drivers” sub-folder<br />

peripheral.mk file<br />

“device” sub-folder<br />

Device driver files<br />

<strong>System</strong> service files<br />

“rtl” sub-folder<br />

“verilog” sub-folder<br />

Verilog component RTL files<br />

The follow<strong>in</strong>g is a brief description of the folders and files conta<strong>in</strong>ed <strong>in</strong> a<br />

typical custom component folder:<br />

� folder – Conta<strong>in</strong>s the follow<strong>in</strong>g files and directories:<br />

� .xml – This is the component description file that<br />

conta<strong>in</strong>s the XML code required to attach your component to the<br />

<strong>LatticeMico32</strong> processor.<br />

� document folder – Conta<strong>in</strong>s documentation file or files. This folder, at a<br />

m<strong>in</strong>imum, conta<strong>in</strong>s the follow<strong>in</strong>g file:<br />

� .htm – HTML file that is displayed <strong>in</strong> the MSB<br />

Ma<strong>in</strong> WIndow Component Help view<br />

� drivers folder – Conta<strong>in</strong>s the peripheral.mk file, which is used to direct<br />

C/C++ <strong>System</strong> Programm<strong>in</strong>g Environment (SPE) to the C/assembly<br />

driver files conta<strong>in</strong><strong>in</strong>g user-def<strong>in</strong>ed application programm<strong>in</strong>g <strong>in</strong>terfaces<br />

(APIs).<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 4


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Import/Create Component Graphical Interface<br />

Also <strong>in</strong>side the drivers folder are two subdirectories:<br />

� Device driver files (.c and<br />

.h). The device driver files def<strong>in</strong>e the API<br />

function calls available to the C/C++ SPE developer. The functions<br />

are user-def<strong>in</strong>ed accord<strong>in</strong>g to the specific needs of the custom<br />

component.<br />

� <strong>System</strong> service driver files (Service.c and<br />

Service.h). The service files must be<br />

implemented to support the <strong>LatticeMico32</strong> <strong>in</strong>itialization process.<br />

Each component must def<strong>in</strong>e a basic set of service functions<br />

which have been def<strong>in</strong>ed by the <strong>LatticeMico32</strong> boot process.<br />

� rtl folder – Conta<strong>in</strong>s the verilog subfolder.<br />

� verilog folder – Conta<strong>in</strong>s the component Verilog RTL files.<br />

Import/Create Component Graphical Interface<br />

The <strong>LatticeMico32</strong> MSB perspective has an Import/Create Custom<br />

Component graphical user <strong>in</strong>terface (GUI) that allows you to create or import<br />

custom components for use <strong>in</strong> your MSB platform.<br />

To open the Import/Create Custom Component GUI:<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 5


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Import/Create Component Graphical Interface<br />

� In the <strong>LatticeMico32</strong> <strong>System</strong> MSB perspective, click the Import/Create<br />

Custom Component button <strong>in</strong> the MSB Available <strong>Components</strong> view,<br />

as shown <strong>in</strong> Figure 4.<br />

Note<br />

A custom component is <strong>in</strong>dicated <strong>in</strong> the MSB Available <strong>Components</strong> view with the<br />

follow<strong>in</strong>g icon: . You can remove a previously created custom component by<br />

highlight<strong>in</strong>g the component <strong>in</strong> the Available <strong>Components</strong> view and click<strong>in</strong>g the<br />

Remove Custom Component button.<br />

Figure 4: Import/Create Custom Component Button <strong>in</strong> Available <strong>Components</strong> View<br />

Import/Create<br />

Custom Component<br />

Button<br />

Remove<br />

Custom Component<br />

Button<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 6


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Component Tab<br />

Component Tab<br />

Figure 5: Component Tab<br />

When the MSB Import/Create Custom Component button is clicked, the<br />

Import/Create Custom Component dialog box appears, with the Component<br />

tab displayed as default.<br />

The Component tab specifies component names, folders, and ma<strong>in</strong> attributes<br />

of the component. Figure 5 shows the Component tab of the Import/Create<br />

Custom <strong>Components</strong> dialog box.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 7


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Component Tab<br />

Table 1: Component Tab Options<br />

Option Description<br />

Table 1 lists the options available <strong>in</strong> the Component tab of the Import/Create<br />

Custom Component dialog box.<br />

Create New Component Choose this option to create a new component.<br />

Refer to “Create New Custom Component Flow” on page 1 for a description of the<br />

create new component flow.<br />

Open Component XML Choose this option to open an exist<strong>in</strong>g component description file<br />

(.xml) to edit the exist<strong>in</strong>g component.<br />

Refer to “Edit Exist<strong>in</strong>g Custom Component Flow” on page 2 for a description of<br />

the edit exist<strong>in</strong>g component flow.<br />

New Component Name Enter a name for your component. The name you enter <strong>in</strong> this box will be used to<br />

create a folder and a component description file (.xml).<br />

New Component Directory/<br />

Select Component XML<br />

New Component Directory - This option displays if you are creat<strong>in</strong>g a new<br />

custom component and have selected the Create New Component option. Type<br />

<strong>in</strong> the path to your component folder, or use the browse button to browse to your<br />

new component folder. Note: Your new component folder should be outside of the<br />

.\micosystem folder.<br />

Select Component XML - This option displays if you are edit<strong>in</strong>g an exist<strong>in</strong>g<br />

component and have selected the Open Component XML option. Use the browse<br />

button to browse to the component description file (.xml) of<br />

the component you wish to edit.<br />

Display Name Enter a name for your component. This is the name that will appear <strong>in</strong> the MSB<br />

Available <strong>Components</strong> w<strong>in</strong>dow. This name is not used for a folder or file name, so<br />

any comb<strong>in</strong>ation of ASCII characters is permitted.<br />

Version Enter a version number for your component. This is the version number that will<br />

appear <strong>in</strong> the MSB Available <strong>Components</strong> w<strong>in</strong>dow.<br />

Type Choose IO or Memory component type from the drop-down menu.<br />

Access This option is only available for memory type components. Choose Read, Write,<br />

or Read/Write from the drop-down menu.<br />

HTML Help Choose your component HTML file. The contents of this file will display <strong>in</strong> the<br />

MSB Component Help view.<br />

OK Accepts all values <strong>in</strong> the dialog box tab. If any value is <strong>in</strong>correct, an error<br />

message will display at the bottom of the dialog box tab. You must complete all<br />

required values before you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 8


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Master/Slave Ports Tab<br />

Master/Slave Ports Tab<br />

Figure 6: Master/Slave Ports Tab<br />

Table 2: Master/Slave Port Tab Options<br />

Option Description<br />

The Master/Slave Ports tab specifies Master/Slave ports and connections to<br />

the <strong>LatticeMico32</strong> WISHBONE Arbiter <strong>in</strong>terface. Figure 6 shows the Master/<br />

Slave Ports tab of the Import/Create Custom <strong>Components</strong> dialog box.<br />

Table 2 lists the options available <strong>in</strong> the Master/Slave Port tab of the Import/<br />

Create Custom Component dialog box.<br />

Master/Slave Ports Lists the master and/or slave ports <strong>in</strong> your component.<br />

� You can create more than one Master Port.<br />

� You can create only one Slave Port.<br />

Delete To delete Master Port or a Slave Port, highlight the port <strong>in</strong> the Master/Slave Ports<br />

list, click Delete, then click OK.<br />

Note: There is no undo if you delete a port. Once you click Delete and then OK,<br />

the port will be permanently deleted.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 9


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Master/Slave Ports Tab<br />

Table 2: Master/Slave Port Tab Options (Cont<strong>in</strong>ued)<br />

Option Description<br />

Type Choose either Master Port or Slave Port from the drop-down menu.<br />

Display Name This def<strong>in</strong>es the name of the Master/Slave port. The name is displayed <strong>in</strong>dented<br />

and below the component name once the new component has been added to the<br />

platform. Any ASCII character is permitted <strong>in</strong> this field.<br />

Prefix The prefix you enter <strong>in</strong> this box will replace the variable <strong>in</strong> the Master<br />

Port or Slave Port signal names. The prefix is comb<strong>in</strong>ed with the <strong>in</strong>stance<br />

name given to each component when it is added to the platform creat<strong>in</strong>g<br />

an pair which is used for mak<strong>in</strong>g port names<br />

unique.<br />

Port Attributes Connect the WISHBONE signal to the correct signal <strong>in</strong> your design. Refer to<br />

Table 3 on page 11 for a description of WISHBONE Slave Port signals.<br />

Update Updates options <strong>in</strong> MasterSlave Port tab.<br />

Add Adds the Master Port or Slave Port to the Master/Slave Ports list at the top of the<br />

dialog box.<br />

Reset Clears the port attributes.<br />

OK Accepts all values for every tab presented <strong>in</strong> the Import/Create Custom<br />

Component dialog box. If any value is <strong>in</strong>correct, an error message will display at<br />

the bottom of the dialog box tab. You must complete all required values before<br />

you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

Attach<strong>in</strong>g the WISHBONE Interface<br />

The ports of a component which implement a WISHBONE master or slave<br />

port must follow a specific nam<strong>in</strong>g convention. This allows MSB to correctly<br />

identify by name the ports by function so that they are connected properly<br />

when MSB generates the platform.<br />

Table 3 lists the signals required to connect the master port to the<br />

<strong>LatticeMico32</strong> processor. Table 4 the signals required to connect the slave<br />

port to the <strong>LatticeMico32</strong> processor. Each unique component must have a<br />

unique prefix. The ports which make up the WISHBONE master or slave port<br />

must follow the nam<strong>in</strong>g convention as described <strong>in</strong> the <strong>LatticeMico32</strong><br />

Processor Reference Manual table entitled “List of Component Port and<br />

Signal Name Suffixes.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 10


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Master/Slave Ports Tab<br />

Table 3: WISHBONE Signals Required to Connect Master Component to <strong>LatticeMico32</strong><br />

Component Port Names for<br />

WISHBONE Slave Port<br />

Direction Width Required<br />

_ADR_O output 32 Yes<br />

_DAT_O output 32 No<br />

_WE_O output 1 Yes<br />

_SEL_O output 4 Yes<br />

_STB_O output 1 Yes<br />

_CYC_O output 1 Yes<br />

_LOCK_0 output 1 No<br />

_CTI_O output 3 No<br />

_BTE_O output 2 No<br />

_DAT_I <strong>in</strong>put 32 No<br />

_ACK_I <strong>in</strong>put 1 Yes<br />

_ERR_I <strong>in</strong>put 1 No<br />

_RTY_I <strong>in</strong>put 1 No<br />

Table 4: WISHBONE Signals Required to Connect Slave Component to <strong>LatticeMico32</strong><br />

Component Port Names for<br />

WISHBONE Slave Port<br />

Direction Width Required<br />

_ADR_I <strong>in</strong>put 32 Yes<br />

_DAT_I <strong>in</strong>put 32 No<br />

_WE_I <strong>in</strong>put 1 Yes<br />

_SEL_I <strong>in</strong>put 4 Yes<br />

_STB_I <strong>in</strong>put 1 Yes<br />

_CYC_I <strong>in</strong>put 1 Yes<br />

_LOCK_I <strong>in</strong>put 1 No<br />

_CTI_I <strong>in</strong>put 3 ‘No<br />

_BTE_I <strong>in</strong>put 2 No<br />

_DAT_O output 32 No<br />

_ACK_O output 1 Yes<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 11


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Master/Slave Ports Tab<br />

Table 4: WISHBONE Signals Required to Connect Slave Component to <strong>LatticeMico32</strong> (Cont<strong>in</strong>ued)<br />

Component Port Names for<br />

WISHBONE Slave Port<br />

Direction Width Required<br />

_ERR_O <strong>in</strong>put 1 No<br />

_RTY_O <strong>in</strong>put 1 No<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 12


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> External Ports Tab<br />

External Ports Tab<br />

Figure 7: External Ports Tab<br />

Table 5: External Ports Tab Options<br />

Option Description<br />

Connect<strong>in</strong>g the Wishbone bus lets the <strong>LatticeMico32</strong> microprocessor control<br />

and access the custom component. The custom component has it's own<br />

unique <strong>in</strong>put/output control signals that need to be connected to system logic.<br />

The External Ports Tab permits these control signals to be def<strong>in</strong>ed so that the<br />

MSB can correctly generate a top level Verilog module. Figure 7 shows the<br />

External Ports tab of the Import/Create Custom <strong>Components</strong> dialog box.<br />

Table 5 lists the options available <strong>in</strong> the External Ports tab of the Import/<br />

Create Custom Component dialog box.<br />

Parameters Lists the parameters of the External Ports <strong>in</strong> your component. Note: ClockPort<br />

and ResetPort are mandatory. Interrupt is optional.<br />

Delete Deletes selected external port from the Parameters list. Note: There is no “undo”<br />

if you delete a port. If you click OK, the port will be permanently deleted. It is not<br />

possible to delete the ClockPort, ResetPort, or Interrupt entries.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 13


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> External Ports Tab<br />

Table 5: External Ports Tab Options (Cont<strong>in</strong>ued)<br />

Option Description<br />

Port Type Displays port type of port selected <strong>in</strong> Parameters box (either ClockPort,<br />

ResetPort, Interrupt, or ExternalPort). Not selectable or editable by user.<br />

Component Port User-def<strong>in</strong>ed component port name.<br />

Width Port width. Enter a number from 1 - 32.<br />

Direction Allows you to choose port direction. Choose <strong>in</strong>put, output, or <strong>in</strong>out from the<br />

drop-down menu.<br />

Active This option is only available if Port Type is <strong>in</strong>terrupt. Choose , High, or<br />

Low from the drop-down menu.<br />

Connect To Enter signal name.<br />

Update Updates the port Parameters list. Whenever a change is made to the Port<br />

Attribute entries that you wish to make permanent, it is necessary to use<br />

the Update button.<br />

Add Use this button to <strong>in</strong>sert a new external port <strong>in</strong>to the list of ports the custom<br />

component implements. Fill <strong>in</strong> each of the active Port Attribute fields and then<br />

click Add. If there are no syntax errors a new entry will be appended to the list of<br />

external ports.<br />

Reset Clears all entries <strong>in</strong> the Port Attributes group box and permits entry of a<br />

new external port. Use this button if the Add button is not available.<br />

OK Accepts all values for every tab presented <strong>in</strong> the Import/Create Custom<br />

Component dialog box. If any value is <strong>in</strong>correct, an error message will display at<br />

the bottom of the dialog box tab. You must complete all required values before<br />

you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 14


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> RTL Files Tab<br />

RTL Files Tab<br />

This section describes the design requirements for the Verilog HDL files<br />

associated with a MSB component.<br />

The functionality of components with<strong>in</strong> the MSB environment are ultimately<br />

def<strong>in</strong>ed by a collection of Hardware Description Language files (also known<br />

as RTL). The Import/Create Custom <strong>Components</strong> UI needs to know which<br />

HDL files def<strong>in</strong>e the functionality of your Wishbone compliant component. The<br />

RTL Files tab allows you to import and edit the HDL files associated with your<br />

component.<br />

The User RTL Files Source group box enables new HDL files to be added to<br />

the component. The files added to the list <strong>in</strong>side this group box do not<br />

become part of the component until the OK button is clicked and the UI closes<br />

without errors.<br />

Currently the only HDL available <strong>in</strong> the MSB is Verilog. <strong>Components</strong> written <strong>in</strong><br />

VHDL must have a Verilog black-box wrapper around them. The VHDL<br />

component must be compiled to NGO format, us<strong>in</strong>g ispLEVER Project<br />

Navigator, <strong>in</strong>dependently of the MSB and placed <strong>in</strong> the Project Navigator<br />

work<strong>in</strong>g directory.<br />

The Component RTL Files group box conta<strong>in</strong>s a list of the HDL files that are<br />

already part of the component. This list is only populated when edit<strong>in</strong>g an<br />

exist<strong>in</strong>g custom component. The list is updated when the OK button is clicked<br />

and the UI closes without errors.<br />

Figure 8 shows the RTL Files tab of the Import/Create Custom <strong>Components</strong><br />

dialog box.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 15


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> RTL Files Tab<br />

Figure 8: RTL Files Tab<br />

Table 6: RTL Files Tab Options<br />

Option Description<br />

Table 6 lists the options available <strong>in</strong> the RTL Files tab of the Import/Create<br />

Custom Component dialog box.<br />

Top-level Module Name Enter the name of the module that <strong>in</strong>stantiates one <strong>in</strong>stance of your<br />

component.<br />

RTL File This entry box permits you to enter a file name conta<strong>in</strong><strong>in</strong>g HDL code that<br />

is a part of your component. Enter a path and module name directly or<br />

use the Browse button to add HDL files <strong>in</strong>teractively.<br />

Add Click the Add button to <strong>in</strong>sert the file listed <strong>in</strong> the RTL File entry box to<br />

the list of files displayed <strong>in</strong> the Import RTL Files table.<br />

Delete Use this button to delete files from the Import RTL Files list. Highlight the<br />

file you wish to remove from the list and click Delete.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 16


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> RTL Files Tab<br />

Table 6: RTL Files Tab Options (Cont<strong>in</strong>ued)<br />

Option Description<br />

Directory When a custom component is be<strong>in</strong>g edited, the Directory text box shows<br />

the path to the RTL files currently associated with the component. This<br />

field can not be edited.<br />

Delete The Delete button <strong>in</strong> the Component RTL Files group box allows you to<br />

remove files already associated to a custom component. Highlight the<br />

HDL file you want to remove and click Delete.<br />

OK Accepts all values for every tab presented <strong>in</strong> the Import/Create Custom<br />

Component dialog box. If any value is <strong>in</strong>correct, an error message will display at<br />

the bottom of the dialog box tab. You must complete all required values before<br />

you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

<strong>Creat<strong>in</strong>g</strong> Verilog RTL Files<br />

The last section describes how MSB generates `def<strong>in</strong>e and parameter code<br />

used to customize the new component.<br />

MSB has some specific requirements for the structure of the Verilog source<br />

files used to def<strong>in</strong>e the component. It is important to follow the rules outl<strong>in</strong>ed<br />

below <strong>in</strong> order to successfully implement a MSB compliant component.<br />

When you are work<strong>in</strong>g on the Verilog HDL source files they can be placed<br />

anywhere <strong>in</strong> your files system hierarchy except the /micosystem/<br />

components subdirectory. Once the OK button is clicked and the UI closes<br />

without errors the HDL source files are copied to the/micosystem/<br />

components//rtl/verilog directory.<br />

When creat<strong>in</strong>g a platform <strong>in</strong> MSB you select each component <strong>in</strong> turn, and<br />

specify the unique requirements concern<strong>in</strong>g each component. UARTS are<br />

given a particular baud rate, and data run length, SRAM memory is given a<br />

depth and width, and so forth. Each of these requirements becomes a Verilog<br />

parameter or a Verilog `def<strong>in</strong>e, which is stored <strong>in</strong> a generated file named<br />

system_conf.v.<br />

The MSB creates the system_conf.v parameter file each time the Generate<br />

Platform button is clicked. If your custom component uses parameters you will<br />

need to add a l<strong>in</strong>e <strong>in</strong> your module(s) to import the parameters def<strong>in</strong>ed <strong>in</strong> the<br />

system_conf.v file, for example:<br />

`<strong>in</strong>clude "system_conf.v"<br />

When us<strong>in</strong>g Verilog `def<strong>in</strong>e for pass<strong>in</strong>g compilation configuration <strong>in</strong>formation it<br />

is necessary to ensure there are no namespace collisions. The `def<strong>in</strong>e values<br />

must be globally unique.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 17


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> RTL Files Tab<br />

MSB can also pass values to the Verilog top level module as parameters.<br />

When MSB generates code <strong>in</strong>stantiat<strong>in</strong>g the top level module it will create<br />

code similar to the follow<strong>in</strong>g example:<br />

I2cm_opencores #(.SYSCLK(25))….<br />

When MSB generates the platform, it also adds the ‘def<strong>in</strong>e statement <strong>in</strong> the<br />

system_conf.v file parameter with the <strong>in</strong>stance name prefixed to the<br />

parameter name, for example:<br />

‘def<strong>in</strong>e I2CM1SYSCLK 25<br />

Some custom components are unique and can only be added to a design a<br />

s<strong>in</strong>gle time. Currently the <strong>LatticeMico32</strong> processor can only be added to a<br />

platform a s<strong>in</strong>gle time. However there may be components that may be added<br />

to a MSB platform many times.<br />

If the component can be <strong>in</strong>stantiated multiple times <strong>in</strong> a system, all the source<br />

files must be enclosed <strong>in</strong> a globally unique `def<strong>in</strong>e statement, for example:<br />

`ifndef I2C_MASTER_CORE_V<br />

`def<strong>in</strong>e I2C_MASTER_CORE_V<br />

//all of the component’s source goes here<br />

`endif // I2C_MASTER_CORE_V<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 18


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Parameters Tab<br />

Parameters Tab<br />

Figure 9: Parameters Tab<br />

Table 7: Parameters Tab Options<br />

Option Description<br />

This section describes how the `def<strong>in</strong>e and parameter statements are entered<br />

so that they can be sent to your Verilog source files. Figure 9 shows the<br />

Parameters tab of the Import/Create Custom <strong>Components</strong> dialog box.<br />

Table 7 lists the options available <strong>in</strong> the Parameters tab of the Import/Create<br />

Custom Component dialog box.<br />

Parameter Name This is the name of the parameter to be passed to the Verilog source<br />

code. When us<strong>in</strong>g Def<strong>in</strong>e types be sure to make the name globally<br />

unique.<br />

Display Text Each component, when added to the platform, br<strong>in</strong>gs up an<br />

<strong>in</strong>dividualized dialog box. Each element <strong>in</strong> the dialog box will have<br />

descriptive text placed adjacent to a control. Display Text def<strong>in</strong>es the text<br />

that will be placed adjacent to the specific control.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 19


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Parameters Tab<br />

Table 7: Parameters Tab Options (Cont<strong>in</strong>ued)<br />

Option Description<br />

Value Type Allows you to def<strong>in</strong>e value type. Choose Def<strong>in</strong>e, Str<strong>in</strong>g, Integer, List, or<br />

Frequency from the drop-down menu.<br />

Default Value Default Value lets you def<strong>in</strong>e how each parameter or `def<strong>in</strong>e will be<br />

<strong>in</strong>itialized when a component is added to the platform. This field is freeform,<br />

so you must be careful when enter<strong>in</strong>g default values. Any type<br />

mismatch or <strong>in</strong>correct data entered here will impact the synthesis<br />

process later.<br />

GUI Widget Allows you to select GUI WIdget.<br />

� If Value type is Def<strong>in</strong>e, choose , Radio, or Check from the dropdown<br />

menu.<br />

� If Value type is Str<strong>in</strong>g, choose or Text from the drop-down menu.<br />

� If Value type is Integer, choose Text or Sp<strong>in</strong>ner from the drop-down menu.<br />

� If Value type is List, choose or Combo from the drop-down menu.<br />

� If Value type is Frequency, choose or Text from the drop-down<br />

menu.<br />

WIdget Sett<strong>in</strong>g If GUI widget is Combo, enter comma-separated list values. If GUI widget is<br />

Sp<strong>in</strong>ner, enter m<strong>in</strong>imum and maximum values as a hyphen-separated pair.<br />

Flags Choose , parameter, or compiler from the drop-down menu.<br />

� The parameter flag specifies that it is a Verilog parameter.<br />

� The compiler flag specifies that this is a compiler option to be used<br />

<strong>in</strong> C/C++ SPE.<br />

Complier Options If compiler flag is selected, specify flag or option.<br />

Standard I/O This option is only available for CharIODevice. Choose , <strong>in</strong>put, output,<br />

or <strong>in</strong>out from the drop-down menu.<br />

Update Update changes.<br />

Add Add new parameter<br />

Reset Clears the Parameter tab options.<br />

OK Accepts all values for every tab presented <strong>in</strong> the Import/Create Custom<br />

Component dialog box. If any value is <strong>in</strong>correct, an error message will display at<br />

the bottom of the dialog box tab. You must complete all required values before<br />

you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 20


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Software Tab<br />

Software Tab<br />

<strong>LatticeMico32</strong> <strong>System</strong> custom components are created <strong>in</strong>side a Latticedef<strong>in</strong>ed<br />

framework. The framework consists of the HDL component, the UI<br />

component, and the C/C++ source code component.<br />

The MSB environment def<strong>in</strong>es and requires a specific set of C data structures<br />

and at a m<strong>in</strong>imum a s<strong>in</strong>gle C <strong>in</strong>itialization po<strong>in</strong>t. The MSB uses this set of<br />

structures to keep track of the number of <strong>in</strong>stantiated cores. It also uses this<br />

<strong>in</strong>formation to determ<strong>in</strong>e how each component was configured prior to<br />

synthesis.<br />

One MSB element that needs to be created is a C structure which is used by<br />

Lattice C/C++ SPE and Debug API calls to identify the specific MSB<br />

component the C function will manipulate. This structure is generically called<br />

the DDStruct, but <strong>in</strong> actual practice will be a C typedef named<br />

st_customname_t. The UI lets you specify the customname.<br />

Every DDStruct <strong>in</strong> the MSB must have the follow<strong>in</strong>g entries:<br />

const char* name; // components <strong>in</strong>stance name<br />

unsigned <strong>in</strong>t base; // components base address<br />

void * userCtx;<br />

void * callback;<br />

void * prev; // l<strong>in</strong>ked list describ<strong>in</strong>g components of the same<br />

type<br />

void * next;<br />

The DDStruct also conta<strong>in</strong>s <strong>in</strong>formation specific to your custom component.<br />

For example a VGA controller may have a maximum and m<strong>in</strong>imum horizontal<br />

synchronization frequency. The DDStruct structure could have a<br />

m<strong>in</strong>imumHorizFreq and a maximumHorizFreq element that would be<br />

configured prior to synthesis and then passed on to the Lattice C/C++ SPE<br />

and Debug environment via these two variables.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 21


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Software Tab<br />

Figure 10: Software Tab<br />

Table 8: Software Tab Options<br />

Option Description<br />

The Software Tab allows you to def<strong>in</strong>e the <strong>in</strong>itialization function and the<br />

DDStruct pieces of the custom component. Figure 10 shows the Software tab<br />

of the Import/Create Custom <strong>Components</strong> dialog box.<br />

Table 8 lists the options available <strong>in</strong> the Software tab of the Import/Create<br />

Custom Component dialog box.<br />

Initialization Function Name Enter user-def<strong>in</strong>ed <strong>in</strong>itialization function name.<br />

Component Information Structure<br />

Name<br />

Def<strong>in</strong>es the name given to the DDStruct structure.<br />

Data Type Def<strong>in</strong>es the C data type of the DDStruct element be<strong>in</strong>g added. The drop<br />

down menu lets you specify the follow<strong>in</strong>g C data types: void *, unsigned<br />

<strong>in</strong>t, <strong>in</strong>t, <strong>in</strong>t *, const char, unsigned char, unsigned char *, char, or char *.<br />

Member Name Def<strong>in</strong>es the name of the DDStruct element be<strong>in</strong>g added.<br />

Value Available values <strong>in</strong> the drop-down menu are dependant upon the chosen Data<br />

Type.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 22


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Software Tab<br />

Table 8: Software Tab Options (Cont<strong>in</strong>ued)<br />

Option Description<br />

Is Array Check if member name is an array.<br />

Delete Deletes the highlighted DDstruct sett<strong>in</strong>g from the list.<br />

Update Allows an element already added to the DDStruct to be modified.<br />

Highlight the element, make any desired changes to the element, and<br />

the click Update to activate the changes.<br />

Add Adds a new element to the DDStruct structure with the values active <strong>in</strong><br />

the DDStruct Attributes group box.<br />

Reset Clears the DDStruct Attributes group box controls.<br />

OK Accepts all values for every tab presented <strong>in</strong> the Import/Create Custom<br />

Component dialog box. If any value is <strong>in</strong>correct, an error message will display at<br />

the bottom of the dialog box tab. You must complete all required values before<br />

you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

Initialization Function Name<br />

Specifies the name of the <strong>in</strong>itialization rout<strong>in</strong>e for a given component type.<br />

This rout<strong>in</strong>e is used to <strong>in</strong>itialize the component at system power-up and reset.<br />

When the project is built <strong>in</strong> Lattice C/C++ SPE, a call to this function for each<br />

<strong>in</strong>stance of this component will be put <strong>in</strong>to the Lattice_DD<strong>in</strong>it C function<br />

(which is def<strong>in</strong>ed <strong>in</strong> the DD<strong>in</strong>it.c file). Lattice DD<strong>in</strong>it is part of the default boot<br />

sequence, and it calls ma<strong>in</strong>() after the component <strong>in</strong>itialization function calls<br />

have been executed. Refer to the <strong>LatticeMico32</strong> Software Developer’s Guide<br />

for more <strong>in</strong>formation about the boot sequence.<br />

The C prototype expected of the <strong>in</strong>itialization rout<strong>in</strong>e is as follows:<br />

void InitRout<strong>in</strong>eName ( StuctureNameValue *ctx );.<br />

The StuctureNameValue is the name of your DDStruct def<strong>in</strong>ed type.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 23


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> Software Files Tab<br />

Software Files Tab<br />

Figure 11: Software Files<br />

The Lattice C/C++ SPE and Debug environment permits you to write your C/<br />

C++ applications allow<strong>in</strong>g you to control the components attached to the<br />

<strong>LatticeMico32</strong> WISHBONE bus.<br />

The Lattice supplied components all have at a m<strong>in</strong>imum two source files<br />

associated with them. The source files def<strong>in</strong>e a set of C/C++ API's the<br />

firmware writer can use to access the component.<br />

This section of the UI also permits the addition of any support files used with<br />

the component or for build<strong>in</strong>g a object library.<br />

Imported files do not become part of the component until the OK button is<br />

clicked and the component is saved without error.The Current Software Files<br />

portion of the Software Files tab displays exist<strong>in</strong>g software files if an exist<strong>in</strong>g<br />

custom component is be<strong>in</strong>g edited<br />

Figure 11 shows the Software Files tab of the Import/Create Custom<br />

<strong>Components</strong> dialog box.<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 24


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> References<br />

Table 9: Software Files Tab Options<br />

Option Description<br />

References<br />

Table 9 lists the options available <strong>in</strong> the Software Files tab of the Import/<br />

Create Custom Component dialog box.<br />

Software File Browse to software driver files. Copies the selected file <strong>in</strong>to the component<br />

folder.<br />

Add Adds the file currently listed <strong>in</strong> the Software File entry box to the table of<br />

Imported Files.<br />

Delete Deletes the highlighted entry <strong>in</strong> the Import Software Files table.<br />

Directory Displays the folder where the source code files associated with the<br />

component be<strong>in</strong>g edited.<br />

Delete Deletes a source file already associated with the component be<strong>in</strong>g edited.<br />

File Type Choose the follow<strong>in</strong>g from the drop down menu: Application, Platform Library,<br />

Structure Header, Header.<br />

OK Accepts all values for every tab presented <strong>in</strong> the Import/Create Custom<br />

Component dialog box. If any value is <strong>in</strong>correct, an error message will display at<br />

the bottom of the dialog box tab. You must complete all required values before<br />

you can cont<strong>in</strong>ue.<br />

Cancel Cancels the actions and closes the dialog box.<br />

Reset Resets all values <strong>in</strong> all tabs <strong>in</strong> the dialog box.<br />

Help Displays the help for the dialog box. The help opens a copy of <strong>Creat<strong>in</strong>g</strong><br />

<strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong>.<br />

You can consult the follow<strong>in</strong>g references for more <strong>in</strong>formation on<br />

<strong>LatticeMico32</strong> <strong>System</strong>:<br />

� Onl<strong>in</strong>e Help <strong>in</strong> the <strong>LatticeMico32</strong> <strong>System</strong> GUI, which you can access by<br />

choos<strong>in</strong>g Help > Help Contents.<br />

� <strong>LatticeMico32</strong> Tutorial, which steps you through the basic process<br />

<strong>in</strong>volved <strong>in</strong> us<strong>in</strong>g the <strong>LatticeMico32</strong> <strong>System</strong> software to implement a soft<br />

microprocessor and attached components <strong>in</strong> a Lattice Semiconductor<br />

device for the <strong>LatticeMico32</strong>/DSP development board<br />

� <strong>LatticeMico32</strong> Processor Reference Manual, which conta<strong>in</strong>s <strong>in</strong>formation<br />

on the architecture of the <strong>LatticeMico32</strong> processor, <strong>in</strong>clud<strong>in</strong>g configuration<br />

options, pipel<strong>in</strong>e architecture, register architecture, debug architecture,<br />

and details about the <strong>in</strong>struction set<br />

� <strong>LatticeMico32</strong> Development Kit User’s Guide, which describes how to<br />

<strong>in</strong>stall all the necessary development tools; set up the <strong>LatticeMico32</strong><br />

development board; connect to the development board; use the<br />

<strong>LatticeMico32</strong> <strong>System</strong> software (MSB and C/C++ SPE) to create the<br />

hardware platform and the software application code that drives it; and<br />

download the bitstream to the <strong>LatticeMico32</strong> development board. You<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 25


<strong>Creat<strong>in</strong>g</strong> a Custom Component <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> References<br />

should be familiar with all chapters that cover the boot/<strong>in</strong>itialization<br />

sequence; develop<strong>in</strong>g device drivers for components; and the managed<br />

build process which uses the <strong>in</strong>formation <strong>in</strong> the component description file<br />

to build the appropriate Verilog and C/C++ source code for the platform.<br />

� <strong>LatticeMico32</strong> Software Developer User’s Guide, which expla<strong>in</strong>s how to<br />

use C/C++ SPE to program the microprocessor, gives examples of the<br />

code used for different parts of the architecture, and describes the<br />

processes occurr<strong>in</strong>g <strong>in</strong> the background<br />

� <strong>LatticeMico32</strong> Development Tools Installation Guide, which expla<strong>in</strong>s how<br />

to <strong>in</strong>stall the <strong>LatticeMico32</strong> <strong>System</strong> software<br />

� <strong>LatticeMico32</strong>/DSP Development Board User’s Guide, which describes<br />

the features and functionality of the <strong>LatticeMico32</strong>/DSP development<br />

board. This board is designed as a hardware platform for design and<br />

development with the <strong>LatticeMico32</strong> microprocessor, as well as for the<br />

LatticeMico8 microcontroller, and for various DSP functions.<br />

� <strong>LatticeMico32</strong> Asynchronous SRAM Controller, which describes the<br />

features and functionality of the <strong>LatticeMico32</strong> asynchronous SRAM<br />

controller<br />

� <strong>LatticeMico32</strong> DMA Controller, which describes the features and<br />

functionality of the <strong>LatticeMico32</strong> DMA controller<br />

� <strong>LatticeMico32</strong> On-Chip Memory Controller, which describes the features<br />

and functionality of the <strong>LatticeMico32</strong> on-chip memory controller<br />

� <strong>LatticeMico32</strong> Parallel Flash Controller, which describes the features and<br />

functionality of the <strong>LatticeMico32</strong> parallel flash controller<br />

� <strong>LatticeMico32</strong> GPIO, which describes the features and functionality of the<br />

<strong>LatticeMico32</strong> GPIO<br />

� <strong>LatticeMico32</strong> SPI, which describes the features and functionality of the<br />

<strong>LatticeMico32</strong> serial peripheral <strong>in</strong>terface (SPI)<br />

� <strong>LatticeMico32</strong> Timer, which describes the features and functionality of the<br />

<strong>LatticeMico32</strong> timer<br />

� <strong>LatticeMico32</strong> UART, which describes the features and functionality of the<br />

<strong>LatticeMico32</strong> universal asynchronous receiver-transmitter (UART)<br />

� LatticeECP/EC FPGA Family Handbook, which is a collection of the data<br />

sheets and application notes on LatticeEC and LatticeECP-DSP devices<br />

� LatticeECP2/M Family Handbook, which is a collection of the data sheets<br />

and application notes on LatticeECP2-DSP and LatticeECP2M-DSP<br />

devices<br />

<strong>Creat<strong>in</strong>g</strong> <strong>Components</strong> <strong>in</strong> <strong>LatticeMico32</strong> <strong>System</strong> 26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!