Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
EE4218 Lab 4



      SYSTEMC SIMULATION
        ENVIROMENT USING
 MICROSOFT VISUAL C++ 6.0




GUI based Tools Used:

Microsoft Visual C++ 6.0
SEMESTER II 2008/2009




DEPARTMENT OF ELECTRICAL AND
   COMPUTER ENGINEERING


EE4218 EMBEDDED HARDWARE SYSTEM
             DESIGN


     ASSISTANT PROF. HA YAJUN



NATIONAL UNIVERSITY OF
        SINGAPORE




                                  ii
Table of Contents
1.  Introduction...............................................................................................................................5
2.  Background ...............................................................................................................................5
3   Generating SystemC library......................................................................................................6
  3.1    Getting Started ..................................................................................................................6
  3.2    Define Directory Structure ................................................................................................6
  3.3    Generating and Setting Up the SystemC Library..............................................................7
  3.4    Summary ...........................................................................................................................7
4   Worked Example.......................................................................................................................7
  4.1    Full Adder Circuit .............................................................................................................7
  4.2    Procedure ..........................................................................................................................8


                                                     List of Figures
Figure 2-1: SystemC Design Methodology.......................................................................................5
Figure 2-2: SystemC Environment....................................................................................................6
Figure 4-1: Fuller Adder Schematic..................................................................................................8
Figure 4-2 : Create a new Win32 console application ......................................................................8
Figure 4-3: Create an empty project..................................................................................................8
Figure 4-4: New project information ................................................................................................9
Figure 4-5: Specify ‘C++ Language’ ................................................................................................9
Figure 4-6: Specify SystemC ‘src’ path ............................................................................................9
Figure 4-7: Execution window..........................................................................................................9
Figure 4-8: Execution window........................................................................................................10
Figure 4-9: Create a new console application .................................................................................10
Figure 4-10: Select the properties of the console application .........................................................11
Figure 4-11: Save the project ..........................................................................................................11
Figure 4-12: Include the design files into the project......................................................................11
Figure 4-13: Include the SystemC library into the project..............................................................11
Figure 4-14: Include the SystemC header and library binary .........................................................11
Figure 4-15: Make project...............................................................................................................12
Figure 4-16: Build project...............................................................................................................12
Figure 4-17: Windows Command Prompt Output ..........................................................................12
Figure 4-18: Windows Command Prompt Output ..........................................................................13
Figure 4-19: Windows Command Prompt Output ..........................................................................13


                                                       List of Tables
Table 4-1: Full Adder Truth Table.....................................................................................................8




                                                                                                                                             iii
iv
SystemC Design Methodology
1. Introduction
                                                  The current system design methodology has a
This laboratory demonstration exercise is         number of problems such as:
designed to provide students with some                •   Manual conversion from C++ to
reference and experience in simulating                    system functional models written in
SystemC models in a C++ environment.                      HDL creates errors
                                                      •   Disconnect between system model in
This manual first gives students a brief                  C/C++ and HDL model
introduction on SystemC programming                   •   Multiple system tests
language and explains the steps to generate a
compatible SystemC library binary in the          On the other hand, SystemC design approach
Visual C++ 6.0. The SystemC environment           offers many advantages over the traditional
has been set up in the laboratory computers       approach for system level design. The
and students will not be required to perform      SystemC design methodology for hardware is
the steps described in Section 3. However,        shown in the Figure 2-1.
students can use the information provided in
this lab manual to set up similar environment
in their own computers.

Next, a simple worked example will be
provided to allow students to familiarize with
running a SystemC design using the above
setup Visual C++ environment.



2. Background
SystemC is a C++ class library and a
methodology that you can use to effectively
create a cycle-accurate model of software
algorithms, hardware architecture, and
interfaces of your SoC (System On a Chip)
and system-level designs. You can use
SystemC and standard C++ development tools
                                                    Figure 2-1: SystemC Design Methodology
to create a system-level model, quickly
simulate to validate and optimize the design,
explore various algorithms, and also to           Using the SystemC design approach, there is a
provide the hardware and software                 number of advantages over the current design
development team with an executable               methodology, including the following:
specification of the system. An executable            •   Gradual refinement methodology
specification is essentially a C++ program that       •   Functional and synthesis models are
exhibits the same behavior as the system when             written in a single language
executed.
                                                  More information on SystemC can be found in


                                                                                             5
