New Horizons






<< June 2008 >>
Sun Mon Tue Wed Thu Fri Sat
01 02 03 04 05 06 07
08 09 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30


Table of content

New Horizons
What's new
Starting a blog
Writing a blog
I got a job

SystemC
SystemC from scratch. Part 1
SystemC from scratch. Part 2
SystemC from scratch. Part 3

ASIC/FPGA Design
Table of content
Index
FPGA design from scratch. Part 1
FPGA design from scratch. Part 2
FPGA design from scratch. Part 3
FPGA design from scratch. Part 4
FPGA design from scratch. Part 5
FPGA design from scratch. Part 6
FPGA design from scratch. Part 7
FPGA design from scratch. Part 8
FPGA design from scratch. Part 9
FPGA design from scratch. Part 10
FPGA design from scratch. Part 11
FPGA design from scratch. Part 12
FPGA design from scratch. Part 13
FPGA design from scratch. Part 14
FPGA design from scratch. Part 15
FPGA design from scratch. Part 16
FPGA design from scratch. Part 17
FPGA design from scratch. Part 18
FPGA design from scratch. Part 19
FPGA design from scratch. Part 20
FPGA design from scratch. Part 21
FPGA design from scratch. Part 22
FPGA design from scratch. Part 23
FPGA design from scratch. Part 24
FPGA design from scratch. Part 25
FPGA design from scratch. Part 26
FPGA design from scratch. Part 27
FPGA design from scratch. Part 28
FPGA design from scratch. Part 29
FPGA design from scratch. Part 30
FPGA design from scratch. Part 31
FPGA design from scratch. Part 32
FPGA design from scratch. Part 33
FPGA design from scratch. Part 34
FPGA design from scratch. Part 35
FPGA design from scratch. Part 36
FPGA design from scratch. Part 37
FPGA design from scratch. Part 38
FPGA design from scratch. Part 39
FPGA design from scratch. Part 40
FPGA design from scratch. Part 41
FPGA design from scratch. Part 42
FPGA design from scratch. Part 43
FPGA design from scratch. Part 44
FPGA design from scratch. Part 45
FPGA design from scratch. Part 46
FPGA design from scratch. Part 47
FPGA design from scratch. Part 48
FPGA design from scratch. Part 49
FPGA design from scratch. Part 50
Links
Acronyms and abbreviations
XCell Journals
CAD
A hardware designer's best friend
Zoo Design Platform
Linux
Installing Ubuntu Linux on a MacBook
Customizing Ubuntu Linux 1
Customizing Ubuntu Linux 2
Upgrading to Ubuntu 7.04
Install Ubuntu 7.04 with VMware
Making the virtual machine run faster
Ubuntu Links
A processor benchmark
Mac
Porting a Unix program to Mac OS X
Fixing a HyperTerminal in Mac OS X
A dream come true
Wireless freedom
Running
The New York City Marathon
Skiing/Skating
Kittelfjäll Lappland
Tour skating in Sweden and around the world
Top
Introduction
SSSK
Wild skating
Tour day
Safety equipment
A look at the equipment you need
Skate maintenance
Calendar
Links
Books, photos, films and videos
Weather forecasts
Travel
38000 feet above see level
A trip to Spain
Florida the sunshine state


Example Files
Verilog Testbench Body
Verilog Testcase
Verilog Setup
Simulation Result File
Simulation Report File




Photo Albums
Seaside Florida
Ronda Spain
Sevilla Spain
Cordoba Spain
Alhambra Spain
Kittelfjäll Lapland
Landsort Art Walk
Skating on thin ice


Favorites
Adventures in ASIC
ChipHit
Computer History Museum
Community of Sweden
DeepChip
Design & Reuse
Dilbert
EDA Cafe
EDA DesignLine
Embedded.com
EmbeddedRelated.com
FPGA Arcade
FPGA Blog
FPGA Central
FPGA Journal
FPGA World
MacApper
Mac geekery
Mac 2 Ubuntu
Get Perpendicular
Programmable Logic DesignLine
History of Linux
OpenCores
ORSoC
Simplehelp
SOCcentral
World of ASIC



