edk 82 mb tutorial

Upload: malaravan-anandan

Post on 07-Apr-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 EDK 82 MB Tutorial

    1/39

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    Objectives

    T h i s t u t o r i a l w i l l d e m o n s t r a t e p r o c e s s o f c r e a t i n g a n d t e s t i n g a M i c r o B l a z e s y s t e m d e s i g n u s i n g t h e E m b e d d e d

    D e v e l o p m e n t K i t ( E D K ) . T h e t u t o r i a l c o n t a i n s t h e s e s e c t i o n s :

    S y s t e m R e q u i r e m e n t s

    M i c r o B l a z e S y s t e m D e s c r i p t i o n

    T u t o r i a l S t e p s

    T h e f o l l o w i n g s t e p s a r e d e s c r i b e d i n t h i s t u t o r i a l :

    S t a r t i n g X P S

    U s i n g t h e B a s e S y s t e m B u i l d e r W i z a r d

    C r e a t e o r I m p o r t I P P e r i p h e r a l

    D e s i g n M o d i f i c a t i o n u s i n g P l a t f o r m S t u d i o

    I m p l e m e n t i n g t h e D e s i g n

    D e f i n i n g t h e S o f t w a r e D e s i g n

    D o w n l o a d i n g t h e D e s i g n

    D e b u g g i n g t h e D e s i g n

    P e r f o r m i n g B e h a v i o r a l S i m u l a t i o n o f t h e E m b e d d e d S y s t e m

    System Requirements

    Y o u m u s t h a v e t h e f o l l o w i n g s o f t w a r e i n s t a l l e d o n y o u r P C t o c o m p l e t e t h i s t u t o r i a l :

    W i n d o w s 2 0 0 0 S P 2 / W i n d o w s X P

    Note: This tutorial can be completed on Linux or Solaris, but the screenshots and directories illustrated inthis tutorial are based on the Windows Platform.

    E D K 8 . 2 i o r l a t e r

    I S E 8 . 2 i s p 1 o r l a t e r

    F a m i l i a r i t y w i t h s t e p s i n t h e X i l i n x I S E 8 I n - D e p t h T u t o r i a l

    h t t p : / / w w w . x i l i n x . c o m / s u p p o r t / t e c h s u p / t u t o r i a l s / t u t o r i a l s 8 . h t m

    I n o r d e r t o d o w n l o a d t h e c o m p l e t e d p r o c e s s o r s y s t e m , y o u m u s t h a v e t h e f o l l o w i n g h a r d w a r e :

    X i l i n x S p a r t a n - 3 E v a l u a t i o n B o a r d ( 3 S 2 0 0 F T 2 5 6 - 4 )

  • 8/6/2019 EDK 82 MB Tutorial

    2/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    2 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    X i l i n x P a r a l l e l - 4 C a b l e u s e d t o p r o g r a m a n d d e b u g t h e d e v i c e

    S e r i a l C a b l e

    Note: It should be noted that other hardware could be used with this tutorial. However, the completed designhas only been verified on the board specified above. The following design changes are required:

    U p d a t e p i n a s s i g n m e n t s i n t h e s y s t e m . u c f f i l e

    U p d a t e b o a r d J T A G c h a i n s p e c i f i e d i n t h e d o w n l o a d . c m d

    MicroBlaze System Description

    I n g e n e r a l , t o d e s i g n a n e m b e d d e d p r o c e s s o r s y s t e m , y o u n e e d t h e f o l l o w i n g :

    H a r d w a r e c o m p o n e n t s

    M e m o r y m a p

    S o f t w a r e a p p l i c a t i o n

    Tutorial Design Hardware

    T h e M i c r o B l a z e ( M B ) t u t o r i a l d e s i g n i n c l u d e s t h e f o l l o w i n g h a r d w a r e c o m p o n e n t s :

    M i c r o B l a z e

    L o c a l M e m o r y B u s ( L M B ) B u s

    L M B _ B R A M _ I F _ C N T L R

    B R A M _ B L O C K

    O n - c h i p P e r i p h e r a l B u s ( O P B ) B U S

    O P B _ M D M

    O P B _ U A R T L I T E

    3 - O P B _ G P I O s

    O P B _ E M C

    Tutorial Design Memory Map

    T h e f o l l o w i n g t a b l e s h o w s t h e m e m o r y m a p f o r t h e t u t o r i a l d e s i g n a s c r e a t e d b y B a s e S y s t e m B u i l d e r .

  • 8/6/2019 EDK 82 MB Tutorial

    3/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    AddressDevice

    Min MaxSize Comment

    L M B _ B R A M 0 x 0 0 0 0 _ 0 0 0 0 0 x 0 0 0 0 _ 1 F F F 8 K b y t e s L M B M e m o r y

    O P B _ M D M 0 x 4 1 4 0 _ 0 0 0 0 0 x 4 1 4 0 _ F F F F 6 4 K b y t e s M D M M o d u l e

    O P B _ U A R T L I T E 0 x 4 0 6 0 _ 0 0 0 0 0 x 4 0 6 0 _ F F F F 6 4 K b y t e s S e r i a l O u t p u t

    O P B _ G P I O 0 x 4 0 0 2 _ 0 0 0 0 0 x 4 0 0 2 _ F F F F 6 4 K b y t e s L E D o u t p u t

    O P B _ G P I O 0 x 4 0 0 0 _ 0 0 0 0 0 x 4 0 0 0 _ F F F F 6 4 K b y t e s P u s h B u t t o n s

    O P B _ G P I O 0 x 4 0 0 4 _ 0 0 0 0 0 x 4 0 0 4 _ F F F F 6 4 K b y t e s D I P s w i t c h e s

    S R A M ( E M C M E M 0 ) 0 x 2 0 1 0 _ 0 0 0 0 0 x 2 0 1 F _ F F F F 5 1 2 K b y t e s S R A M M e m o r y

    T a b l e 1 : Tutorial Design Memory Map

    Tutorial Steps

    SetUp

    S p a r t a n - 3 b o a r d w i t h a R S - 2 3 2 t e r m i n a l c o n n e c t e d t o t h e s e r i a l p o r t a n d c o n f i g u r e d f o r 5 7 6 0 0 b a u d , w i t h

    8 d a t a b i t s , n o p a r i t y a n d n o h a n d s h a k e s .

    Creating the Project File in XPS

    T h e f i r s t s t e p i n t h i s t u t o r i a l i s u s i n g t h e X i l i n x P l a t f o r m S t u d i o ( X P S ) t o c r e a t e a p r o j e c t f i l e . X P S a l l o w s y o u t o

    c o n t r o l t h e h a r d w a r e a n d s o f t w a r e d e v e l o p m e n t o f t h e M i c r o B l a z e s y s t e m , a n d i n c l u d e s t h e f o l l o w i n g :

    A n e d i t o r a n d a p r o j e c t m a n a g e m e n t i n t e r f a c e f o r c r e a t i n g a n d e d i t i n g s o u r c e c o d e

    S o f t w a r e t o o l f l o w c o n f i g u r a t i o n o p t i o n s

    Y o u c a n u s e X P S t o c r e a t e t h e f o l l o w i n g f i l e s :

    P r o j e c t N a v i g a t o r p r o j e c t f i l e t h a t a l l o w s y o u t o c o n t r o l t h e h a r d w a r e i m p l e m e n t a t i o n f l o w

    M i c r o p r o c e s s o r H a r d w a r e S p e c i f i c a t i o n ( M H S ) f i l e

    Note: For more information on the MHS file, refer to theMicroprocessor Hardware Specification (MHS)

    chapterin the Platform Specification Format Reference Manual.

    M i c r o p r o c e s s o r S o f t w a r e S p e c i f i c a t i o n ( M S S ) f i l e

    Note: For more information on the MSS file, refer to theMicroprocessor Software Specification (MSS)chapterin the Platform Specification Format Reference Manual..

    X P S s u p p o r t s t h e s o f t w a r e t o o l f l o w s a s s o c i a t e d w i t h t h e s e s o f t w a r e s p e c i f i c a t i o n s . A d d i t i o n a l l y , y o u c a n u s e

    X P S t o c u s t o m i z e s o f t w a r e l i b r a r i e s , d r i v e r s , a n d i n t e r r u p t h a n d l e r s , a n d t o c o m p i l e y o u r p r o g r a m s .

  • 8/6/2019 EDK 82 MB Tutorial

    4/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    4 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    Starting XPS

    T o o p e n X P S , s e l e c t Start Programs Xilinx Platform Studio 8.2i Xilinx Platform Studio

    S e l e c t B a s e S y s t e m B u i l d e r W i z a r d ( B S B ) t o o p e n t h e C r e a t e N e w P r o j e c t U s i n g B S B W i z a r d d i a l o g b o x

    s h o w n i n F i g u r e 1 .

    C l i c k

    Ok.

    U s e t h e P r o j e c t F i l e Browse b u t t o n t o b r o w s e t o t h e f o l d e r y o u w a n t a s y o u r p r o j e c t d i r e c t o r y .

    C l i c k Opent o c r e a t e t h e s y s t e m . x m p f i l e t h e n Save.

    C l i c k Okt o s t a r t t h e B S B w i z a r d .

    Note: XPS does not support directory or project names which include spaces.

    F i g u r e 1 : C r e a t e N e w P r o j e c t U s i n g B a s e S y s t e m B u i l d e r W i z a r d

    Defining the System Hardware

    MHS and MPD Files

    T h e n e x t s t e p i n t h e t u t o r i a l i s d e f i n i n g t h e e m b e d d e d s y s t e m h a r d w a r e w i t h t h e M i c r o p r o c e s s o r H a r d w a r e

    S p e c i f i c a t i o n ( M H S ) a n d M i c r o p r o c e s s o r P e r i p h e r a l D e s c r i p t i o n ( M P D ) f i l e s .

    MHS File

    T h e M i c r o p r o c e s s o r H a r d w a r e S p e c i f i c a t i o n ( M H S ) f i l e d e s c r i b e s t h e f o l l o w i n g :

    E m b e d d e d p r o c e s s o r : e i t h e r t h e s o f t c o r e M i c r o B l a z e p r o c e s s o r o r t h e h a r d c o r e P o w e r P C ( o n l y a v a i l a b l e

    i n V i r t e x - I I P r o a n d V i r t e x - 4 F X d e v i c e s )

    P e r i p h e r a l s a n d a s s o c i a t e d a d d r e s s s p a c e s

    B u s e s

  • 8/6/2019 EDK 82 MB Tutorial

    5/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    O v e r a l l c o n n e c t i v i t y o f t h e s y s t e m

    T h e M H S f i l e i s a r e a d a b l e t e x t f i l e t h a t i s a n i n p u t t o t h e P l a t f o r m G e n e r a t o r ( t h e h a r d w a r e s y s t e m b u i l d i n g t o o l ) .

    C o n c e p t u a l l y , t h e M H S f i l e i s a t e x t u a l s c h e m a t i c o f t h e e m b e d d e d s y s t e m . T o i n s t a n t i a t e a c o m p o n e n t i n t h e

    M H S f i l e , y o u m u s t i n c l u d e i n f o r m a t i o n s p e c i f i c t o t h e c o m p o n e n t .

    MPD File

    E a c h s y s t e m p e r i p h e r a l h a s a c o r r e s p o n d i n g M P D f i l e . T h e M P D f i l e i s t h e s y m b o l o f t h e e m b e d d e d s y s t e m

    p e r i p h e r a l t o t h e M H S s c h e m a t i c o f t h e e m b e d d e d s y s t e m . T h e M P D f i l e c o n t a i n s a l l o f t h e a v a i l a b l e p o r t s a n d

    h a r d w a r e p a r a m e t e r s f o r a p e r i p h e r a l . T h e t u t o r i a l M P D f i l e i s l o c a t e d i n t h e f o l l o w i n g d i r e c t o r y :

    $ X I L I N X _ E D K / h w / X i l i n x P r o c e s s o r I P L i b / p c o r e s / < p e r i p h e r a l _ n a m e > / d a t a

    Note: For more information on the MPD and MHS files, refer to theMicroprocessor Peripheral Description(MPD)andMicroprocessor Hardware Specification (MHS) chaptersin the Embedded System Tools Guide.

    E D K p r o v i d e s t w o m e t h o d s f o r c r e a t i n g t h e M H S f i l e . B a s e S y s t e m B u i l d e r W i z a r d a n d t h e A d d / E d i t C o r e s D i a l o g

    a s s i s t y o u i n b u i l d i n g t h e p r o c e s s o r s y s t e m , w h i c h i s d e f i n e d i n t h e M H S f i l e . T h i s t u t o r i a l i l l u s t r a t e s t h e B a s e

    S y s t e m B u i l d e r .

    Using the Base System Builder Wizard

    U s e t h e f o l l o w i n g s t e p s t o c r e a t e t h e p r o c e s s o r s y s t e m :

    I n t h e B a s e S y s t e m B u i l d e r S e l e c t I w o u l d l i k e t o c r e a t e a n e w d e s i g n t h e n c l i c k Next.

    I n t h e B a s e S y s t e m B u i l d e r - S e l e c t B o a r d D i a l o g s e l e c t t h e f o l l o w i n g , a s s h o w n i n F i g u r e 2 :

    B o a r d V e n d o r: X i l i n x

    B o a r d N a m e: S p a r t a n - 3 S t a r t e r B o a r d

    B o a r d R e v i s i o n: E

  • 8/6/2019 EDK 82 MB Tutorial

    6/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    6 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    Figure 2: BSB: Select a Board

    C l i c k Next. M i c r o B l a z e i s t h e o n l y p r o c e s s o r o p t i o n f o r t h i s b o a r d .

    C l i c k Next. Y o u w i l l n o w s p e c i f y s e v e r a l p r o c e s s o r o p t i o n s a s s h o w n i n F i g u r e 3 :

  • 8/6/2019 EDK 82 MB Tutorial

    7/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    F i g u r e 3 : Configure Processor

    T h e f o l l o w i n g i s a n e x p l a n a t i o n o f t h e s e t t i n g s s p e c i f i e d i n F i g u r e 3 :

    S y s t e m W i d e S e t t i n g :

    R e f e r e n c e c l o c k f r e q u e n c y : T h i s i s t h e o n b o a r d f r e q u e n c y o f t h e c l o c k .

    P r o c e s s o r - B u s c l o c k f r e q u e n c y : T h i s i s t h e f r e q u e n c y o f t h e c l o c k d r i v i n g t h e p r o c e s s o r s y s t e m .

    P r o c e s s o r C o n f i g u r a t i o n :

    D e b u g I / F :

    O n - C h i p H / W D e b u g m o d u l e : W h e n t h e H / W d e b u g m o d u l e i s s e l e c t e d ; a n O P B M D M m o d u l e i s

    i n c l u d e d i n t h e h a r d w a r e s y s t e m . T h i s i n t r o d u c e s h a r d w a r e i n t r u s i v e d e b u g g i n g w i t h n o s o f t w a r e

    s t u b r e q u i r e d . T h i s i s t h e r e c o m m e n d e d w a y o f d e b u g g i n g f o r M i c r o B l a z e s y s t e m .

    X M D w i t h S / W D e b u g s t u b : S e l e c t i n g t h i s m o d e o f d e b u g g i n g i n t e r f a c e i n t r o d u c e s a s o f t w a r e

    i n t r u s i v e d e b u g g i n g . T h e r e i s a 1 2 0 0 - b y t e s t u b t h a t i s l o c a t e d a t 0 x 0 0 0 0 0 0 0 0 . T h i s s t u b

    c o m m u n i c a t e s w i t h t h e d e b u g g e r o n t h e h o s t t h r o u g h t h e J T A G i n t e r f a c e o f t h e O P B M D M

    m o d u l e .

    N o D e b u g : N o d e b u g i s t u r n e d o n .

    Note: For more information about the Xilinx Microprocessor Debugger (XMD), refer to theXilinx

  • 8/6/2019 EDK 82 MB Tutorial

    8/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    8 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    Microprocessor Debugger (XMD) chapterin the Embedded System ToolsReference Manual.

    U s e r s c a n s p e c i f y t h e s i z e o f t h e l o c a l i n s t r u c t i o n a n d d a t a m e m o r y .

    C a c h e s e t u p :

    N o C a c h e : N o c a c h i n g w i l l b e u s e d

    E n a b l e O P B c a c h e : C a c h i n g w i l l b e u s e d t h r o u g h t h e O P B b u s

    E n a b l e c a c h e l i n k : C a c h i n g w i l l b e u s e d t h r o u g h t h e F S L b u s

    Y o u c a n a l s o s p e c i f y t h e u s e o f t h e f l o a t i n g p o i n t u n i t ( F P U ) .

    C l i c k Next.

    S e l e c t t h e p e r i p h e r a l s u b s e t a s s h o w n i n F i g u r e 4 a n d F i g u r e 5 . I t s h o u l d b e n o t e d t h a t t h e n u m b e r o f p e r i p h e r a l

    s h o w n o n e a c h d i a l o g b o x i s d y n a m i c b a s e d u p o n y o u r c o m p u t e r s r e s o l u t i o n .

    Note: The Baud rate for the OPB UARTLITE must be updated to 57600.

    F i g u r e 4 : Configure I/O Interfaces

  • 8/6/2019 EDK 82 MB Tutorial

    9/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    O P B U A R T L I T E b a u d r a t e 5 7 6 0 0

    L E D _ 7 S E G M E N T p e r i p h e r a l deselect

    C l i c k Next

    F i g u r e 5 : Configure Additional I/O Interfaces

    C l i c k Next o n t h e s e c o n d C o n f i g u r e A d d i t i o n a l I O I n t e r f a c e s p a g e .

    C l i c k Nextt h r o u g h t h e A d d I n t e r n a l P e r i p h e r a l s p a g e a s w e w i l l n o t a d d a n y i n t h i s e x a m p l e .

    T h i s c o m p l e t e s t h e h a r d w a r e s p e c i f i c a t i o n a n d w e w i l l n o w c o n f i g u r e t h e s o f t w a r e s e t t i n g s .

    U s i n g t h e S o f t w a r e S e t u p d i a l o g b o x a s s h o w n i n F i g u r e 6 , s p e c i f y t h e f o l l o w i n g s o f t w a r e s e t t i n g s :

    S t a n d a r d I n p u t ( S T D I N ) R S 2 3 2

    S t a n d a r d O u t p u t ( S T D O U T ) R S 2 3 2

    S a m p l e A p p l i c a t i o n S e l e c t i o n M e m o r y T e s t

  • 8/6/2019 EDK 82 MB Tutorial

    10/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    10 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 6 : S o f t w a r e S e t u p

    C l i c k Next.

  • 8/6/2019 EDK 82 MB Tutorial

    11/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    F i g u r e 7 : C o n f i g u r e M e m o r y T e s t A p p l i c a t i o n

    U s i n g t h e C o n f i g u r e M e m o r y T e s t A p p l i c a t i o n d i a l o g b o x a s s h o w n i n F i g u r e 7 , s p e c i f y t h e f o l l o w i n g s o f t w a r e

    s e t t i n g s :

    I n s t r u c t i o n s i l m b _ c n t l r

    D a t a d l m b _ c n t l r

    S t a c k / H e a p d l m b _ c n t l r

    C l i c k Next.

    T h e c o m p l e t e d s y s t e m i n c l u d i n g t h e m e m o r y m a p w i l l b e d i s p l a y e d a s s h o w n i n F i g u r e 8 . C u r r e n t l y t h e m e m o r y

    m a p c a n n o t b e c h a n g e d o r u p d a t e d i n t h e B S B . I f y o u w a n t t o c h a n g e t h e m e m o r y m a p y o u c a n d o t h i s i n X P S .

  • 8/6/2019 EDK 82 MB Tutorial

    12/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    12 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 8 : C o m p l e t e d P r o c e s s o r S y s t e m

    C l i c k Generatea n d t h e n Finish, t o c o m p l e t e t h e d e s i g n .

    S e l e c t S t a r t U s i n g P l a t f o r m S t u d i o a n d c l i c k OK.

    Review

    T h e B a s e S y s t e m B u i l d e r W i z a r d h a s c r e a t e d t h e h a r d w a r e a n d s o f t w a r e s p e c i f i c a t i o n f i l e s t h a t d e f i n e t h e

    p r o c e s s o r s y s t e m . W h e n w e l o o k a t t h e p r o j e c t d i r e c t o r y , s h o w n i n F i g u r e 9 , w e s e e t h e s e a s s y s t e m . m h s a n d

    s y s t e m . m s s . T h e r e a r e a l s o s o m e d i r e c t o r i e s c r e a t e d .

    d a t a c o n t a i n s t h e U C F ( u s e r c o n s t r a i n t s f i l e ) f o r t h e t a r g e t b o a r d .

    e t c c o n t a i n s s y s t e m s e t t i n g s f o r J T A G c o n f i g u r a t i o n o n t h e b o a r d t h a t i s u s e d w h e n d o w n l o a d i n g t h e

    b i t f i l e a n d t h e d e f a u l t p a r a m e t e r s t h a t a r e p a s s e d t o t h e I S E t o o l s .

    p c o r e s i s e m p t y r i g h t n o w , b u t i s u t i l i z e d f o r c u s t o m p e r i p h e r a l s .

  • 8/6/2019 EDK 82 MB Tutorial

    13/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    T e s t A p p _ M e m o r y c o n t a i n s a u s e r a p p l i c a t i o n i n C c o d e s o u r c e , f o r t e s t i n g t h e m e m o r y i n t h e s y s t e m .

    F i g u r e 9 : P r o j e c t D i r e c t o r y

    Project Options

    T o s e e t h e p r o j e c t o p t i o n s t h a t B a s e S y s t e m B u i l d e r h a s c o n f i g u r e d s e l e c t :

    Project

    Project Options.A s

    s h o w n i n F i g u r e 1 0 , t h e d e v i c e i n f o r m a t i o n i s s p e c i f i e d .

    F i g u r e 1 0 : P r o j e c t O p t i o n s - D e v i c e a n d R e p o s i t o r y

    S e l e c t : Hierarchy and Flow. T h i s w i n d o w i s s h o w n i n F i g u r e 1 1 . T h i s w i n d o w p r o v i d e s t h e o p p o r t u n i t y t o e x p o r t

    t h e p r o c e s s o r s y s t e m i n t o a n I S E p r o j e c t a s e i t h e r t h e t o p l e v e l s y s t e m o r a s u b - m o d u l e d e s i g n .

  • 8/6/2019 EDK 82 MB Tutorial

    14/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    14 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 1 1 : P r o j e c t O p t i o n s - H i e r a r c h y a n d F l o w

    Create or Import IP PeripheralO n e o f t h e k e y a d v a n t a g e s o f b u i l d i n g a n e m b e d d e d s y s t e m i n a n F G P A i s t h e a b i l i t y t o i n c l u d e c u s t o m e r I P a n d

    i n t e r f a c e t h a t I P t o t h e p r o c e s s o r . T h i s s e c t i o n o f t h e t u t o r i a l w i l l w a l k t h r o u g h t h e s t e p s n e c e s s a r y t o i n c l u d e a

    c u s t o m I P c o r e .

    I n X P S , s e l e c t Hardware Create or Import Peripheral t o o p e n t h e C r e a t e a n d I m p o r t P e r i p h e r a l

    W i z a r d .

    C l i c k Next. S e l e c t Create templates for a new peripheral.

    B y d e f a u l t t h e n e w p e r i p h e r a l w i l l b e s t o r e d i n t h e p r o j e c t _ d i r e c t o r y / p c o r e s d i r e c t o r y . T h i s e n a b l e s X P S t o f i n d t h e

    c o r e f o r u t i l i z a t i o n d u r i n g t h e e m b e d d e d s y s t e m d e v e l o p m e n t .

    C l i c k Next. I n t h e C r e a t e P e r i p h e r a l N a m e a n d V e r s i o n d i a l o g , e n t e r c u s t o m _ i p a s t h e n a m e o f t h e

    p e r i p h e r a l . T h i s i s s h o w n i n F i g u r e 1 2 .

  • 8/6/2019 EDK 82 MB Tutorial

    15/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    F i g u r e 1 2 : C r e a t e P e r i p h e r a l - N a m e a n d V e r s i o n

    C l i c k Next. I n t h e C r e a t e P e r i p h e r a l B u s I n t e r f a c e d i a l o g , s e l e c t O n - C h i p P e r i p h e r a l B u s ( O P B ) , a s t h i s

    i s t h e b u s t o w h i c h t h e n e w p e r i p h e r a l w i l l b e c o n n e c t e d .

    C l i c k Next. T h e C r e a t e P e r i p h e r a l I P I F S e r v i c e s d i a l o g e n a b l e s t h e s e l e c t i o n o f s e v e r a l s e r v i c e s . F o r

    a d d i t i o n a l i n f o r m a t i o n r e g a r d i n g e a c h o f t h e s e s e r v i c e s , s e l e c t M o r e I n f o . S e l e c t t h e U s e r l o g i c S / W

    r e g i s t e r s u p p o r t o p t i o n .

  • 8/6/2019 EDK 82 MB Tutorial

    16/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    16 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 1 3 : C r e a t e P e r i p h e r a l - I P I F S e r v i c e s

    C l i c k Next. I n t h e C r e a t e P e r i p h e r a l U s e r S / W R e g i s t e r d i a l o g , c h a n g e t h e N u m b e r o f s o f t w a r e

    a c c e s s i b l e r e g i s t e r s t o 4 .

    F i g u r e 1 4 : C r e a t e P e r i p h e r a l - U s e r S / W R e g i s t e r

  • 8/6/2019 EDK 82 MB Tutorial

    17/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    C l i c k Next. I n t h e C r e a t e P e r i p h e r a l I P I n t e r c o n n e c t ( I P I C ) .

    C l i c k Next. I n t h e C r e a t e P e r i p h e r a l ( O P T I O N A L ) P e r i p h e r a l S i m u l a t i o n S u p p o r t d i a l o g , a B u s

    F u n c t i o n a l M o d e l ( B F M ) s i m u l a t i o n e n v i r o n m e n t c a n b e g e n e r a t e d . T h i s t u t o r i a l w i l l n o t c o v e r B F M

    s i m u l a t i o n . L e a v e t h e o p t i o n u n c h e c k e d .

    C l i c k Next. I n t h e C r e a t e P e r i p h e r a l ( O P T I O N A L ) P e r i p h e r a l I m p l e m e n t a t i o n S u p p o r t d i a l o g , u n c h e c k

    t h e G e n e r a t e I S E a n d X S T p r o j e c t f i l e s t o h e l p y o u i m p l e m e n t t h e p e r i p h e r a l u s i n g X S T f l o w .

    C l i c k Next a n d t h e n Finish.

    T h e C r e a t e o r I m p o r t P e r i p h e r a l W i z a r d c r e a t e s a n e w d i r e c t o r y c a l l e d c u s t o m _ i p _ v 1 _ 0 0 _ a i n t h e p c o r e s

    d i r e c t o r y . T h i s n e w d i r e c t o r y c o n t a i n s t h e f o l l o w i n g :

    F i g u r e 1 5 : C u s t o m I P D i r e c t o r y S t r u c t u r e

    T h e f o l l o w i n g i s a d e s c r i p t i o n o f t h e f i l e s l o c a t e d i n e a c h d i r e c t o r y :

    H D L s o u r c e f i l e ( s )

    M B _ t u t o r i a l \ p c o r e s \ c u s t o m _ i p _ v 1 _ 0 0 _ a \ h d l

    v h d l / c u s t o m _ i p . v h d

    T h i s i s t h e t e m p l a t e f i l e f o r y o u r p e r i p h e r a l ' s t o p d e s i g n e n t i t y . I t c o n f i g u r e s a n d i n s t a n t i a t e s t h e

    c o r r e s p o n d i n g I P I F u n i t i n t h e w a y y o u i n d i c a t e d i n t h e w i z a r d G U I a n d c o n n e c t s i t t o t h e s t u b

    u s e r l o g i c w h e r e t h e u s e r l o g i c s h o u l d g e t i m p l e m e n t e d . Y o u a r e n o t e x p e c t e d t o m o d i f y t h i s

    t e m p l a t e f i l e e x c e p t i n c e r t a i n m a r k e d p l a c e s f o r a d d i n g u s e r s p e c i f i c g e n e r i c s a n d p o r t s .

    v h d l / u s e r _ l o g i c . v h d

    T h i s i s t h e t e m p l a t e f i l e f o r t h e s t u b u s e r l o g i c d e s i g n e n t i t y , e i t h e r i n V H D L o r V e r i l o g , w h e r e t h e

    a c t u a l f u n c t i o n a l i t i e s s h o u l d g e t i m p l e m e n t e d . S o m e s a m p l e c o d e m a y b e p r o v i d e d f o r

    d e m o n s t r a t i o n p u r p o s e .

    X P S i n t e r f a c e f i l e ( s )

    M B _ t u t o r i a l \ p c o r e s \ c u s t o m _ i p _ v 1 _ 0 0 _ a \ d a t a

    c u s t o m _ i p _ v 2 _ 1 _ 0 . m p d

  • 8/6/2019 EDK 82 MB Tutorial

    18/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    18 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    T h i s M i c r o p r o c e s s o r P e r i p h e r a l D e s c r i p t i o n f i l e c o n t a i n s i n t e r f a c e i n f o r m a t i o n o f y o u r p e r i p h e r a l

    s o t h a t o t h e r E D K t o o l s c a n r e c o g n i z e t h e p e r i p h e r a l .

    c u s t o m _ i p _ v 2 _ 1 _ 0 . p a o

    T h i s P e r i p h e r a l A n a l y s i s O r d e r f i l e d e f i n e s t h e a n a l y s i s o r d e r o f a l l t h e H D L s o u r c e f i l e s t h a t a r e

    u s e d t o c o m p i l e y o u r p e r i p h e r a l .

    D r i v e r s o u r c e f i l e ( s )

    M B _ t u t o r i a l \ d r i v e r s \ c u s t o m _ i p _ v 1 _ 0 0 _ a \ s r c :

    c u s t o m _ i p . h

    T h i s i s t h e s o f t w a r e d r i v e r h e a d e r t e m p l a t e f i l e , w h i c h c o n t a i n s a d d r e s s o f f s e t s o f

    s o f t w a r e a d d r e s s a b l e r e g i s t e r s i n y o u r p e r i p h e r a l , a s w e l l a s s o m e c o m m o n m a s k s ,

    s i m p l e r e g i s t e r a c c e s s m a c r o s a n d f u n c t i o n d e c l a r a t i o n s .

    c u s t o m _ i p . c

    T h i s i s t h e s o f t w a r e d r i v e r s o u r c e t e m p l a t e f i l e t o d e f i n e a l l a p p l i c a b l e d r i v e r f u n c t i o n s .

    c u s t o m _ i p _ s e l f t e s t . c

    T h i s i s t h e s o f t w a r e d r i v e r s e l f t e s t e x a m p l e f i l e w h i c h c o n t a i n s e l f t e s t e x a m p l e c o d e t o

    t e s t v a r i o u s h a r d w a r e f e a t u r e s o f y o u r p e r i p h e r a l .

    m a k e f i l e

    T h i s i s t h e s o f t w a r e d r i v e r m a k e f i l e t o c o m p i l e d r i v e r s .

    N o w t h a t t h e t e m p l a t e h a s b e e n c r e a t e d , t h e u s e r _ l o g i c . v h d f i l e m u s t b e m o d i f i e d t o i n c o r p o r a t e t h e c u s t o m I P

    f u n c t i o n a l i t y .

    O p e n u s e r _ l o g i c . v h d . C u r r e n t l y t h e c o d e p r o v i d e s a n e x a m p l e o f r e a d i n g a n d w r i t i n g t o f o u r 3 2 - b i t

    r e g i s t e r s . F o r t h e p u r p o s e o f t h i s t u t o r i a l , t h i s c o d e w i l l n o t b e m o d i f i e d .

    C l o s e u s e r _ l o g i c . v h d

    I n o r d e r f o r X P S t o a d d t h e n e w c u s t o m I P c o r e t o t h e d e s i g n , t h e p c o r e s d i r e c t o r y m u s t b e r e s c a n n e d . T h i s c a n

    b e a c c o m p l i s h e d b y s e l e c t i n g ProjectRescan User Repositories. X P S a l s o a u t o m a t i c a l l y r e s c a n s t h e

    p c o r e s d i r e c t o r y w h e n t h e p r o j e c t i s o p e n e d .

    Design Modification using Platform Studio

    O n c e a d e s i g n h a s b e e n c r e a t e d w i t h t h e B a s e S y s t e m B u i l d e r , i t c a n b e m o d i f i e d f r o m w i t h i n t h e S y s t e m

    A s s e m b l y v i e w .

  • 8/6/2019 EDK 82 MB Tutorial

    19/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    F i g u r e 1 6 : S y s t e m A s s e m b l y V i e w

    D o u b l e c l i c k i n g o n a n y o f t h e I P s l i s t e d i n t h e S y s t e m A s s e m b l y V i e w a l l o w s m o d i f i c a t i o n o f t h a t p a r t i c u l a r I P .

    T h e S y s t e m A s s e m b l y V i e w h a s t h e f o l l o w i n g f i l t e r s :

    B u s I n t e r f a c e f i l t e r : W i t h t h e B u s I n t e r f a c e a c t i v a t e d , t h e p a t c h p a n e l t o t h e l e f t o f t h e S y s t e m A s s e m b l y V i e w g e t s

    a c t i v a t e d . T h e b u s c o n n e c t i v i t y o f t h e c o r e i s s h o w n w h e n t h e h i e r a r c h y o f t h e I P i s e x p a n d e d .

    P o r t s f i l t e r : W i t h t h i s f i l t e r o n , t h e p o r t c o n n e c t i o n s a p p e a r w h e n t h e h i e r a r c h y o f t h e I P i s e x p a n d e d . Y o u

    n e e d t o a c t i v a t e t h i s f i l t e r t o b e a b l e t o a d d e x t e r n a l p o r t s .

    A d d r e s s e s f i l t e r : T h e I P s a d d r e s s e s c a n b e v i e w e d w h e n e x p a n d i n g t h e I P . T h i s i s w h e r e y o u c a n g e n e r a t e

    a d d r e s s e s f o r t h e I P s .

    T h e I P C a t a l o g t a b s h o w s a l l o f t h e I P t h a t i s a v a i l a b l e t o u s e i n t h e E D K p r o j e c t . T o a d d n e w I P :

    B r i n g t h e I P C a t a l o g t a b f o r w a r d .

    E x p a n d t h e P r o j e c t R e p o s i t o r y h i e r a r c h y

    D r a g a n d d r o p t h e I P i n t o t h e S y s t e m A s s e m b l y V i e w o r d o u b l e c l i c k o n t h e I P .

  • 8/6/2019 EDK 82 MB Tutorial

    20/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    20 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 1 7 : I n s e r t i n g I P

    W i t h t h e B u s I n t e r f a c e f i l t e r s t i l l a c t i v a t e d :

    P r e s s t h e C o n n e c t i o n F i l t e r b u t t o n a n d s e l e c t A l l

    E x p a n d t h e c u s t o m _ i p _ 0 i n s t a n c e

    H i g h l i t e t h e s l a v e O P B c o n n e c t i o n ( S O P B )

    S e l e c t t h e N o C o n n e c t i o n p u l l d o w n m e n u a n d c h a n g e i t t o m b _ o p b

    F i g u r e 1 8 : M o d i f y i n g b u s c o n n e c t i o n s

  • 8/6/2019 EDK 82 MB Tutorial

    21/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    N o w s e l e c t t h e P o r t s f i l t e r

    P r e s s t h e C o n n e c t i o n F i l t e r b u t t o n a n d s e l e c t A l l

    E x p a n d t h e c u s t o m _ i p _ 0 i n s t a n c e

    H i g h l i t e t h e O P B _ C l k p o r t

    S e l e c t t h e D e f a u l t C o n n e c t i o n p u l l d o w n m e n u a n d c h a n g e t h e c l o c k c o n n e c t i o n t o s y s _ c l k _ s

    F i g u r e 1 9 : C h a n g i n g p o r t c o n n e c t i o n s

    Note: Right clicking on the Name column in the System Assembly View provides more filtering options.

    S e l e c t t h e A d d r e s s e s f i l t e r t o d e f i n e a n a d d r e s s f o r t h e n e w l y a d d e d c u s t o m _ i p p e r i p h e r a l . T h e a d d r e s s c a n b e

    a s s i g n e d b y e n t e r i n g t h e B a s e A d d r e s s o r t h e t o o l c a n a s s i g n a n a d d r e s s . F o r t h e p u r p o s e o f t h i s t u t o r i a l , t h e t o o l

    w i l l b e u s e d t o a s s i g n a n a d d r e s s .

    C h a n g e t h e s i z e i f t h e d l m b _ c n t l r a n d i l m b _ c n t l r t o 8 K .

    C l i c k Generate Addresses.

    A m e s s a g e i n t h e c o n s o l e w i n d o w w i l l s t a t e t h a t t h e a d d r e s s m a p h a s b e e n g e n e r a t e d s u c c e s s f u l l y . T h e d e s i g n i s

    n o w r e a d y t o b e i m p l e m e n t e d .

    Implementing the DesignN o w t h a t t h e h a r d w a r e h a s b e e n c o m p l e t e l y s p e c i f i e d i n t h e M H S f i l e , y o u c a n r u n t h e P l a t f o r m G e n e r a t o r .

    P l a t f o r m G e n e r a t o r e l a b o r a t e s t h e M H S f i l e i n t o a h a r d w a r e s y s t e m c o n s i s t i n g o f N G C f i l e s t h a t r e p r e s e n t t h e

    p r o c e s s o r s y s t e m . T h e n t h e X i l i n x I S E t o o l s w i l l b e c a l l e d t o i m p l e m e n t t h e d e s i g n f o r t h e t a r g e t b o a r d . T o

    g e n e r a t e a n e t l i s t a n d c r e a t e t h e b i t f i l e , f o l l o w t h e s e s t e p s :

    S t a r t I S E b y s e l e c t i n g S t a r t P r o g r a m s X i l i n x I S E 8 . 2 i P r o j e c t N a v i g a t o r .

    I n I S E , s e l e c t File New Projectt o c r e a t e a n e w P r o j e c t N a v i g a t o r p r o j e c t .

  • 8/6/2019 EDK 82 MB Tutorial

    22/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    22 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    I n t h e N e w P r o j e c t d i a l o g b o x s h o w n i n F i g u r e 2 0 , b r o w s e t o t h e X P S p r o j e c t d i r e c t o r y a n d t h e n e n t e r t h e

    P r o j e c t N a m e , p r o j e c t _ n a v i g a t o r .

    F i g u r e 2 0 : I S E N e w P r o j e c t

    C l i c k Next. C o n f i g u r e t h e D e v i c e a n d D e s i g n f l o w a s s h o w n i n F i g u r e 2 1 . I t s h o u l d b e n o t e d t h a t t h e s e

    s e t t i n g s n e e d t o b e c o n s i s t e n t w i t h t h e X P S p r o j e c t s e t t i n g s .

  • 8/6/2019 EDK 82 MB Tutorial

    23/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    F i g u r e 2 1 : N e w P r o j e c t - D e v i c e a n d D e s i g n F l o w

    C l i c k Next. I S E h a s t h e a b i l i t y t o a d d a n X P S p r o j e c t f i l e a s a n e w s o u r c e f i l e . H o w e v e r , t h e t u t o r i a l w i l l

    n o t c o v e r t h i s a s p e c t .

    B r o w s e u p i n t o t h e X P S p r o j e c t a n d a d d t h e s y s t e m . x m p i n t h e N e w P r o j e c t W i z a r d - A d d E x i s t i n g

    S o u r c e s d i a l o g w i n d o w .

    D e s e l e c t t h e C o p y t o P r o j e c t c h e c k b o x

    C l i c k Next

    C l i c k Finish

    C l i c k OK

    S e l e c t t h e s y s t e m . x m p s o u r c e f i l e a n d d o u b l e c l i c k o n t h e V i e w H D L I n s t a n t i a t i o n T e m p l a t e .

    O n c e t h e p r o c e s s h a s c o m p l e t e d t h e e d i t o r w i n d o w w i l l c o n t a i n t h e i n s t a n t i a t i o n t e m p l a t e c a l l e d s y s t e m . v h i .

    I n I S E , s e l e c t Project New Source. S e l e c t t h e V H D L m o d u l e a n d n a m e i t s y s t e m _ s t u b . v h d i n

    t h e p r o j e c t _ n a v i g a t o r d i r e c t o r y . T h e n i n s t a n t i a t e t h e s y s t e m . v h i i n t o s y s t e m _ s t u b . v h d :

    l i b r a r y I E E E ;

    u s e I E E E . S T D _ L O G I C _ 1 1 6 4 . A L L ;

    u s e I E E E . S T D _ L O G I C _ A R I T H . A L L ;

  • 8/6/2019 EDK 82 MB Tutorial

    24/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    24 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    u s e I E E E . S T D _ L O G I C _ U N S I G N E D . A L L ;

    - - - - U n c o m m e n t t h e f o l l o w i n g l i b r a r y d e c l a r a t i o n i f i n s t a n t i a t i n g

    - - - - a n y X i l i n x p r i m i t i v e s i n t h i s c o d e .

    - - l i b r a r y U N I S I M ;

    - - u s e U N I S I M . V C o m p o n e n t s . a l l ;

    e n t i t y s y s t e m _ s t u b i s

    p o r t (

    f p g a _ 0 _ R S 2 3 2 _ R X _ p i n : i n s t d _ l o g i c ;

    f p g a _ 0 _ R S 2 3 2 _ T X _ p i n : o u t s t d _ l o g i c ;

    f p g a _ 0 _ L E D s _ 8 B i t _ G P I O _ d _ o u t _ p i n : o u t s t d _ l o g i c _ v e c t o r ( 0 t o 7 ) ;

    f p g a _ 0 _ P u s h _ B u t t o n s _ 3 B i t _ G P I O _ i n _ p i n : i n s t d _ l o g i c _ v e c t o r ( 0 t o 2 ) ;

    f p g a _ 0 _ D I P _ S w i t c h e s _ 8 B i t _ G P I O _ i n _ p i n : i n s t d _ l o g i c _ v e c t o r ( 0 t o 7 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ A _ p i n : o u t s t d _ l o g i c _ v e c t o r ( 1 2 t o 2 9 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ D Q _ p i n : i n o u t s t d _ l o g i c _ v e c t o r ( 0 t o 3 1 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ O E N _ p i n : o u t s t d _ l o g i c _ v e c t o r ( 0 t o 0 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ p i n : o u t s t d _ l o g i c _ v e c t o r ( 0 t o 0 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ 1 _ p i n : o u t s t d _ l o g i c _ v e c t o r ( 0 t o 0 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ W E N _ p i n : o u t s t d _ l o g i c ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ B E N _ p i n : o u t s t d _ l o g i c _ v e c t o r ( 0 t o 3 ) ;

    s y s _ c l k _ p i n : i n s t d _ l o g i c ;

    s y s _ r s t _ p i n : i n s t d _ l o g i c

    ) ;

    e n d s y s t e m _ s t u b ;

    a r c h i t e c t u r e B e h a v i o r a l o f s y s t e m _ s t u b i s

    C O M P O N E N T s y s t e m

    P O R T (

  • 8/6/2019 EDK 82 MB Tutorial

    25/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    f p g a _ 0 _ R S 2 3 2 _ R X _ p i n : I N s t d _ l o g i c ;

    f p g a _ 0 _ P u s h _ B u t t o n s _ 3 B i t _ G P I O _ i n _ p i n : I N s t d _ l o g i c _ v e c t o r ( 0 t o 2 ) ;

    f p g a _ 0 _ D I P _ S w i t c h e s _ 8 B i t _ G P I O _ i n _ p i n : I N s t d _ l o g i c _ v e c t o r ( 0 t o 7 ) ;

    s y s _ c l k _ p i n : I N s t d _ l o g i c ;

    s y s _ r s t _ p i n : I N s t d _ l o g i c ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ D Q _ p i n : I N O U T s t d _ l o g i c _ v e c t o r ( 0 t o 3 1 ) ;

    f p g a _ 0 _ R S 2 3 2 _ T X _ p i n : O U T s t d _ l o g i c ;

    f p g a _ 0 _ L E D s _ 8 B i t _ G P I O _ d _ o u t _ p i n : O U T s t d _ l o g i c _ v e c t o r ( 0 t o 7 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ A _ p i n : O U T s t d _ l o g i c _ v e c t o r ( 1 2 t o 2 9 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ O E N _ p i n : O U T s t d _ l o g i c _ v e c t o r ( 0 t o 0 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ p i n : O U T s t d _ l o g i c _ v e c t o r ( 0 t o 0 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ 1 _ p i n : O U T s t d _ l o g i c _ v e c t o r ( 0 t o 0 ) ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ W E N _ p i n : O U T s t d _ l o g i c ;

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ B E N _ p i n : O U T s t d _ l o g i c _ v e c t o r ( 0 t o 3 )

    ) ;

    E N D C O M P O N E N T ;

    b e g i n

    I n s t _ s y s t e m : s y s t e m P O R T M A P (

    f p g a _ 0 _ R S 2 3 2 _ R X _ p i n = > f p g a _ 0 _ R S 2 3 2 _ R X _ p i n ,

    f p g a _ 0 _ R S 2 3 2 _ T X _ p i n = > f p g a _ 0 _ R S 2 3 2 _ T X _ p i n ,

    f p g a _ 0 _ L E D s _ 8 B i t _ G P I O _ d _ o u t _ p i n = > f p g a _ 0 _ L E D s _ 8 B i t _ G P I O _ d _ o u t _ p i n ,

    f p g a _ 0 _ P u s h _ B u t t o n s _ 3 B i t _ G P I O _ i n _ p i n = > f p g a _ 0 _ P u s h _ B u t t o n s _ 3 B i t _ G P I O _ i n _ p i n ,

    f p g a _ 0 _ D I P _ S w i t c h e s _ 8 B i t _ G P I O _ i n _ p i n = > f p g a _ 0 _ D I P _ S w i t c h e s _ 8 B i t _ G P I O _ i n _ p i n ,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ A _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ A _ p i n ,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ D Q _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ D Q _ p i n ,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ O E N _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ O E N _ p i n ( 0 t o 0 ) ,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ p i n ( 0 t o 0 ) ,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ 1 _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ C E N _ 1 _ p i n ( 0 t o 0 ) ,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ W E N _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ W E N _ p i n ,

  • 8/6/2019 EDK 82 MB Tutorial

    26/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    26 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ B E N _ p i n = > f p g a _ 0 _ S R A M _ 2 5 6 K x 3 2 _ M e m _ B E N _ p i n ,

    s y s _ c l k _ p i n = > s y s _ c l k _ p i n ,

    s y s _ r s t _ p i n = > s y s _ r s t _ p i n

    ) ;

    e n d B e h a v i o r a l ;

    B y c r e a t i n g s y s t e m _ s t u b . v h d t o t h e P r o j e c t N a v i g a t o r p r o j e c t t h e h i e r a r c h y i s u p d a t e d a s s h o w n i n F i g u r e 2 2 .

    F i g u r e 2 2 : P r o j e c t N a v i g a t o r P r o j e c t H i e r a r c h y

    I n I S E , s e l e c t Project Add Source. S e l e c t t h e s y s t e m . u c f f i l e i n t h e < x p s _ p r o j e c t > \ d a t a d i r e c t o r y .

    S e l e c t s y s t e m _ s t u b . v h d a n d d o u b l e c l i c k o n G e n e r a t e P r o g r a m m i n g F i l e t o i m p l e m e n t t h e d e s i g n a n d

    g e n e r a t e a b i t f i l e .

    I S E w i l l c a l l X P S t o g e n e r a t e t h e E D K t o c r e a t e t h e f o l l o w i n g d i r e c t o r i e s :

    o h d l c o n t a i n s t h e V H D L f i l e s t h a t d e f i n e t h e p r o c e s s o r s y s t e m

    o i m p l e m e n t a t i o n c o n t a i n s t h e N G C f i l e s

    o s y n t h e s i s c o n t a i n s t h e p r o j e c t s a n d i n f o r m a t i o n f r o m s y n t h e s i z i n g t h e f i l e s i n t h e h d l d i r e c t o r y t o c r e a t e

    t h o s e i n t h e i m p l e m e n t a t i o n d i r e c t o r y

    Defining the Software Design

    N o w t h a t t h e h a r d w a r e d e s i g n i s c o m p l e t e d , t h e n e x t s t e p i s d e f i n i n g t h e s o f t w a r e d e s i g n . T h e r e a r e t w o m a j o r

    p a r t s t o s o f t w a r e d e s i g n , c o n f i g u r i n g t h e B o a r d S u p p o r t P a c k a g e ( B S P ) a n d w r i t i n g t h e s o f t w a r e a p p l i c a t i o n s . T h e

    c o n f i g u r a t i o n o f t h e B S P i n c l u d e s t h e s e l e c t i o n o f d e v i c e d r i v e r s a n d l i b r a r i e s .

  • 8/6/2019 EDK 82 MB Tutorial

    27/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    Configuration of the BSP

    C o n f i g u r a t i o n o f t h e B S P i s d o n e u s i n g t h e S o f t w a r e P l a t f o r m S e t t i n g s d i a l o g . I n X P S , s e l e c t Software

    Software Platform Settings... T h i s w i l l o p e n t h e S o f t w a r e P l a t f o r m S e t t i n g s d i a l o g b o x a s s h o w n i n F i g u r e 2 3 .

    T h e S o f t w a r e P l a t f o r m S e t t i n g s d i a l o g b o x c o n t a i n s f o u r v i e w s . E a c h o f t h e s e v i e w s i s u s e d t o c o n t r o l a l l a s p e c t s

    o f t h e B S P c r e a t i o n .

    T h e S o f t w a r e P l a t f o r m v i e w a l l o w s t h e u s e r t o m o d i f y p r o c e s s o r p a r a m e t e r s , d r i v e r , o p e r a t i n g s y s t e m a n d

    l i b r a r i e s . T h e f o l l o w i n g O p e r a t i n g S y s t e m s a r e s u p p o r t e d :

    o S t a n d a l o n e

    o x i l k e r n e l

    o u c l i n u x

    o n u c l e u s

    N o c h a n g e s a r e r e q u i r e d i n t h i s v i e w .

    F i g u r e 2 3 : S o f t w a r e P l a t f o r m S e t t i n g s D i a l o g

  • 8/6/2019 EDK 82 MB Tutorial

    28/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    28 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    S e l e c t t h e O S a n d L i b r a r i e s v i e w a s s h o w n i n F i g u r e 2 4 . T h i s v i e w a l l o w s t h e u s e r t o c o n f i g u r e O S a n d

    l i b r a r y p a r a m e t e r s . N o c h a n g e s a r e r e q u i r e d .

    F i g u r e 2 4 : O S a n d L i b r a r i e s v i e w

    S e l e c t t h e D r i v e r s v i e w . T h i s v i e w a l l o w s y o u t o s e l e c t t h e s o f t w a r e v e r s i o n s f o r t h e p e r i p h e r a l s i n t h e

    s y s t e m a s s h o w n i n F i g u r e 2 5 . N o t i c e t h a t t h e d r i v e r v e r s i o n i s i n d e p e n d e n t o f t h e H W v e r s i o n .

    F i g u r e 2 5 : D r i v e r s v i e w

    T h e I n t e r r u p t H a n d l e r s v i e w a l l o w s y o u t o m o d i f y t h e p a r a m e t e r s f o r t h e i n t e r r u p t s . T h i s p r o j e c t d o e s n o t h a v e

    a n y i n t e r r u p t s .

    C l i c k OK.

    I n X P S , s e l e c t Software Generate Libraries and BSPs t o r u n L i b G e n a n d c r e a t e t h e B S P w h i c h

    i n c l u d e s d e v i c e d r i v e r s , l i b r a r i e s , c o n f i g u r e s t h e S T D I N / S T D O U T , a n d I n t e r r u p t h a n d l e r s a s s o c i a t e d w i t h

    t h e d e s i g n .

  • 8/6/2019 EDK 82 MB Tutorial

    29/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    L i b G e n c r e a t e s t h e f o l l o w i n g d i r e c t o r i e s i n t h e microblaze_0 d i r e c t o r y , s h o w n i n F i g u r e 2 6 :

    o c o d e : c o n t a i n s t h e c o m p i l e d a n d l i n k e d a p p l i c a t i o n c o d e i n a n E L F f i l e

    o i n c l u d e : c o n t a i n s t h e h e a d e r f i l e s f o r p e r i p h e r a l s i n c l u d e d i n t h e d e s i g n ( s u c h a s xgpio.h a n d

    xuartlite. h )

    o l i b : c o n t a i n s t h e l i b r a r y f i l e s ( s u c h a s libc.a a n d libxil.a )

    o l i b s r c : c o n t a i n s t h e s o u r c e f i l e s u s e d t o c r e a t e l i b r a r i e s

    Note: For more information on these files, refer to theEmbedded System Tools Guide.

    F i g u r e 2 6 : M i c r o B l a z e D r i v e r s D i r e c t o r i e s

    Building the User Application

    I n E D K 8 . 2 , X P S p r o v i d e s t h e a b i l i t y f o r t h e u s e r t o c r e a t e m u l t i p l e s o f t w a r e p r o j e c t s . T h e s e p r o j e c t s c a n i n c l u d e

    s o u r c e f i l e s , h e a d e r f i l e s , a n d l i n k e r s c r i p t s . U n i q u e s o f t w a r e p r o j e c t s a l l o w t h e d e s i g n e r t o s p e c i f y t h e f o l l o w i n g

    o p t i o n s f o r e a c h s o f t w a r e p r o j e c t :

    o S p e c i f y c o m p i l e r o p t i o n s

    o S p e c i f y w h i c h p r o j e c t s t o c o m p i l e

    o S p e c i f y w h i c h p r o j e c t s t o d o w n l o a d

    o B u i l d e n t i r e p r o j e c t s

    S o f t w a r e a p p l i c a t i o n c o d e d e v e l o p m e n t c a n b e m a n a g e d b y s e l e c t i n g t h e A p p l i c a t i o n s t a b a s s h o w n i n F i g u r e 2 7 .

    T h e B a s e S y s t e m B u i l d e r ( B S B ) g e n e r a t e s a s a m p l e a p p l i c a t i o n w h i c h t e s t s a s u b s e t o f t h e p e r i p h e r a l s i n c l u d e d

    i n t h e d e s i g n .

  • 8/6/2019 EDK 82 MB Tutorial

    30/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    30 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 2 7 : A p p l i c a t i o n s T a b

    Compiling the Code

    U s i n g t h e G N U G C C C o m p i l e r , c o m p i l e t h e a p p l i c a t i o n c o d e a s f o l l o w s :

    S e l e c t Software Build All User Applications t o r u n m b - g c c . M b - g c c c o m p i l e s t h e s o u r c e f i l e s .

    F i g u r e 2 8 : X P S O u t p u t W i n d o w - S o f t w a r e C o m p i l e d

    Downloading the Design

    N o w t h a t t h e h a r d w a r e a n d s o f t w a r e d e s i g n s a r e c o m p l e t e d , t h e d e v i c e c a n b e c o n f i g u r e d . F o l l o w t h e s e s t e p s t o

    d o w n l o a d a n d c o n f i g u r e t h e F G P A :

    C o n n e c t t h e h o s t c o m p u t e r t o t h e t a r g e t b o a r d , i n c l u d i n g c o n n e c t i n g t h e P a r a l l e l - J T A G c a b l e a n d t h e

    s e r i a l c a b l e .

  • 8/6/2019 EDK 82 MB Tutorial

    31/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    S t a r t a h y p e r t e r m i n a l s e s s i o n w i t h t h e f o l l o w i n g s e t t i n g s :

    o c o m 1 T h i s i s d e p e n d a n t o n t h e c o m p o r t y o u r s e r i a l c a b l e i s c o n n e c t e d t o .

    o B i t s p e r s e c o n d : 5 7 6 0 0

    o D a t a b i t s : 8

    o P a r i t y : n o n e

    o S t o p b i t s : 1

    o F l o w c o n t r o l : n o n e

    C o n n e c t t h e b o a r d p o w e r

    I n I S E , S e l e c t s y s t e m _ s t u b . v h d i n t h e s o u r c e w i n d o w

    I n t h e p r o c e s s w i n d o w , d o u b l e c l i c k o n U p d a t e B i t s t r e a m w i t h P r o c e s s o r D a t a

    I n t h e p r o c e s s w i n d o w , d o u b l e c l i c k o n C o n f i g u r e D e v i c e ( i M P A C T ) u n d e r G e n e r a t e P r o g r a m m i n g F i l e

    W i t h i M P A C T , c o n f i g u r e t h e F P G A u s i n g s y s t e m _ s t u b _ d o w n l o a d . b i t l o c a t e d i n t h e p r o j e c t _ n a v i g a t o r

    d i r e c t o r y c h o o s i n g t o b y p a s s a l l o f t h e o t h e r c h i p s i n t h e J T A G c h a i n

    A f t e r t h e c o n f i g u r a t i o n i s c o m p l e t e , y o u s h o u l d s e e a d i s p l a y s i m i l a r t o t h a t i n s h o w n i n F i g u r e 2 9 :

    F i g u r e 2 9 : H y p e r t e r m i n a l O u t p u t

    Debugging the Design

    N o w t h a t t h e d e v i c e i s c o n f i g u r e d , y o u c a n d e b u g t h e s o f t w a r e a p p l i c a t i o n d i r e c t l y v i a t h e M D M i n t e r f a c e . G D B

    c o n n e c t s t o t h e M i c r o B l a z e c o r e t h r o u g h t h e M D M a n d t h e X i l i n x M i c r o p r o c e s s o r D e b u g ( X M D ) e n g i n e u t i l i t y a s

    s h o w n i n F i g u r e 3 0 . X M D i s a p r o g r a m t h a t f a c i l i t a t e s a u n i f i e d G D B i n t e r f a c e a n d a T C L ( T o o l C o m m a n d

    L a n g u a g e ) i n t e r f a c e f o r d e b u g g i n g p r o g r a m s a n d v e r i f y i n g m i c r o p r o c e s s o r s y s t e m s . T h e X M D e n g i n e i s u s e d

    w i t h M i c r o B l a z e a n d P o w e r P C G D B ( m b - g d b & p o w e r p c - e a b i - g d b ) f o r d e b u g g i n g . M b - g d b a n d p o w e r p c - e a b i - g d b

  • 8/6/2019 EDK 82 MB Tutorial

    32/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    32 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    c o m m u n i c a t e w i t h X M D u s i n g t h e r e m o t e T C P p r o t o c o l a n d c o n t r o l t h e c o r r e s p o n d i n g t a r g e t s . G D B c a n c o n n e c t

    t o X M D o n t h e s a m e c o m p u t e r o r o n a r e m o t e I n t e r n e t c o m p u t e r .

    T o d e b u g t h e d e s i g n , f o l l o w t h e s e s t e p s :

    I n X P S , s e l e c t Debug XMD Debug Options. T h e X M D D e b u g O p t i o n s d i a l o g b o x a l l o w s t h e u s e r t o

    s p e c i f y t h e c o n n e c t i o n s t y p e a n d J T A G C h a i n D e f i n i t i o n . T h r e e c o n n e c t i o n t y p e s a r e a v a i l a b l e f o r

    M i c r o B l a z e :

    S i m u l a t o r e n a b l e s X M D t o c o n n e c t t o t h e M i c r o B l a z e I S S

    H a r d w a r e e n a b l e s X M D t o c o n n e c t t o t h e M D M p e r i p h e r a l i n t h e h a r d w a r e

    S t u b e n a b l e s X M D t o c o n n e c t t o t h e J T A G U A R T o r U A R T v i a X M D S T U B

    V i r t u a l p l a t f o r m e n a b l e s a V i r t u a l ( C m o d e l ) t o b e u s e d ( n o t c o v e r e d i n t h i s t u t o r i a l )

    V e r i f y t h a t H a r d w a r e i s s e l e c t e d .

    S e l e c t S a v e .

    S e l e c t Debug Launch XMD.

  • 8/6/2019 EDK 82 MB Tutorial

    33/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    F i g u r e 3 0 : X M D W i n d o w

    I n X P S , s e l e c t Debug Launch Software Debuggert o o p e n t h e G D B i n t e r f a c e .

    I n G D B , s e l e c t File Target Settingst o d i s p l a y t h e T a r g e t S e l e c t i o n d i a l o g b o x a s s h o w n i n F i g u r e 3 1 .

    C l i c k OK.

  • 8/6/2019 EDK 82 MB Tutorial

    34/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    34 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 3 1 : G D B T a r g e t S e l e c t i o n

    I n G D B , s e l e c t File Open

    S e l e c t e x e c u t a b l e . e l f i n t h e T e s t A p p _ M e m o r y d i r e c t o r y . T h e C c o d e i s v i s i b l e b e c a u s e t h e C r e a t e

    s y m b o l s f o r d e b u g g i n g ( - g o p t i o n ) i s s e l e c t e d b y d e f a u l t i n t h e c o m p i l e r o p t i o n s .

    I n G D B , s e l e c t File Exit.

    I n t h e A p p l i c a t i o n s w i n d o w o f X P S , d o u b l e c l i c k o n t h e P r o j e c t : T e s t A p p _ M e m o r y l a b e l .

    I n t h e D e b u g a n d O p t i m i z a t i o n t a b s e t t h e O p t i m i z a t i o n L e v e l t o No Optimization

    C l i c k OK.

    F i g u r e 3 2 : C o m p i l e r O p t i o n s

    R e c o m p i l e t h e c o d e

    L o a d t h e n e w e x e c u t a b l e . e l f i n t o G D B

  • 8/6/2019 EDK 82 MB Tutorial

    35/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    MicroBlaze Tutorial www.xilinx.comWT001 (v4.0) August 30, 2006 1-800-255-7778

    S e l e c t RunRun

    T h e r e i s a n a u t o m a t i c b r e a k p o i n t a t m a i n . G D B a l l o w s y o u t o s i n g l e s t e p t h e C o r a s s e m b l y c o d e .

    Note:The default values displayed in the Registers Window are in hex, while the values displayed in theSource Window are in decimal.

    Performing Behavioral Simulation of the Embedded System

    P e r f o r m i n g a b e h a v i o r a l s i m u l a t i o n o f t h e c o m p l e t e s y s t e m , w h i c h i n c l u d e s t h e e m b e d d e d p r o c e s s o r s y s t e m , i s a

    p o w e r f u l v e r i f i c a t i o n t e c h n i q u e . I n o r d e r t o p e r f o r m a b e h a v i o r a l s i m u l a t i o n o f t h e c o m p l e t e s y s t e m i n I S E , t h e

    s i m u l a t i o n f i l e f o r t h e e m b e d d e d s y s t e m m u s t b e g e n e r a t e d .

    F i r s t , i n c r e a s e t h e B a u d r a t e o f t h e U A R T s o t h a t s i m u l a t i o n o f t h e U A R T c a n h a p p e n m o r e q u i c k l y . R e m e m b e r

    t o c h a n g e t h e B a u d r a t e v a l u e b a c k t o 5 7 6 0 0 b e f o r e d o w n l o a d i n g t o t h e S p a r t a n 3 d e m o b o a r d .

    I n X P S d o u b l e - c l i c k o n t h e M H S f i l e

    C h a n g e t h e v a l u e o f P A R A M E T E R C _ B A U D R A T E t o 3 1 2 5 0 0 0 ( v a l u e o f C _ C L K _ F R E Q / 1 6 )

    S a v e t h e M H S f i l e a n d c l o s e i t

    X P S , s e l e c t Project Project Options. I n t h e P r o j e c t O p t i o n s d i a l o g b o x s e l e c t t h e H D L a n d S i m u l a t i o n

    t a b .

    B r o w s e t o t h e p r e c o m p i l e d E D K L i b r a r y a n d X i l i n x L i b r a r y a s s h o w n i n F i g u r e 3 3 . I t s h o u l d b e n o t e d t h a t t h e p a t h s

    w i l l b e d i f f e r e n t t o m a t c h y o u s y s t e m . F o r a d d i t i o n a l i n f o r m a t i o n o n c o m p i l i n g t h e s i m u l a t i o n l i b r a r i e s r e f e r t o t h e

    E m b e d d e d S y s t e m T o o l s R e f e r e n c e M a n u a l C h a p t e r 3 .

  • 8/6/2019 EDK 82 MB Tutorial

    36/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    36 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    F i g u r e 3 3 : P r o j e c t O p t i o n s - H D L a n d S i m u l a t i o n t a b

    C l i c k Ok.

    S e l e c t Simulation Generate Simulation HDL Files. T h i s w i l l g e n e r a t e a l l o f t h e E D K H D L S i m u l a t i o n

    f i l e s i n t h e E D K \ s i m u l a t i o n \ b e h a v i o r a l d i r e c t o r y c r e a t e d b y S i m G e n .

    N o w t h a t t h e E D K s i m u l a t i o n f i l e s h a v e b e e n c r e a t e d , t h e I S E s i m u l a t i o n e n v i r o n m e n t c a n b e c r e a t e d .

    I n I S E , s e l e c t s y s t e m _ s t u b . v h d a n d d o u b l e c l i c k o n C r e a t e N e w S o u r c e i n t h e P r o c e s s W i n d o w .

    I n t h e N e w S o u r c e d i a l o g , s e l e c t t h e s o u r c e t y p e a s V H D L T e s t B e n c h a n d t h e F i l e N a m e a s

    t e s t b e n c h

    C l i c k Next. S e l e c t s y s t e m _ s t u b a s t h e s o u r c e f i l e t o w h i c h t h e t e s t b e n c h w i l l b e a s s o c i a t e d .

    C l i c k Next a n d Finish.

    N o w s e l e c t B e h a v i o r a l S i m u l a t i o n i n t h e S o u r c e s w i n d o w a s s h o w n i n F i g u r e 3 4 .

  • 8/6/2019 EDK 82 MB Tutorial

    37/39

  • 8/6/2019 EDK 82 MB Tutorial

    38/39

    E D K 8 . 2 M i c r o B l a z e T u t o r i a l i n S p a r t a n 3

    38 www.xilinx.com EDK 8.2 MicroBlaze Tutorial in Spar1-800-255-7778 WT001 (v4.0) August 30,

    f p g a _ 0 _ R S 2 3 2 _ R X _ p i n < = f p g a _ 0 _ R S 2 3 2 _ T X _ p i n ;

    I n o r d e r t o p o p u l a t e t h e B R A M s w i t h t h e T e s t A p p _ M e m o r y A p p l i c a t i o n , a c o n f i g u r a t i o n s t a t e m e n t m u s t b e

    c r e a t e d . A d d t h e f o l l o w i n g a f t e r t h e t e s t b e n c h a r c h i t e c t u r e :

    c o n f i g u r a t i o n t e s t b e n c h _ v h d _ c o n f o f t e s t b e n c h _ v h d i s

    f o r b e h a v i o r

    f o r u u t : s y s t e m _ s t u b

    f o r B e h a v i o r a l

    f o r I n s t _ s y s t e m : s y s t e m

    u s e c o n f i g u r a t i o n w o r k . s y s t e m _ c o n f ;

    e n d f o r ;

    e n d f o r ;

    e n d f o r ;

    e n d f o r ;

    e n d t e s t b e n c h _ v h d _ c o n f ;

    S a v e a n d c l o s e t h e t e s t b e n c h . v h d f i l e .

    S e l e c t t e s t b e n c h . v h d i n t h e I S E S o u r c e W i n d o w . E x p a n d t h e M o d e l S i m S i m u l a t o r i n t h e p r o c e s s w i n d o w t h e n

    r i g h t - c l i c k o n t h e S i m u l a t e B e h a v i o r a l M o d e l a n d s e l e c t P r o p e r t i e s .

    C h a n g e t h e s i m u l a t i o n r u n t i m e t o 0 n s , s e l e c t U s e C o n f i g u r a t i o n N a m e a n d i n s e r t t e s t b e n c h _ v h d _ c o n f i n t h e

    C o n f i g u r a t i o n N a m e f i e l d a s s h o w n i n F i g u r e 3 5 .

    F i g u r e 3 5 : L o a d i n g t h e V H D L c o n f i g u r a t i o n

    C l i c k o n t h e O K b u t t o n .

    D o u b l e - c l i c k o n t h e S i m u l a t e B e h a v i o r a l M o d e l t o s i m u l a t e y o u r p r o c e s s o r d e s i g n .

    T o s e e t h e o u t p u t o f t h e U A R T , t y p e i n t h e f o l l o w i n g c o m m a n d i n t h e M o d e l s i m c o n s o l e w i n d o w :

  • 8/6/2019 EDK 82 MB Tutorial

    39/39

    EDK 8.2 MicroBlaze Tutorial in Spartan 3

    a d d w a v e - r a d i x a s c i i / t e s t b e n c h _ v h d / u u t / i n s t _ s y s t e m / r s 2 3 2 / r s 2 3 2 / o p b _ u a r t l i t e _ c o r e _ i / o p b _ u a r t l i t e _ t x _ i / f i f o _ d o u t

    A t t h e c o m m a n d p r o m p t t y p e r u n 3 0 0 u s t o b e g i n r u n n i n g t h e s i m u l a t i o n . I t w i l l t a k e s e v e r a l t h o u s a n d u S t o

    r u n t h e d e s i g n t o s i m u l a t e t h e f u n c t i o n a l i t y o f t h e d e s i g n b e c a u s e o f t h e p r i n t f r o u t i n e s . Y o u s h o u l d s e e a

    M o d e l s i m w a v e f o r m s i m i l a r t o t h e o n e s h o w n i n F i g u r e 3 6 .

    F i g u r e 3 6 : S i m u l a t i o n r e s u l t s