the User Guide uploaded in the course website.      The original SystemC library source files
                                                    <systemc-2.0.1.zip> downloadable in the
Simulation                                          SystemC website (www.systemc.org) contains
SystemC can be used to simulate a system. It        the necessary (*.cpp) files, (*.h) files and
provides header files and libraries which           example files.
describe the classes and contain the simulation
kernel respectively. Any ANSI C++ compiler          However, for Borland C++ Builder users,
can compile SystemC code. The SystemC               another file <SystemC2.0.1borland.zip> is to
library is used during linking. The resulting       be downloaded from the SystemC website.
executable serves as a simulator. An overview       This is the SystemC2.0.1 port from the
of using SystemC environment is shown in            original library source files to the Borland
Figure 2-2.                                         compiler.

                                                    Note that you need to create a new account in
                                                    order to download these files. Registering for
                                                    a new account is free. <systemc-2.0.1.zip> and
                                                    <SystemC2.0.1borland.zip> files can be
                                                    downloaded respectively from:
                                                    https://www.systemc.org/frs/viewRelease.php
                                                    ?release_id=13&group_id=5 and
                                                    https://www.systemc.org/frs/viewRelease.php
                                                    ?release_id=21&group_id=6. Or can also
      Figure 2-2: SystemC Environment
                                                    downloaded from the course complementary
                                                    web site at
3 Generating SystemC library                        http://courses.nus.edu.sg/course/elehy/EE4218
                                                    /projects.htm
3.1    Getting Started

1) Install Visual C++ 6.0 / Borland C++             3.2   Define Directory Structure
   Builder 6
                                                    The directory structure is defined below to
Visual C++ 6.0 is a commercial software and         ease the explanation of interfacing SystemC
is available in the market. An alternative is the   with Visual C++ 6.0. The Visual C++ is
Borland C++ Builder version 6 which can be          assumed to be installed under <C:Program
download from the NUS web shopping page             Files>. The original SystemC library source
(http://helpdesk.nus.edu.sg/webshop/user/web        files from <systemc-2.0.1.zip> are extracted
shop.htm). In the web shopping page, you will       into <C:SystemCsystemc2.0.1>. In addition,
find the Borland C++ Builder version 6 from         three new folders, namely Include, Lib and
the category of Language and Compilers. An          Tutorial are to be created in the SystemC
installation request from the Computer Centre       folder.
will be required.

2) Download Library Source Files




                                                                                                6
3.3     Generating and Setting Up the
        SystemC Library                                  This will take a while to compile.
                                                         When it completes, you will see
