an221.pdf

Supporting Custom
Boards with DSP Builder
April 2003, ver. 1.0
Introduction
Application Note 221
As designs become more complex, verification becomes a critical, time
consuming process. To address the need for more efficient verification
techniques, the Altera® DSP Builder tool provides a seamless flow for
performing implementation in The MathWorks Simulink software and
verification in actual hardware.
DSP Builder provides bit-true and cycle-accurate simulation models and
supports board-level, in-system verification using the SignalTap® II
embedded logic analyzer. By importing the data into the
MATLAB/Simulink workspace to facilitate visual analysis, this analyzer
lets you monitor internal nodes within a design in hardware at system
speed.
Before analyzing a design in hardware, you must integrate board
elements into your Simulink design file using DSP development board
blocks. To facilitate this process, DSP Builder includes a library of blocks
for the APEX® EP20K200E, APEX EP20K1500E, Stratix™ EP1S25, and
Stratix EP1S80 DSP development boards. Additionally, DSP Builder
allows you to perform rapid prototyping using any hardware
development board and custom blocks you build yourself. Using DSP
Builder and your own board provides the following benefits:
■
■
■
■
Speeds up the prototyping flow for DSP applications
Enhances debugging capabilities of DSP applications using the
SignalTap II logic analyzer
Creates powerful, effective demonstrations for early prototypes of
DSP applications
Supports the same board for multiple projects during the prototyping
stage
This application note describes how to create a custom board library in
DSP Builder to support your own board with different devices and/or
pin-outs. This document also includes a walkthrough that explains the
step-by-step procedure for creating a board library, using the Nios®
development board, Stratix edition as an example. Using this example and
the templates provided, you can easily create your own custom board
library.
Altera Corporation
AN-221-1.0
1
AN 221: Supporting Custom Boards with DSP Builder
1
Targeting
Boards with
DSP Builder
This document assumes that you have basic familiarity with the
MATLAB/Simulink software. Refer to MATLAB and Simulink
Help for specific details on how to use the software. Refer to the
DSP Builder User Guide for information on how to use DSP
Builder.
Altera offers several DSP development boards as prototyping platforms
that provide you with an economical solution for hardware and software
verification. These rapid prototyping boards let you debug and verify
functionality and design timing. With a library of peripherals including
analog input and output channels and the ability to combine boards easily
with right angle connectors, you can use these boards to construct a
powerful processing system. Combined with DSP IP from Altera and
Altera Megafunction Partners Program (AMPP™) partners, you can solve
design problems that formerly required custom hardware and software
solutions.
1
For more information on Altera DSP development kits, refer to
www.altera.com/products/devkits/kit-dev_platforms.html.
To target a specific development board in DSP Builder, you include device
and connector blocks, which are unique to each development board, in
your Simulink Model File (.mdl). The SignalCompiler block, which is the
heart of DSP Builder, converts the Simulink design into synthesizable RTL
VHDL and generates Tcl scripts with the device and pin-out information
for the input and output ports in the design based on these blocks. You
then use the Tcl scripts to perform synthesis, Quartus II compilation,
and/or simulation in the ModelSim software.
The SignalCompiler block also lets you perform synthesis and place-androute and download a device configuration file directly to your
development board from within Simulink, providing a seamless interface
between implementation and verification. This process can significantly
reduce the time needed to go from system design to evaluation and
verification in actual hardware for rapid prototyping.
In addition to the Altera DSP development board libraries provided with
DSP Builder, you can create custom board libraries for any development
board. Board information is not hard-coded in the SignalCompiler block;
instead, it is specified in a dedicated board configuration block that you
include in your top-level Model File. This feature allows DSP Builder to
support any hardware development board using a customized library.
The user-created library must contain all information necessary to pass
device, port, and pin-out constraints to the Quartus II Tcl script for
compilation.
2
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Board Library
Blocks
When creating a library for your own board, you use two types of blocks:
■
■
Board configuration block
Board connector blocks
The board configuration block contains information about the specific
development board you are using; the board connector block describes
the I/O components within the development board. Each board library
you create should have one board configuration block and one or more
board connector blocks. Figure 1 shows an example of a board library
created for the Nios development board (APEX version).
Figure 1. Custom Board Library Example
Board Configuration Block
Board Connector Blocks
Board Configuration Block
The board configuration block indicates which board is targeted and is
unique for each board that is supported in DSP Builder. When targeting a
DSP development board (i.e., selecting DSP Board as the target in Signal
Compiler), the Simulink design must contain the board configuration
block at the top hierarchical level.
Altera Corporation
3
AN 221: Supporting Custom Boards with DSP Builder
This block has information on the target device and has pin-outs for
control signals, including clock input, clock output from the PLL block (if
any), and the global reset signal. Optionally, it can configure the clock
output feeding an on-board digital-to-analog converter (DAC). For more
details, refer to “Parameters” on page 6.
Board Connector Blocks
Board connector blocks link to I/O components such as analog-to-digital
converters (ADC), DACs, RS-232 serial ports, LEDs, switches, and
pushbuttons. Each block must include information on the ports
represented including the direction (i.e., input or output), bit width, and
pin location. For more details, refer to “Parameters” on page 6.
About the
Simulink Mask
Editor
Masking blocks is a Simulink feature that allows you to make a
customized parameter dialog box for each component in your board
library. This section describes the Mask Editor options you use when
creating a new library and customizing it for the connectors available on
your development board. The Mask Editor has the following tabs:
■
■
■
■
Icon
Parameters
Initialization
Documentation
1
For a complete description of the Simulink features described in
this section—such as the Mask Editor and model construction
commands like get_param, gcb, and set_param—see “Using
Simulink” in The MathWorks documentation.
Each block has its own parameters specified in the Parameters tab in the
Mask Editor. These parameters are initialized using MATLAB commands
or a MATLAB script specified in the Initialization tab. Figure 2 shows the
development flow using the Mask Editor.
4
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Figure 2. Development Flow Using the Mask Editor
Mask Editor
Icon Tab
Parameters Tab
Initialization Tab
Documentation Tab
MATLAB
Initialization
Script
Icon
When you create a block, you can give it an icon that contains descriptive
text, state equations, images, or graphics. You make this setting in the
Mask Editor’s Icon tab. For example, you can photograph the elements on
your board (e.g., D/A converters), save them as bitmaps
(<filename>.bmp), and display them in your board library. The blocks in
Figure 1 on page 3 are photographed bitmap icons. The imread and
image commands read the graphics file and display the image,
respectively. Figure 3 shows the Icon tab.
Figure 3. Icon Tab
Altera Corporation
5
AN 221: Supporting Custom Boards with DSP Builder
Parameters
You use the Parameters tab to define each block’s variables and their
parameter prompts. These prompts display in the block’s parameter
dialog box that appears when you double-click the block. To support your
board, you must set up parameters for the board configuration block as
well as any connector blocks. Figure 4 shows the Parameters tab.
Figure 4. Parameters Tab
You can use the board configuration block for the Stratix EP1S25 DSP
development board, provided with DSP Builder, as a template when
creating your own board configuration block. Modify the template as
needed for your own development board. The board configuration block
has the parameters and variables shown in Table 1.
6
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Table 1. Parameters for Board Configuration Block
Prompt
Variable
Description
Value
DSP Board
Library
DspBoard
Indicate the name of board library. String
Device Family
Family
Indicate the device family.
Stratix, Cyclone, APEX, Mercury,
ACEX, or FLEX
Clock Pin In
ClockPinIn
Indicate the clock source pin to
drive the device.
Pin_<number>
Clock Pin Out
(D2A_2_CLK)
Clock1PinOut
Indicate the clock out pin to drive
D/A 2 (D2A_2).
Pin_<number>
Clock Pin Out
(D2A_1_CLK)
Clock2PinOut
Indicate the clock out pin to drive
D/A 1 (D2A_1).
Pin_<number>
Clock Pin Out
ClockPinOut
Indicate the clock out pin to drive
other components on board.
Pin_<number>
Global Reset Pin
GlobalResetPin Indicate selection of reset pins.
Pin_<number>
Device
Device
Indicate the device part number.
You can find the device part number
format information at
www.altera.com/products/devices/
dev-format.html
JTAGDevice
JTAGDevice
Indicate the JTAG IDCODE of the You can find the JTAG IDCODE by
device you are targeting.
looking in the JTAG section of the
appropriate device family data sheet
The rest of the connectors in your custom board library have the
parameters and variables shown in Table 2.
Altera Corporation
7
AN 221: Supporting Custom Boards with DSP Builder
Table 2. Parameters for Board Connector Block
Prompt
Variable
Description
Value
Bus Type
sgn
Choose the bus number format.
Signed Integer,
Unsigned Integer,
Single Bit, Signed
Binary Fractional
Node Type
nodetype
Indicate the type of node.
Input Port, Output
Port
[number of bits].[] bwl
Indicate the number of bits to the left of the binary
1 - 51
point, including the sign bit. This parameter does not
apply to single-bit buses.
[].[number of bits] bwr
Indicate the number of bits to the right of the binary
point. This parameter only applies to signed binary
fractional buses.
Saturate
sat
When this option is turned on, if the output is greater On or Off
than the maximum positive or negative value to be
represented, the output is forced (or saturated) to the
maximum positive or negative value, respectively.
When this option is turned off, the most significant bit
(MSB) is truncated. This option is not valid for the
input port or constant node types.
Round
rnd
When this option is turned on, the output is rounded On or Off
away from zero. When this option is turned off, the
least significant bit (LSB) is truncated: <int>(input
+0.5). This option is not valid for the input port or
constant node types.
Constant Value
cst
Indicate the constant value that will be formatted with Double
the bus parameter specified.
DSP Board
Library
DspBoard
Indicate name of board library
String
Pin Location
LocPin
Indicate pin location (MSB -> LSB).
Pin_<number>
componentid
componentid
Indicate unique component ID for each connector
block.
String
8
0 - 51
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Initialization
You specify initialization commands in the Initialization tab. These
commands define the variables that are associated with the parameters.
For board library blocks, the initialization process executes from a
MATLAB script when you open Simulink. “Create a Custom Board
Library” on page 11 provides templates for these scripts (myboardprog.m
for board configuration blocks and myboard_init.m for board connector
block(s)).
The Simulink get_param and set_param commands let you inspect
and set dialog box parameters and change the dialog box’s appearance
while the dialog box is open. The gcb command gets the path of the
current block.
For a masked block to change the contents of its underlying system block
and set parameters based on user input, you initialize it as a selfmodifying masked block using the following command:
set_param(gcb,’MaskSelfModifiable’,’on’);
You can control the visibility of the user-defined parameter controls in the
dialog box using the following command:
set_param(gcb,'MaskVisibilities',{'off','on',‘off'});
The parameter association is done by position (i.e., the first cell defines the
value of the first parameter, the second cell defines the value of the second
parameter and so on so forth). Figure 5 shows the Initialization tab.
Figure 5. Initialization Tab
Altera Corporation
9
AN 221: Supporting Custom Boards with DSP Builder
Documentation
You define the mask type, specify the block description, and point to the
block’s help file in the Documentation tab. The mask type field shows up
in the block parameters dialog box for the corresponding block. For the
board configuration block, the mask type should be DspBoard
AlteraBlockSet. For the board connector blocks, the mask type should
be AltBus AlteraBlockSet.
1
The commands, variables, and names in Simulink are casesensitive.
The mask description field allows you to provide the user with helpful
information about the block usage or parameters. You can also link to an
HTML help file for the block (e.g., all of the DSP Builder blocks have help
files). If you use the default specified in the template, which uses the
GETDOCPATH script, you must place the HTML file in the <path to DSP
Builder>\Altlib directory. Alternatively, you can place the HTML file in
the same folder as the library model file and reference it using the
following command:
web([’file:///’ which(’foo.html’)]);
Figure 6 shows the Documentation tab.
Figure 6. Documentation Tab
10
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Create a
Custom Board
Library
This section describes how to create your own board library, update
blocks in the Mask Editor, edit the Altera-provided MATLAB scripts, and
include your new library in the Simulink Library Browser. The
instructions use the Nios development board, Stratix edition as an
example.
Hardware & Software Requirements
To follow the steps in this section, you must have the following software
installed on your system:
■
■
MATLAB/Simulink Release 12 or 13
DSP Builder version 2.1.2 or later
1
The screenshots shown in this document are from Simulink
version 5.0 (MATLAB/Simulink Release 13). If you are using
another version of the software, some windows will be different,
but the same concepts apply.
If you want to use the library with a board after creating it, you will need
the following additional hardware and software:
■
■
The Quartus II software version 2.2 or later
Nios development board, Stratix edition
Walkthrough Design Files
The design files for this walkthrough are installed automatically when
you install DSP Builder. Figure 7 shows the walkthrough directory
structure. You can begin creating the library using the files in the
c:\DSPBuilder\designexamples\modular_board\walkthrough
directory. Alternatively, you can view the completed library in the
c:\DSPBuilder\designexamples\modular_board\complete directory.
Figure 7. Walkthrough Directory Structure
c:\DSPBuilder\designexamples\modular_board
complete
Contains the completed files for the Nios development boards..
complete_Nios_Stratix
Contains a library for the components on the Nios develpment board, Stratix edition.
complete_Nios_Apex
Contains a library for the components on the Nios develpment board (APEX).
walkthrough
Contains the files you should use to perform the design walkthrough.
Altera Corporation
11
AN 221: Supporting Custom Boards with DSP Builder
Design Walkthrough
This section walks you through the steps involved in building a library of
blocks targeting the Nios development board, Stratix edition using the
files in the c:\DSPBuilder†esignexamples\modular_board
\walkthrough directory. The steps include:
1.
Create a New Library Model File
2.
Create the Board Configuration Block
3.
Create Board Connector Blocks
4.
Add the Library to the Simulink Library Browser
Instead of creating the library, you can view the Altera-provided libraries
in the c:\DSPBuilder\designexamples\modular_board\complete
directory.
Create a New Library Model File
The first step when creating a custom library is to create a Model File
(.mdl) to hold the board configuration and board connector blocks. Create
a model file by performing the following steps:
12
1.
Run the MATLAB software.
2.
Change the current working directory to c:\DSPBuilder\
designexamples\modular_board\walkthrough directory (e.g., by
clicking the browse button next to the Current Directory list box in
the MATLAB GUI).
3.
Click the + icon next to Simulink in the Launch Pad.
4.
Double-click Library Browser.
5.
Choose New > Library (File menu) from the Simulink Library
Browser. Simulink opens a new library model window.
6.
Choose Save (File menu).
7.
Save the library as myboard.mdl in the c:\DSPBuilder\
designexamples\modular_board\walkthrough directory.
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Create the Board Configuration Block
In this walkthrough, you use the board configuration block from the
Stratix DSP Board EP1S25F780C5 library as a template. Because you are
using a template block, you have to break the link between the template
block and its library to make it stand alone. To create a board
configuration block for your development board, perform the following
steps:
Altera Corporation
1.
Click the + icon next to the Stratix DSP Board EP1S25F780C5 library
in the Simulink Library Browser to expand it.
2.
Drag and drop the Stratix DSP Board 1S25 Configuration block from
the Stratix DSP Board EP1S25F780C5 library to your myboard.mdl
file.
3.
Right-click the Stratix DSP Board 1S25 Configuration block and
choose Link Options > Disable Link from the pop-up menu.
4.
Right-click the Stratix DSP Board 1S25 Configuration block and
choose Link Options > Break Link from the pop-up menu.
5.
Double-click the text label on the Stratix DSP Board 1S25
Configuration block.
6.
Delete the text label.
7.
Type Nios Stratix Board 1S10 Configuration as the new
label.
8.
Right-click the Nios Stratix Board 1S10 Configuration block and
choose Edit Mask from the pop-up menu to open the Mask Editor. It
opens to the Icon tab.
9.
Change the name of the specified bitmap to stratix_nios_board.bmp
in the Drawing commands box as shown in Figure 8.
13
AN 221: Supporting Custom Boards with DSP Builder
Figure 8. Change Bitmap in Icon Tab
10. Click the Parameters tab.
11. Change the options for the parameters in the Popups box as shown
in Figure 9. Use the values provided in Table 3. For details, refer to
“Parameters” on page 6.
Table 3. Parameters for Board Nios Stratix 1S10 Configuration Block
Prompt
Pop-Up
DSP Board Library
niosboard1S10
Device Family
Stratix
Clock Pin In
Pin_K17, Pin_AC17, Any
Clock Pin Out (D2A_2_CLK)
Not applicable
Clock Pin Out (D2A_1_CLK)
Not applicable
Clock Pin Out
Pin_AD15, Pin_E15, Any
Global Reset Pin
Pin_W5, Pin_W6, Pin_AB2, Pin_AB1, Any
Device
EP1S10F780C6ES
JTAG Device
@1: EP1S10F1020/780 (0x020010DD)
14
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Figure 9. Change Parameters in Parameter Tab
12. Click the Initialization tab.
13. Change the visibility option for the parameters in the Initialization
Commands window as shown below:
set_param(gcb,’MaskVisibilities’,{’off’,’off’,’on’,
’off’,’off’,’on’,’on’,’off’,’off’});
This setting enables the Clock Pin In, Clock Pin Out, and Global
Reset Pin options in the block parameters window for the Nios
Stratix Configuration block. The rest of the parameters are hidden.
14. Change the MATLAB script, dspboard1S25prog, to
niosboard1S10prog as shown in Figure 10.
Altera Corporation
15
AN 221: Supporting Custom Boards with DSP Builder
Figure 10. Change Initialization Commands in Initialization Tab
15. Create the niosboard1S10prog.m MATLAB script by updating the
Altera-provided template c:\DSPBuilder\designexamples
\modular_board\walkthrough\myboardprog.m.
a.
Choose Open (File menu) in the MATLAB window.
b.
Browse to c:\DSPBuilder\designexamples\modular_board
\walkthrough.
c.
Select myboardprog.m and click Open.
d.
Change the script parameters after the instructions provided in
the comment section of the template with the values in Table 4.
Table 4. Parameters for niosboard1S10prog.m MATLAB Script
Parameter
16
Value
Function Name
niosboard1S10prog
Library Model Name
myboard
Device Part Name
EP1S10F780
e.
Choose Save (File menu).
f.
Save the file as niosboard1S10prog.m.
g.
Choose Close (File menu).
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
16. Click the Documentation tab.
17. Change the Mask description to reflect the configuration settings of
the Nios development board, Stratix edition by making
configuration settings for the following signals:
–
–
Input Clock (Crystal Oscillator): Pin_K17, Pin_AC17
Output Clock: Pin_AD15, Pin_E15
18. Change the Mask help to reflect the corresponding HTML help page
for the board, nios_board_stratix.html, using the following
command (see Figure 11):
web([’file:///’which(’nios_board_stratix.html’)]);
You can edit the file, which is located at c:\DSPBuilder\
designexamples\modular_board\walkthrough\nios_board_strati
x.html, to include any help information that you want.
Figure 11. Change Mask Description & Mask Help in Documentation Tab
19. Click Apply.
20. Click OK to close the Mask Editor.
Altera Corporation
17
AN 221: Supporting Custom Boards with DSP Builder
Create Board Connector Blocks
In this walkthrough, you use the board connector blocks from the Stratix
DSP Board EP1S25F780C5 library as a template. Because you are using a
template block, you have to break the link between the template block and
its library to make it stand alone.
LED0 Connector Block
To create a LED0 board connector block for the Nios development board,
Stratix edition, you need to follow these steps:
1.
Drag and drop the LED0 block from the Stratix DSP Board
EP1S25F780C5 library to the myboard.mdl file.
2.
Right-click the LED0 connector block.
3.
Choose Link Options > Disable Link from the pop-up menu.
4.
Right-click the LED0 connector block.
5.
Choose Link Options > Break Link.
6.
Right-click the LED0 block.
7.
Choose Edit Mask to open the Mask Editor.
8.
Click the Parameters tab.
9.
Click DSP Board Library under Prompt.
10. In the Popups box, change the setting to niosboard1S10 as shown in
Figure 12.
18
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Figure 12. Change Parameters for LED0 Connector Block
11. Click the Initialization tab.
12. Change the MATLAB initialization script to niosboard1S10_init and
5 to 1 (this number is the IOComponent variable number). The
command should appear as shown in Figure 13.
Figure 13. Change Initialization Script for LED0 Connector Block
Altera Corporation
19
AN 221: Supporting Custom Boards with DSP Builder
13. Create the niosboard1S10_init.m MATLAB script by updating the
Altera-provided template c:\DSPBuilder\designexamples
\modular_board\walkthrough\myboard_init.m.
a.
Choose Open (File menu).
b.
Choose myboard_init.m (File menu) and click Open.
c.
Change the script parameters after the instructions provided in
the comment section of the template with the values in Table 5.
Table 5. Parameters for niosboard1S10_init MATLAB Script (LED0 Block)
IOComponent number
1
sgn
Single Bit
nodetype
Output Port
bwl
1
bwr
0
rnd
off
sat
off
cst
0
LocPin
Pin_H27
image
led.bmp
componentid
LED0
vis
{’off’,’off’,’off’,’off’,’off’,’off’,’off’,’on’,’off’,’off’}
d.
Change the function name to niosboard1S10_init.
e.
Choose Save (File menu).
f.
Save the file as niosboard1S10_init.m.
g.
Close the file.
1
For details on the parameters, refer to “Parameters” on
page 6.
14. Click the Documentation tab.
20
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
15. Change the Mask description to reflect the connector block of the
Nios development board, Stratix edition:
–
–
–
LED0
Connects to LED0 on the Stratix Nios development board.
LOCATION = Pin_H27;
16. Change the Mask help to reflect the corresponding HTML help page
for the board, nios_board_stratix.html, using the following
command (see Figure 11):
web([’file:///’which(’nios_board_stratix.html’)]);
You can edit the file, which is located at c:\DSPBuilder\
designexamples\modular_board\walkthrough\nios_board_strati
x.html, to include any help information that you want.
Figure 14. Change Mask Description & Help for LED0 Connector Block
17. Click Apply.
18. Click OK to close the Mask Editor.
Altera Corporation
21
AN 221: Supporting Custom Boards with DSP Builder
Other Board Connector Blocks
To create the rest of the connector blocks for the Nios development board,
Stratix edition, perform the same steps described in “LED0 Connector
Block” on page 18 for each block. All board connector blocks share the
same MATLAB script in the Initialization tab, but each connector block
has a unique IOComponent number. Modify the parameters for each
connector block in the MATLAB script based on the information in
Tables 6 through 8.
Additionally, change the mask description in the Documentation tab of
each connector block to reflect the corresponding pin-out and board. The
completed Stratix Nios Development Board Library is shown in
Figure 15.
Table 6. Parameters for LED1 through LED7 Blocks
Parameter
LED1
IOComponent number 2
LED2
LED3
LED4
LED6
LED7
4
5
6
7
8
Pin_L23
Pin_L24
Pin_J25
Pin_J26
Pin_L20
Pin_L19
LED2
LED3
LED4
LED5
LED6
LED7
sgn
Single Bit
nodetype
Output Port
bwl
1
bwr
0
sat
off
rnd
off
cst
0
LocPin
Pin_H28
image
led.bmp
componentid
LED1
vis
{’off’,’off’,’off’,’off’,’off’,’off’,’off’,’on’,’off’,’off’}
22
LED5
3
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
Table 7. Parameters for SW0 through SW3 Blocks
Parameter
SW0
SW1
IOComponent number
9
sgn
Single Bit
nodetype
Input Port
bwl
1
bwr
0
sat
Off
rnd
Off
cst
0
LocPin
Pin_W5
image
switch.bmp
componentid
SWITCH0
vis
{’off’,’off’,’off’,’off’,’off’,’off’,’off’,’on’,’off’,’off’}
SW2
SW3
10
11
12
Pin_W6
Pin_AB2
Pin_AB1
SWITCH1
SWITCH2
SWITCH3
Table 8. Parameters for BCD0 & BCD1 Blocks
Parameter
BCD0
BCD1
IOComponent number
sgn
Signed Integer
nodetype
Output Port
bwl
8
bwr
0
sat
off
rnd
off
cst
0
LocPin
Pin_A18,Pin_C18,Pin_D18,Pin_A19,Pin_ Pin_B18,Pin_B20,Pin_A20,Pin_C20,Pin
B19,Pin_C19,Pin_E19,Pin_D19,
_A21,Pin_B21,Pin_C21,Pin_D21,
image
7SegmentDisplay.bmp
componentid
7SegmentDisplay0
vis
{’off’,’off’,’off’,’off’,’off’,’off’,’off’,’on’,’off’,’off’}
Altera Corporation
7SegmentDisplay1
23
AN 221: Supporting Custom Boards with DSP Builder
Figure 15. Completed Stratix Nios Board EP1S10F780C6ES Library
Add the Library to the Simulink Library Browser
This section describes how to add your newly created library to the
Simulink Library Browser. The c:\DSPBuilder\designexamples
\modular_board\walkthrough directory contains a template slblock.m
MATLAB script. This script defines the block library for the blockset you
have just created. You change the parameters in this script to reflect your
own board library.
1
The slblock.m script must be located in the same directory as the
rest of the files for your custom board library.
For this walkthrough, update the slblock.m script by changing the
parameters after the description and instructions using values from
Table 9.
Table 9. Parameters for slblock MATLAB Script
Parameter
24
Value
blkStruct.Name
[’Stratix Nios Development Board’ sprintf(’\n’) ’Extras’]
blkStruct.OpenFcn
myboard
Browser(1).Library
myboard
Browser(1).Name
Stratix Nios Development Board
Altera Corporation
AN 221: Supporting Custom Boards with DSP Builder
1
The slblock.m script must be in the MATLAB system path for
the library to appear in the Simulink Library Browser. Refer to
the MATLAB path command for more information.
The Stratix Nios Board EP1S10F780C6ES Library appears in the Simulink
Library Browser as shown in Figure 16.
Figure 16. Stratix Nios Board EP1S10F780C6ES Library in Simulink Library
Browser
You can now include blocks from the new library in a Simulink design as
shown in Figure 17.
Altera Corporation
25
AN 221: Supporting Custom Boards with DSP Builder
Figure 17. Example Design using Stratix Nios Board EP1S10F780C6ES Library
Conclusion
DSP Builder is a powerful tool for verifying systems in hardware. Using
this tool, you can target any development board using custom libraries
you create using Altera-provided templates.
References
Simulink – Dynamic System Simulation for MATLAB. The Mathworks.
DSP Builder User Guide. Altera Corporation. San Jose, CA. April 2003.
101 Innovation Drive
San Jose, CA 95134
(408) 544-7000
http://www.altera.com
Applications Hotline:
(800) 800-EPLD
Literature Services:
[email protected]
26
Copyright  2003 Altera Corporation. Altera, The Programmable Solutions Company, the stylized Altera logo,
specific device designations, and all other words and logos that are identified as trademarks and/or service
marks are, unless noted otherwise, the trademarks and service marks of Altera Corporation in the U.S. and
other countries. All other product or service names are the property of their respective holders. Altera products
are protected under numerous U.S. and foreign patents and pending applications, maskwork rights, and
copyrights. Altera warrants performance of its semiconductor products to current
specifications in accordance with Altera’s standard warranty, but reserves the right to
make changes to any products and services at any time without notice. Altera assumes no
responsibility or liability arising out of the application or use of any information, product,
or service described herein except as expressly agreed to in writing by Altera Corporation.
Altera customers are advised to obtain the latest version of device specifications before
relying on any published information and before placing orders for products or services.
All rights reserved.
Altera Corporation