New York City Marathon




If you want to be updated on this weblog Enter your email here:



rss feed



 
Jun 20, 2008
SystemC from scratch. Part 3
Our first example

The best way to learn a new tool or language is to look at some examples already available. The SystemC installation includes a number of examples. Let's take a look at one of them. Here is the example directory.



The FIR filter

We will start with the FIR example. But before we do let's find out a little bit more about FIR filter design. Here is a good place to start:
http://www.dspguru.com/info/faqs/firfaq.htm

FIR (Finite Impulse Response) filters are one of two primary types of digital filters used in Digital Signal Processing (DSP) applications (the other type being IIR). Compared to IIR filters, FIR filters offer the following advantages:
  • They can easily be designed to be "linear phase" (and usually are). Put simply, linear-phase filters delay the input signal, but don't distort its phase.
  • They are simple to implement. On most DSP microprocessors, the FIR calculation can be done by looping a single instruction.
  • They are suited to multi-rate applications. By multi-rate, we mean either "decimation" (reducing the sampling rate), "interpolation" (increasing the sampling rate), or both. Whether decimating or interpolating, the use of FIR filters allows some of the calculations to be omitted, thus providing an important computational efficiency. In contrast, if IIR filters are used, each output must be individually calculated, even if it that output will discarded (so the feedback will be incorporated into the filter).
  • They have desireable numeric properties. In practice, all DSP filters must be implemented using "finite-precision" arithmetic, that is, a limited number of bits. The use of finite-precision arithmetic in IIR filters can cause significant problems due to the use of feedback, but FIR filters have no feedback, so they can usually be implemented using fewer bits, and the designer has fewer practical problems to solve related to non-ideal arithmetic.
  • They can be implemented using fractional arithmetic. Unlike IIR filters, it is always possible to implement a FIR filter using coefficients with magnitude of less than 1.0. (The overall gain of the FIR filter can be adjusted at its output, if desired.) This is an important considertaion when using fixed-point DSP's, because it makes the implementation much simpler.
SystemC FIR example

The SystemC example implements the following program structure:



Running a SystemC simulation

We will start by running a complete SystemC simulation to verify that everything is working. First we goto to the FIR simulation directory:
-> cd /home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/objdir/examples/sysc/fir
We will start by removing all object files: -> rm *.o

Now we can use the makefile that comes with the installation to compile and run the FIR simulation: -> make check
Here is the result:

==> make check
make  fir fir_rtl
make[1]: Entering directory `/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/objdir/examples/sysc/fir'
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o stimulus.o `test -f 'stimulus.cpp' || echo '../../../../examples/sysc/fir/'`stimulus.cpp
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o display.o `test -f 'display.cpp' || echo '../../../../examples/sysc/fir/'`display.cpp
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o fir.o `test -f 'fir.cpp' || echo '../../../../examples/sysc/fir/'`fir.cpp
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o main.o `test -f 'main.cpp' || echo '../../../../examples/sysc/fir/'`main.cpp
g++  -Wall -DSC_INCLUDE_FX -O3   -o fir  stimulus.o display.o fir.o main.o  -L/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/lib-linux -lsystemc -lm
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o fir_fsm.o `test -f 'fir_fsm.cpp' || echo '../../../../examples/sysc/fir/'`fir_fsm.cpp
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o fir_data.o `test -f 'fir_data.cpp' || echo '../../../../examples/sysc/fir/'`fir_data.cpp
g++ -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""  -I. -I../../../../examples/sysc/fir -I/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/include    -Wall -DSC_INCLUDE_FX -O3 -c -o main_rtl.o `test -f 'main_rtl.cpp' || echo '../../../../examples/sysc/fir/'`main_rtl.cpp
g++  -Wall -DSC_INCLUDE_FX -O3   -o fir_rtl  stimulus.o display.o fir_fsm.o fir_data.o main_rtl.o  -L/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/lib-linux -lsystemc -lm
make[1]: Leaving directory `/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/objdir/examples/sysc/fir'
make  check-TESTS
make[1]: Entering directory `/home/svenand/root/projects/SystemC/libraries/systemc-2.2.0/objdir/examples/sysc/fir'


             SystemC 2.2.0 --- Jun  8 2008 12:54:47
        Copyright (c) 1996-2006 by all Contributors
                    ALL RIGHTS RESERVED
Stimuli : 0 at time 9000
Display : 0  at time 10000
Stimuli : 1 at time 19000
Display : -6  at time 20000
Stimuli : 2 at time 29000
Display : -16  at time 30000
Stimuli : 3 at time 39000
Display : -13  at time 40000
Stimuli : 4 at time 49000
Display : 6  at time 50000
Stimuli : 5 at time 59000
Display : 7  at time 60000
Stimuli : 6 at time 69000
Display : -33  at time 70000
Stimuli : 7 at time 79000
Display : -50  at time 80000
Stimuli : 8 at time 89000
Display : 87  at time 90000
Stimuli : 9 at time 99000
Display : 446  at time 100000
Stimuli : 10 at time 109000
Display : 959  at time 110000
Stimuli : 11 at time 119000
Display : 1495  at time 120000
Stimuli : 12 at time 129000
Display : 1990  at time 130000
Stimuli : 13 at time 139000
Display : 2467  at time 140000
Stimuli : 14 at time 149000
Display : 2960  at time 150000
Stimuli : 15 at time 159000
Display : 3466  at time 160000
Stimuli : 16 at time 169000
Display : 3968  at time 170000
Stimuli : 17 at time 179000
Display : 4470  at time 180000
Stimuli : 18 at time 189000
Display : 4972  at time 190000
Stimuli : 19 at time 199000
Display : 5474  at time 200000
Stimuli : 20 at time 209000
Display : 5976  at time 210000
Stimuli : 21 at time 219000
Display : 6478  at time 220000
Stimuli : 22 at time 229000
Display : 6980  at time 230000
Stimuli : 23 at time 239000
Display : 7482  at time 240000
Simulation of 24 items finished at time 240000
SystemC: simulation stopped by user.
PASS: fir


Congratulations! We have run our first SystemC simulation.



Posted at 11:21 am by svenand

robin_ny
July 16, 2009   06:38 AM PDT
 
Hello. First thank you for your efforts. I am learning SystemC and I ran into a trouble trying to installing SCV (SystemC verification) library in Ubuntu 8.04. I followed the INSTALL guides. The SystemC is already installed in the /usr/local/systemc-2.2 directory. I was attemting to install SVC in the /usr/local/svc folder. The ../configure with the prefix and other stuff worked fine. But when I tried "make" it, it gave me two errors. I have used g++ version 4.2.4 for SystemC. I am not sure if this is related to gcc or it is a script issue with sh -h. I run ubuntu is in Sun's virtualbox as well as on a stand alone desktop. (not that it makes any difference). Any help would be appreciated.
svenand
June 24, 2008   07:25 AM PDT
 
I have not planned any SystemC to RTL synthesis. My idea about using SystemC is to build a virtual platform where I can simulate my design using TLM methods. Any inputs on how to do SystemC to RTL synthesis are welcomed.

Sven
robin
June 22, 2008   10:30 PM PDT
 
Just was wondering what is your planned approach to RTL synthesis from SystemC.

I am on similar track to learn SystemC, but have a limited budget and so I have been trying to find open-source tools.

So far the only one I have found is sv2v, a translator from SystemC to Verilog. Unfortunately, this tool does not appear to handle all of SystemC's (V2.2.0) syntax and semantics.

I have looked in SystemCrafter, but only allows for a 2 (?!) day trial period, then it's 3K USD.

Anyway, I would be interested in your thoughts on this.
 

Leave a Comment:

Name


Homepage (optional)


Comments




Previous Entry Home Next Entry