Visual C++ 6.0:                                          additional            files      in
1) To generate the SystemC library:                      <C:SystemCsystemc2.0.1-src-
                                                         borlandsrc>:
      a) Go      to       <C:SystemCsystemc-                77 OBJ files
         2.0.1msvc60systemc>.           This                systemc2.0.1.lib
         directory contains the project and                   make.log (with 12 warnings)
         workspace files to compile the           2) To set up the SystemC library:
         `systemc.lib’ library.
      b) Double-click on the ‘systemc.dsw’              a) Copy the SystemC-Borland library
         file to launch Visual C++ with the                binary <systemc2.0.1.lib> to
         workspace file. The workspace file                <C:SystemCLib>
         will have the proper switches set to           b) Copy all the header files (*.h) to
         compile for Visual C++ 6.0. Select                <C:SystemCInclude>
         ‘Build systemc.lib’ under the Build
         menu or press F7 to build
         ‘systemc.lib’.
                                                  3.4        Summary


          This will take a while to compile.      After completing the steps above, the
          When it completes, you will see         SystemC library binary will be generated. In
          additional files in the Debug folder:   addition, the header files and library,
             77 OBJ files                         necessary during compilation of the SystemC
            systemc.pch                           design, are set up.
            vc60.pdb
            vc60.idb
            systemc2.0.1.lib                      4 Worked Example
2) To set up the SystemC library:                 In this section, a simple example will be used
                                                  to illustrate the process of setting up a console
      a) Copy the generated SystemC library       application. Console applications are 32-bit
         inary     <systemc2.0.1.lib>    to       programs that run without a graphical
         <C:SystemCLib>                        interface, usually in a console window. These
                                                  applications typically do not require much
Borland C++ Builder                               user input and perform a limited set of
1) To generate the SystemC library                functions.


      a) Open a Windows Command Prompt
                                                  4.1        Full Adder Circuit
      b) Change       the     directory to
         <C:SystemCsystemc2.0.1-src-
         borlandsrc>                            Consider a full adder circuit, which can add
      c) Type the following command:              three bits and gives a bit sum and carry. The
         make > make.log                          truth table and schematic for full adder circuit



                                                                                                 7
is as shown in Table 4-1 and Figure 4-1          d) Specify     the ‘Location’ as
respectively.                                       <C:SYSTEMCTUTORIALfull_ad
                                                    der>.
                                                 e) Click [OK].




          A   B   Cin    Sum   Carry
          0   0     0      0       0
          0   0     1      1       0
          0   1     0      1       0
          0   1     1      0       1
          1   0     0      1       0
          1   0     1      0       1
          1   1     0      0       1
          1   1     1      1       1

       Table 4-1: Full Adder Truth Table         Figure 4-2 : Create a new Win32 console
                                                                  application


                                                 f)    In the next dialog box, select an
                                                       empty project as shown in Figure 4-3.




       Figure 4-1: Fuller Adder Schematic



4.2     Procedure

The source files for this example are created
in the following directory:
<C:SystemCTutorialfull_adder>                     Figure 4-3: Create an empty project


Visual C++ 6.0:                                  g) Click [Finish]. A dialog box will pop
1) Invoke Visual C++ 6.0.                           out showing the new project
                                                    information as shown in Figure 4-4.
2) Create new project.

      a) Click on [File | New ]
      b) Select the Projects tab on the dialog
         box that appears and select a Win32
         Console Application as shown in
         Figure 4-2.
      c) Specify the ‘Project name’ as
         ‘full_adder’.



                                                                                            8
Figure 4-6: Specify SystemC ‘src’ path


                                                4) Add design files into the project.
      Figure 4-4: New project information

3) SystemC settings.                               a) Click [Project | Add To Project | Files].
                                                   b) Include all the *.cpp and *.h files
   a) Click on [Project | Settings].                   design files.
   b) First, select the C/C++ tab, and select   5) Include the SystemC library binary.
      the ‘C++ Language’ category. Make
      sure that the `Enable Run Time Type           a) Click [Project | Add To Project | Files].
      Information (RTTI)' checkbox is               b) Include the <systemc2.0.1.lib> from
      checked as shown in Figure 4-5.                  <C:SystemCLib>.
   c) Next, select the ‘Preprocessor’
      category, and type the path               6) Start the compilation process.
      <C:SystemCsystemc-2.0.1src> in
      the text entry field labeled                  a) Select ‘Build full_adder.exe’ under
      ‘Additional include directories’ as              the Build menu or press F7 to build
      shown in Figure 4-6.                             ‘full_adder.exe’.
   d) Click [OK].
                                                7) Select ‘Execute full_adder.exe’ under the
                                                   Build menu or press Ctrl+F5 to execute
                                                   the project. You will see a Windows
                                                   Command Prompt as shown in Figure 4-7.




      Figure 4-5: Specify ‘C++ Language’


                                                          Figure 4-7: Execution window


                                                8) Test the output.


                                                                                               9
shown in Figure 4-9.
    a) Key in either a ‘0’ or ‘1’ for the C, A         c) Click [OK].
       and B inputs and press Enter. The
       sum and carry of the inputs will be
       displayed, as given by the truth table
       shown in Table 4.1.
    b) There are 5 test operations. Enter
       inputs for the other 4 test operations.
       An example of the output is as shown
       in Figure 4-8.

        After the 5th test operation (at the end
        of the project execution), the
        Windows Command Prompt will
                                                           Figure 4-9: Create a new console
        prompt you to ‘press any key to
                                                                     application
        continue’ to exit the program.
                                                   3) In the “Console Wizard” window, specify
                                                      the settings as shown in Figure 4-10 and
                                                      click [OK].

                                                   4) Save the project.
                                                      a) Click on [File | Save Project As…].
                                                      b) Type <full_adder.bpr> as the
                                                         filename as shown in Figure 4-11.

                                                   5) Add the rest of the design files into the
                                                      project.

                                                       a) Click on [Project | Add to Project…].
                                                       b) Include all the design files
                                                          <C:SystemCTutorialfull_adder*.c
                                                          pp> except <stimulus.cpp> into the
         Figure 4-8: Execution window
                                                          project as shown in Figure 4-12. In
                                                          this    case,      double-click    on
9) Click on [File | Exit] to exit Visual C++              <fulladder.cpp>.
   6.0.

Borland C++ Builder:
1) Invoke Borland C++ Builder.

2) Create a new console application.

    a) Click on [File | New | Other…].
    b) Select Console Wizard in the [New]
       tab in the [New Item] window as


                                                                                              10
Figure 4-10: Select the properties of the
               console application




                                                     Figure 4-13: Include the SystemC library
                                                                  into the project


          Figure 4-11: Save the project          7) Change the project settings to include the
                                                    SystemC header files and library binary.

                                                     a) Click on [Project | Options…].
                                                     b) Click on the [Directories/Conditionals]
                                                        tab as shown in Figure 4-14.
                                                     c) Modify [Include path:] to include
                                                        “C:SystemCInclude;”.
                                                     d) Modify [Library path:] to include
                                                        “C:SystemCLib;”.
                                                     e) Click [OK].

    Figure 4-12: Include the design files into
                   the project

6) Include the SystemC library binary.

    a) Click on [Project | Add to Project…].
    b) Select
       <C:SystemCLibsystemc2.0.1.lib>
       into the project as shown in Figure
       4-13.
    c) Double-click on <systemc2.0.1.lib>



                                                     Figure 4-14: Include the SystemC header
                                                                and library binary


                                                 8) Start the compilation process.

                                                     a) Click on [Project | Make full_adder]


                                                                                            11
A window is displayed as shown in
       Figure 4-15.
    b) Click [OK].




                                                    Figure 4-17: Windows Command Prompt
                                                                       Output


           Figure 4-15: Make project
                                                11) Test the output.

9) Build the executable.                            a) Key in either a ‘0’ or ‘1’ for the C, A
                                                       and B inputs and press Enter. The
    a) Click on [Project | Build full_adder].          sum and carry of the inputs will be
       A window is displayed as shown in               displayed, as given by the truth table
       Figure 4-16.                                    shown in Table 4-1.
    b) Click [OK].                                  b) There are 5 test operations. Enter
                                                       inputs for the other 4 test operations.
                                                       An example of the output is as shown
                                                       in Figure 4-18.

                                                         After the 5th test operation (at the end
                                                         of the project execution), the
                                                         Windows Command Prompt will
                                                         disappear.

                                                12) Alternatively, you may view the result by
                                                    opening a Windows Command Prompt
           Figure 4-16: Build project
                                                    manually.

10) Click on [Run | Run] to execute the             a) Click on [Start | All Programs |
    project. You will see a Windows                    Accessories | Command Prompt] to
    Command Prompt as shown in Figure                  open the Windows Command Prompt
    4-17.                                           b) Change       the      directory     to:
                                                       <C:SystemCTutorialfull_adder>
                                                    c) Type “full_adder” to execute the
                                                       project. The result is the same as the
                                                       above step by executing the project in
                                                       the Borland C++ IDE. However, the
                                                       Windows Command Prompt will not
                                                       disappear from the project has been
                                                       executed. An example of the output


                                                                                              12
after the project has been successfully
        executed is as shown in Figure 4-19.




                                                  Figure 4-19: Windows Command Prompt
                                                                Output
    Figure 4-18: Windows Command Prompt
                      Output

13) Click on [File | Save All] to save the
    project.

14) Click on [File | Close All] to close the
    project.

15) Click on [File | Exit] to exit Borland.




                                                                                   13

More Related Content

EE3207+-+Computer+Architecture

  • 1. EE4218 Lab 4 SYSTEMC SIMULATION ENVIROMENT USING MICROSOFT VISUAL C++ 6.0 GUI based Tools Used: Microsoft Visual C++ 6.0
  • 2. SEMESTER II 2008/2009 DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING EE4218 EMBEDDED HARDWARE SYSTEM DESIGN ASSISTANT PROF. HA YAJUN NATIONAL UNIVERSITY OF SINGAPORE ii
  • 3. Table of Contents 1. Introduction...............................................................................................................................5 2. Background ...............................................................................................................................5 3 Generating SystemC library......................................................................................................6 3.1 Getting Started ..................................................................................................................6 3.2 Define Directory Structure ................................................................................................6 3.3 Generating and Setting Up the SystemC Library..............................................................7 3.4 Summary ...........................................................................................................................7 4 Worked Example.......................................................................................................................7 4.1 Full Adder Circuit .............................................................................................................7 4.2 Procedure ..........................................................................................................................8 List of Figures Figure 2-1: SystemC Design Methodology.......................................................................................5 Figure 2-2: SystemC Environment....................................................................................................6 Figure 4-1: Fuller Adder Schematic..................................................................................................8 Figure 4-2 : Create a new Win32 console application ......................................................................8 Figure 4-3: Create an empty project..................................................................................................8 Figure 4-4: New project information ................................................................................................9 Figure 4-5: Specify ‘C++ Language’ ................................................................................................9 Figure 4-6: Specify SystemC ‘src’ path ............................................................................................9 Figure 4-7: Execution window..........................................................................................................9 Figure 4-8: Execution window........................................................................................................10 Figure 4-9: Create a new console application .................................................................................10 Figure 4-10: Select the properties of the console application .........................................................11 Figure 4-11: Save the project ..........................................................................................................11 Figure 4-12: Include the design files into the project......................................................................11 Figure 4-13: Include the SystemC library into the project..............................................................11 Figure 4-14: Include the SystemC header and library binary .........................................................11 Figure 4-15: Make project...............................................................................................................12 Figure 4-16: Build project...............................................................................................................12 Figure 4-17: Windows Command Prompt Output ..........................................................................12 Figure 4-18: Windows Command Prompt Output ..........................................................................13 Figure 4-19: Windows Command Prompt Output ..........................................................................13 List of Tables Table 4-1: Full Adder Truth Table.....................................................................................................8 iii
  • 4. iv
  • 5. SystemC Design Methodology 1. Introduction The current system design methodology has a This laboratory demonstration exercise is number of problems such as: designed to provide students with some • Manual conversion from C++ to reference and experience in simulating system functional models written in SystemC models in a C++ environment. HDL creates errors • Disconnect between system model in This manual first gives students a brief C/C++ and HDL model introduction on SystemC programming • Multiple system tests language and explains the steps to generate a compatible SystemC library binary in the On the other hand, SystemC design approach Visual C++ 6.0. The SystemC environment offers many advantages over the traditional has been set up in the laboratory computers approach for system level design. The and students will not be required to perform SystemC design methodology for hardware is the steps described in Section 3. However, shown in the Figure 2-1. students can use the information provided in this lab manual to set up similar environment in their own computers. Next, a simple worked example will be provided to allow students to familiarize with running a SystemC design using the above setup Visual C++ environment. 2. Background SystemC is a C++ class library and a methodology that you can use to effectively create a cycle-accurate model of software algorithms, hardware architecture, and interfaces of your SoC (System On a Chip) and system-level designs. You can use SystemC and standard C++ development tools Figure 2-1: SystemC Design Methodology to create a system-level model, quickly simulate to validate and optimize the design, explore various algorithms, and also to Using the SystemC design approach, there is a provide the hardware and software number of advantages over the current design development team with an executable methodology, including the following: specification of the system. An executable • Gradual refinement methodology specification is essentially a C++ program that • Functional and synthesis models are exhibits the same behavior as the system when written in a single language executed. More information on SystemC can be found in 5
  • 6. the User Guide uploaded in the course website. The original SystemC library source files <systemc-2.0.1.zip> downloadable in the Simulation SystemC website (www.systemc.org) contains SystemC can be used to simulate a system. It the necessary (*.cpp) files, (*.h) files and provides header files and libraries which example files. describe the classes and contain the simulation kernel respectively. Any ANSI C++ compiler However, for Borland C++ Builder users, can compile SystemC code. The SystemC another file <SystemC2.0.1borland.zip> is to library is used during linking. The resulting be downloaded from the SystemC website. executable serves as a simulator. An overview This is the SystemC2.0.1 port from the of using SystemC environment is shown in original library source files to the Borland Figure 2-2. compiler. Note that you need to create a new account in order to download these files. Registering for a new account is free. <systemc-2.0.1.zip> and <SystemC2.0.1borland.zip> files can be downloaded respectively from: https://www.systemc.org/frs/viewRelease.php ?release_id=13&group_id=5 and https://www.systemc.org/frs/viewRelease.php ?release_id=21&group_id=6. Or can also Figure 2-2: SystemC Environment downloaded from the course complementary web site at 3 Generating SystemC library http://courses.nus.edu.sg/course/elehy/EE4218 /projects.htm 3.1 Getting Started 1) Install Visual C++ 6.0 / Borland C++ 3.2 Define Directory Structure Builder 6 The directory structure is defined below to Visual C++ 6.0 is a commercial software and ease the explanation of interfacing SystemC is available in the market. An alternative is the with Visual C++ 6.0. The Visual C++ is Borland C++ Builder version 6 which can be assumed to be installed under <C:Program download from the NUS web shopping page Files>. The original SystemC library source (http://helpdesk.nus.edu.sg/webshop/user/web files from <systemc-2.0.1.zip> are extracted shop.htm). In the web shopping page, you will into <C:SystemCsystemc2.0.1>. In addition, find the Borland C++ Builder version 6 from three new folders, namely Include, Lib and the category of Language and Compilers. An Tutorial are to be created in the SystemC installation request from the Computer Centre folder. will be required. 2) Download Library Source Files 6
  • 7. 3.3 Generating and Setting Up the SystemC Library This will take a while to compile. When it completes, you will see Visual C++ 6.0: additional files in 1) To generate the SystemC library: <C:SystemCsystemc2.0.1-src- borlandsrc>: a) Go to <C:SystemCsystemc- 77 OBJ files 2.0.1msvc60systemc>. This systemc2.0.1.lib directory contains the project and make.log (with 12 warnings) workspace files to compile the 2) To set up the SystemC library: `systemc.lib’ library. b) Double-click on the ‘systemc.dsw’ a) Copy the SystemC-Borland library file to launch Visual C++ with the binary <systemc2.0.1.lib> to workspace file. The workspace file <C:SystemCLib> will have the proper switches set to b) Copy all the header files (*.h) to compile for Visual C++ 6.0. Select <C:SystemCInclude> ‘Build systemc.lib’ under the Build menu or press F7 to build ‘systemc.lib’. 3.4 Summary This will take a while to compile. After completing the steps above, the When it completes, you will see SystemC library binary will be generated. In additional files in the Debug folder: addition, the header files and library, 77 OBJ files necessary during compilation of the SystemC systemc.pch design, are set up. vc60.pdb vc60.idb systemc2.0.1.lib 4 Worked Example 2) To set up the SystemC library: In this section, a simple example will be used to illustrate the process of setting up a console a) Copy the generated SystemC library application. Console applications are 32-bit inary <systemc2.0.1.lib> to programs that run without a graphical <C:SystemCLib> interface, usually in a console window. These applications typically do not require much Borland C++ Builder user input and perform a limited set of 1) To generate the SystemC library functions. a) Open a Windows Command Prompt 4.1 Full Adder Circuit b) Change the directory to <C:SystemCsystemc2.0.1-src- borlandsrc> Consider a full adder circuit, which can add c) Type the following command: three bits and gives a bit sum and carry. The make > make.log truth table and schematic for full adder circuit 7
  • 8. is as shown in Table 4-1 and Figure 4-1 d) Specify the ‘Location’ as respectively. <C:SYSTEMCTUTORIALfull_ad der>. e) Click [OK]. A B Cin Sum Carry 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 Table 4-1: Full Adder Truth Table Figure 4-2 : Create a new Win32 console application f) In the next dialog box, select an empty project as shown in Figure 4-3. Figure 4-1: Fuller Adder Schematic 4.2 Procedure The source files for this example are created in the following directory: <C:SystemCTutorialfull_adder> Figure 4-3: Create an empty project Visual C++ 6.0: g) Click [Finish]. A dialog box will pop 1) Invoke Visual C++ 6.0. out showing the new project information as shown in Figure 4-4. 2) Create new project. a) Click on [File | New ] b) Select the Projects tab on the dialog box that appears and select a Win32 Console Application as shown in Figure 4-2. c) Specify the ‘Project name’ as ‘full_adder’. 8
  • 9. Figure 4-6: Specify SystemC ‘src’ path 4) Add design files into the project. Figure 4-4: New project information 3) SystemC settings. a) Click [Project | Add To Project | Files]. b) Include all the *.cpp and *.h files a) Click on [Project | Settings]. design files. b) First, select the C/C++ tab, and select 5) Include the SystemC library binary. the ‘C++ Language’ category. Make sure that the `Enable Run Time Type a) Click [Project | Add To Project | Files]. Information (RTTI)' checkbox is b) Include the <systemc2.0.1.lib> from checked as shown in Figure 4-5. <C:SystemCLib>. c) Next, select the ‘Preprocessor’ category, and type the path 6) Start the compilation process. <C:SystemCsystemc-2.0.1src> in the text entry field labeled a) Select ‘Build full_adder.exe’ under ‘Additional include directories’ as the Build menu or press F7 to build shown in Figure 4-6. ‘full_adder.exe’. d) Click [OK]. 7) Select ‘Execute full_adder.exe’ under the Build menu or press Ctrl+F5 to execute the project. You will see a Windows Command Prompt as shown in Figure 4-7. Figure 4-5: Specify ‘C++ Language’ Figure 4-7: Execution window 8) Test the output. 9
  • 10. shown in Figure 4-9. a) Key in either a ‘0’ or ‘1’ for the C, A c) Click [OK]. and B inputs and press Enter. The sum and carry of the inputs will be displayed, as given by the truth table shown in Table 4.1. b) There are 5 test operations. Enter inputs for the other 4 test operations. An example of the output is as shown in Figure 4-8. After the 5th test operation (at the end of the project execution), the Windows Command Prompt will Figure 4-9: Create a new console prompt you to ‘press any key to application continue’ to exit the program. 3) In the “Console Wizard” window, specify the settings as shown in Figure 4-10 and click [OK]. 4) Save the project. a) Click on [File | Save Project As…]. b) Type <full_adder.bpr> as the filename as shown in Figure 4-11. 5) Add the rest of the design files into the project. a) Click on [Project | Add to Project…]. b) Include all the design files <C:SystemCTutorialfull_adder*.c pp> except <stimulus.cpp> into the Figure 4-8: Execution window project as shown in Figure 4-12. In this case, double-click on 9) Click on [File | Exit] to exit Visual C++ <fulladder.cpp>. 6.0. Borland C++ Builder: 1) Invoke Borland C++ Builder. 2) Create a new console application. a) Click on [File | New | Other…]. b) Select Console Wizard in the [New] tab in the [New Item] window as 10
  • 11. Figure 4-10: Select the properties of the console application Figure 4-13: Include the SystemC library into the project Figure 4-11: Save the project 7) Change the project settings to include the SystemC header files and library binary. a) Click on [Project | Options…]. b) Click on the [Directories/Conditionals] tab as shown in Figure 4-14. c) Modify [Include path:] to include “C:SystemCInclude;”. d) Modify [Library path:] to include “C:SystemCLib;”. e) Click [OK]. Figure 4-12: Include the design files into the project 6) Include the SystemC library binary. a) Click on [Project | Add to Project…]. b) Select <C:SystemCLibsystemc2.0.1.lib> into the project as shown in Figure 4-13. c) Double-click on <systemc2.0.1.lib> Figure 4-14: Include the SystemC header and library binary 8) Start the compilation process. a) Click on [Project | Make full_adder] 11
  • 12. A window is displayed as shown in Figure 4-15. b) Click [OK]. Figure 4-17: Windows Command Prompt Output Figure 4-15: Make project 11) Test the output. 9) Build the executable. a) Key in either a ‘0’ or ‘1’ for the C, A and B inputs and press Enter. The a) Click on [Project | Build full_adder]. sum and carry of the inputs will be A window is displayed as shown in displayed, as given by the truth table Figure 4-16. shown in Table 4-1. b) Click [OK]. b) There are 5 test operations. Enter inputs for the other 4 test operations. An example of the output is as shown in Figure 4-18. After the 5th test operation (at the end of the project execution), the Windows Command Prompt will disappear. 12) Alternatively, you may view the result by opening a Windows Command Prompt Figure 4-16: Build project manually. 10) Click on [Run | Run] to execute the a) Click on [Start | All Programs | project. You will see a Windows Accessories | Command Prompt] to Command Prompt as shown in Figure open the Windows Command Prompt 4-17. b) Change the directory to: <C:SystemCTutorialfull_adder> c) Type “full_adder” to execute the project. The result is the same as the above step by executing the project in the Borland C++ IDE. However, the Windows Command Prompt will not disappear from the project has been executed. An example of the output 12
  • 13. after the project has been successfully executed is as shown in Figure 4-19. Figure 4-19: Windows Command Prompt Output Figure 4-18: Windows Command Prompt Output 13) Click on [File | Save All] to save the project. 14) Click on [File | Close All] to close the project. 15) Click on [File | Exit] to exit Borland. 13