New Horizons






<< November 2006 >>
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



 
Nov 19, 2006
Customizing Ubuntu Linux 1
After installing Ubuntu Linux on my MacBook I need to add more software and to fix a number of setups to make everything run smoothly. In this chapter I will describe the process to make this Linux installation perfect for my needs. I had much help from reading the book Ubuntu Hacks by Jonathan Oxer, Kyle Rankin and Bill Childers. Here is a link to the Unofficial Ubuntu 7.04 Starter Guide.

Look for help

There are many places where you can look for help when you have a problem with Ubuntu Linux. Here are some places:
Software packages

One of Ubuntu's key strengths is the quality of the software packages that are included in the main distribution. They have been relentlessly tested, and come together to form a rock-solid Linux distribution. Although the main Ubuntu distribution is integrated and very solid, that stability comes at a price. Many of the optional packages you may want have been excluded from the main distribution. There are several ways to download and install packages. The most common way is to use the command <apt-get>. The use of <apt-get> and other ways of managing packages are well described in the book Ubuntu Hacks (see Package Management).
To install a new package use the following command :
sudo apt-get install <package-name> or use the use the Synaptic package manager found in the menu: System->Administration->
Synaptic Package Manager

Here is a list of packages I have added and a description of what they are for:

 Package  Description
build-essential GNU C compiler gcc, g++, make
libx11-dev Makes it possible to run X11 applications
libdb-4.1 Needed by Xilinx Coregen
alien Convert rpm package to debian package
sun-java5-jre
Latest version of Java from SUN
sun-java5-plugin
Latest version of Java plugins
mdns-scan
Browse Zeroconf services
avahi-discover
Zeroconf support
avahi-utils
Zeroconf support

libdb-4.1 is an old package not easily found. I downloaded the file libdb4.1-4.1.25-9mdk.i586.rpm and then used the program alien to convert the rpm package to a debian package using the command: sudo alien -c libdb4.1-4.1.25-9mdk.i586.rpm. To install the debian package I used the command: sudo dpkg -i libdb4.1-4.1.25-10_i386.deb.

To install the latest version of Java use the following command:
sudo apt-get install sun-java5-jre sun-java5-plugin
To install Limewire read
Torrentfreak.

Other must-have tools and programs.


Ubuntu Linux comes standard with the gedit text editor. My favorite text editor for many years is nedit. To download nedit go to  Nedit home page. Click the download tab and in the download page click stable binaries and download nedit-5.5-Linux-x86.tar.gz

Just found out about a new text editor called
jEdit. It is written in Java and runs on Mac OS X, Linux, Unix and Windows. I am going to try it.

Portable Document Format (PDF) is an open file format created and controlled by Adobe Systems, for representing two-dimensional documents in a device independent and resolution independent fixed-layout document format.
Xpdf is an open source PDF viewer for the X Window System and Motif. Xpdf runs on practically any Unix-like operating system. To download Xpdf go to the Xpdf download page. Ubuntu comes with the Evince pdf reader installed.


 Program  Decription  Download
 nedit Text editor
 www.nedit.org
 jEdit Text editor   www.jedit.org
 Xpdf PDF reader
 http://www.foolabs.com/xpdf/download.html
 Inkscape Vector Graphics Editor
http://www.inkscape.org

Default shell

In Ubuntu the default shell for /bin/sh is
dash. If you want to use bash in your script files use /bin/bash.

Keyboard mapping

The MacBook keyboard is setup to run Mac OS X and many keys are not defined the way Unix keyboards are setup. It is possible to map the keys any way you want and there is not one standard setup. I will show my setup and you can modify it to fit your needs.

The xmodmap program is used to edit and display the keyboard modifier map and keymap table that are used by client applications to convert event keycodes into keysyms. It is usually run from the user's session startup script to configure the keyboard according to personal tastes. To map a key to a symbol you have to find the keycode and the keysum. To every key you can map up to four different symbols. To map key "9" to the four symbols : 9 ) }] you use the following command:

keycode 18 = 9 parenright braceright bracketright

To find out the keycode for a key you can use the program xev. Start xev and click in the small window, then hit a key and you will see the keycode and keysum displayed. Put all the mapping commands in a file called .Xmodmap and place this file in your home directory. When you login next time you will be asked to include the .Xmodmap file. You can also setup the mapping by running the command: xmodmap ~/.Xmodmap. To see the current mapping execute : xmodmap -pk. The keysum names can be found in the file keysumdef.h. Remove XK_ before you use the name.

Here is my keyboard mapping for my MacBook (I have a Swedish keyboard):

 Keycode  Default  Shift  Alt  Alt shift
64 (Alt left)
Mode_switch



113 (Alt right)
Mode_switch



11
2
quotedbl "at @
12 3 numbersign #
asciitilde ~  
13 4 EuroSign €
dollar $
 
17
8 parenleft (
bracketleft [
braceleft {
18
9
parenright )
bracketright ]
braceright }
35 (¨^)
backslash
bar |


This is what my .Xmodmap file will look like:

! Map left alt key as mode switch
keycode 64   = Mode_switch
! Map right alt key as mode switch
keycode 113 = Mode_switch
keycode 11    = 2 quotedbl at
keycode 12    = 3 numbersign asciitilde
keycode 13    = 4 EuroSign dollar
keycode 17    = 8 parenleft bracketleft braceleft
keycode 18    = 9 parenright bracketright braceright
keycode 35    = backslash bar

Changing screen resolution

In the latest release of Parallels Desktop (build 3150) this problems has been fixed. Parallels will now set the screen resolution to match the display connected.

When you boot Ubuntu Linux for the first time on your MacBook the maximum screen resolution is set to 1024x768. What happens if you connect an external display with a higher resolution. I have a 23 inch Cinema display (1920x1200) hooked up to my MacBook and without changing the resolution I can't use the fullscreen mode.
It is not possible to set the resolution higher than 1024x768 from the menu System->Preferences->Screen Resolution.
To change the maximum resolution you have to run the program:
sudo dpkg-reconfigure -phigh xserver-xorg.
After starting the program a window will be displayed and ask you for a video card driver, leave the vesa marked and then hit Return. In the next window you can enter the video modes to be used . Go down using the arrow down key and when you reach the resolution you would like to use mark it with the space key and then hit Return. The setup will be written to the file /etc/X11/xorg.conf. Next time you boot Ubuntu Linux you will have the maximum resolution changed.

File sharing between Mac OS X and Ubuntu

Parallels has not implemented the same simple file sharing system they have for Windows in Parallels Desktop. But there is a good substitute which I will show you here, the
SharePoints program. The SharePoints program lets you setup one or more shared folders in Mac OS X that can be accessed in Ubuntu Linux. Here is a short descriptions on how to use SharePoints to setup file sharing. But first we have to enable personal file sharing and Windows file sharing in the Mac OS system settings:


  • In Mac OS X download and install the SharePoints program.
  • Start the program.

  • Select a folder to used as a shared folder. I used the Public folder.
  • Give it a name (ParallelsDesktop)
  • Enable both AppleFileServer sharing and Windows sharing.
  • Set the permissions in the popup window

  • Allow Windows guests and set inheritance of permissions if needed.
  • You may have to set group permissions to r/w to allow writing files to Mac OS X.
  • Save the setup.
  • Start Ubuntu Linux and open the Networks Server window in the Places menu
  • Hopefully you will see the shared folder (SVEN-KE-ANDERSS).
  • If you are using VMware double-click the WIndows Network icon.
  • Double-click to look inside and read or write files from/to this folder. Voila!



File sharing using secure shell (ssh)

Secure Shell or SSH is a set of standards and an associated network protocol that allows establishing a secure channel between a local and a remote computer.
The first thing we have to do on the Mac side is to enable remote login (fjärrinlogging) and to find the ip-address (1x.z.1.y). We should also add the .ssh directory in our home directory.




Here is good
description on how to setup and use ssh. Let's follow it.
  1. Open a terminal in Ubuntu Linux
  2. Generate a new key. Use the command ssh-keygen -d
  3. Copy the key to the Mac OS X host using the secure copy cammand.
  4. scp ~/.ssh/id_dsa.pub 1x.z.1.y:.ssh/authorized_keys2
  5. We are now ready to test the ssh command: ssh -X 1x.z.1.y or use ssh -X userid@1x.z.1.y to connect to user <userid>.
  6. We are now remotely logging in to the Mac OS X host and can do almost anything, copying files, starting programs and much more. The DISPLAY variable is automatically set to display windows in the Ubuntu desktop.
  7. If you execute the command echo $DISPLAY you should see something like this: loacalhost:10.0. If the DISPLAY variable is not set read this link to learn what to do.
  8. To exit the ssh session use the command: exit or logout

Printing using an Airport Express

I use an
Airport Express for wireless printing in Mac OS X. Apple uses a technique they call Bonjour to allow printing using a usb printer connected  to their Airport wlan hub. Bonjour lets you create an instant network of computers and and smart devices just by getting them connected to each other. It uses something called Zeroconf or Zero Configuration Networking to setup everything.
To print from Ubuntu Linux to a USB printer connected to an Airport Express we will ignore the Zeroconf method and use the standard
Common Unix Printing System (CUPS) instead. To use CUPS we first have to find the IP address of the Airport Express unit. When we open the Airport Utility program under Mac OS X and scan the network for Airport Extreme and Airport Express units, we will see the following display:

   


The IP address
of the Airport Express is 10.0.1.200.  When we have the IP address we can scan this address to find all open ports. The port scan function built into the Network Tools (System->Administration->Network Tools) utility didn't display all open ports so I decided to install nmap instead. I downloaded and installed nmap-4.20-1.i386.rpm and here is the print out from the program:

==> nmap 10.0.1.200                                                                                         

Starting Nmap 4.20 ( http://insecure.org ) at 2007-03-05 17:30 CET
Interesting ports on 10.0.1.200:
Not shown: 1693 closed ports
PORT      STATE SERVICE
53/tcp    open  domain
5000/tcp  open  UPnP
9100/tcp  open  jetdirect
10000/tcp open  snet-sensor-mgmt

Nmap finished: 1 IP address (1 host up) scanned in 22.035 seconds

The port 9100 is used for printing and it uses a HP jetdirect printer driver. We are now ready to setup for printing to my Epson Stylus Photo 870. To add a new printer open System->Administration->Printing
. Double-click the New Printer icon and follow the instructions.



  1. Select Network Printer
  2. Select HP JetDirect
  3. Enter IP address of Airport Express or Airport Extreme where the printer is connected.
  4. Port number should be 9100
  5. Click Forward

  1. Select printer manufacturer
  2. Select printer model
  3. Select driver type
  4. Click Forward

  1. Enter printer name or use default name
  2. Enter descriptive text
  3. Enter printer location
  4. Click Apply


Select the Stylus-Photo-870 and make it the default printer (Edit->Make D
Posted at 08:17 am by svenand
Comments (5)  

 
Nov 18, 2006
Customizing Ubuntu Linux 2
More fixes

I wanted to add the current directory (.) to my PATH variable and tried to put the command in the .bash_profile file, but it didn't work. When I used the file /etc/profile it did execute. Open the file using the command <sudo nedit /etc/profile> and add the following line : <PATH=.:$PATH> to include the current directory in the PATH variable. When you log in the next time it will be set. If you read the Linux in a Nutshell book it says the following:
Bash reads these files:
1. /etc/profile. Executed automatically at login, first.
2. The first file found from this list: ~/.bash_profile, ~/.bash_login, ~/.profile. Executed automatically at login. Second.
3. ~/.bashrc is read by every shell, after the login files.

I coudn't get ~/.bash_profile and ~/.bash_login to work, but ~/.profile was executed. I put the following line <PATH=~/bin:"${PATH}"> in my .profile to add my bin directory to the PATH variable. Use the command <echo $PATH> to find out if all paths have been added.


Top


Posted at 07:34 pm by svenand
Make a comment  

 
Nov 17, 2006
Ubuntu Links
Posted at 06:47 pm by svenand
Make a comment  

 
Nov 10, 2006
A dream come true
I always dreamed of being able to use my Mac for all my computer tasks both at home and at work. I am an ASIC designer and in my job I use many different CAD (Computer Aided Design) programs. These programs used to run only on big Unix workstations from SUN and HP. But with Linux growing more and more popular they now can run on almost any PC, equipped with a X86 processor.

I bought my first
Apple
computer in 1993, a Macintosh LC III. It had a 32MHz 68030 CPU and 4MB of RAM.

It was a great machine. I used it for everything, playing games like Pacman and Tetris, writing all my documents and organizing the house association. To find out more about the Apple and Macintosh history go to
Low End Mac
or EveryMac.com.









My next Mac was a Performa 5400/180. It was introduced 1996 and had a PowerPC 603e running at 180MHz. It had 16MB of RAM and a 1.6 GB hard drive.









My third Mac was a PowerBook G3/400 codenamed Lombard. It had a PowerPC 750 (G3) processor running at 400MHz and was equipped with  64MB of RAM and  a 6 GB hard drive.






My fourth Mac was a PowerBook G4 1.67. It was introduced in 2005 and had a PowerPC 7447a (G4) running at 1.67 GHz. It had 512MB of RAM and 80GB hard drive.







My fifth Mac is the one I am using today and the one that has given me the possibility to use it for all my computing needs both at home and at work. It is a MacBook Core Duo featuring a 2.0 GHz Intel processor (T2400) with two independent processor cores on a single chip. I had it customized with 1GB of RAM and a 80GB hard drive. It uses the same processor as many PCs are using and lets me install and run  Windows XP and any Linux version I like.



My current setup looks like this. It consists of a MacBook Core Duo with a bluetooth keyboard from Apple  and a bluetooth mouse BT500 from RadTech. The display is a 23-inch Cinema display from Apple. When I leave home I just unplug the display grab the MacBook and have access to Mac OS X, Windows XP and Ubuntu Linux wherever I  go.
 
Posted at 10:36 am by svenand
Comments (4)  

 
Nov 7, 2006
Florida the sunshine state
During a more than one year stay, from October 2000 to January 2002, we (myself, my wife and our daughter) learnt to love Florida, its climate, nature, people and attitude. In September 2000 I was offered a job in US, working for Ericsson Inc as an ASIC designer. A company called Starburst located in Orlando performed the ASIC design project. Working for Starburst was like coming home. You felt like you belonged to the family from the first day you entered the company door.
The RTL design was done at Ericsson in Stockholm Sweden and Starburst did all the backend work, synthesizing the design, running timing verification and generating all test vectors. It was a busy but fantastic year and it was sad when we had to leave Florida to return to Sweden in January 2002. When we came to Stockholm it was  -10C and two feet of snow on the ground.

What we liked best about Florida were the gorgeous beaches. The first thing we did was to buy the book Florida Beaches to start exploring all the places. The front page of the book says "The Only Guide to the Best Places to Eat, Stay, Swim, and Play on Every Beach in the Sunshine State". With the help of this book we went to beaches all over Florida from the Panhandle down to the Keys.

There are so many beautiful beaches in Florida but here are some we liked the most.




Posted at 04:39 pm by svenand
Comment (1)  

 
Nov 5, 2006
The New York City Marathon
It is a chilly morning on Manhattan when we board the bus at 6 am that will take us to the start of the New York City Marathon on Staten Island. I am one of 35000 runners that is going to run the race.  I have had  a good breakfast at the restaurant Manhattan Diner and I am ready for the 26.2 miles through five different boroughs; Staten Island, Brooklyn, Bronx, Queens and Manhattan. The bus takes us to Fort Wadsworth, which is located on Staten Island just south of the Verrazano-Narrows Bridge. Then there is a long wait before the start at 10:10 am.

As a New York City Marathon runner, you'll pond more streets in more parts of the city than many natives get to in a lifetime. The start of the race,
Verrazano-Narrows Bridge is one of the highlights. The bridge was opened in 1964 and it remains the longest suspension bridge in North America, with towers half as tall as the Empire State Building. The top of bridge is also the highest point of the race, 250 feet above see level. On the other side of the bridge is New York's most populous borough, Brooklyn, home to more than two and a half million people. With more than 11 miles of the marathon in Brooklyn I have plenty of time to enjoy its size and diversity.

From the top of the bridge it's downhill. The tension is gone, the body starts to warm up, the sun is shining, there is no wind and the temperature is 10C. It is a perfect day for a marathon. We descend into Brooklyn and Fourth Avenue, which is a wide boulevard, lined with small stores and apartment buildings, with a church, synagogue or mosque seemingly on every corner. Running is easy and I have plenty of time to watch the surroundings and my fellow runners. I stop at every fluid station to drink. In the beginning I drink only water and after half the marathon a mixture of water and Gatorade. After 10 miles we reach
Williamsburgh, one of the world's largest Hasidic Jewish enclaves. Much of Williamsburgh is going through a hipster-artist boom  and  many new restaurants and cafés are popping up. The Pulaski Bridge will take us to Queens where we stay for only 1.5 miles. The climb over the almost mile-and-a-half-long cantilevered Queensboro Bridge, completed in 1909 gives me a great view of the Manhattan skyline on my left. We enter Manhattan on First Avenue and hundred thousands of cheering spectators. My wife waits for me at 69th Street.  A short stop a hug, a kiss and time for taking a few photos.



The neighborhood is now full of restaurants, stores, and modern apartment towers. Some older brownstones and tenements remain north of 90th Street. At 96th Street we enter
East Harlem. We'll pass under the Manhattan approach of Moses's Triborough Bridge at 125th Street to cross the Willis Avenue Bridge, a truss swing bridge that dates from 1901. This brings us to the borough of the Bronx and mile 20. I am still in good shape. My legs are a little bit stiffer but there is no pain and no blisters. We stay in Bronx for only one mile and the Madison Avenue Bridge will take us back to Manhattan and Fifth Avenue. The avenue seems to never end and it is small ascent for several miles. At 110th Street the Central Park begins and on the left is the beginning of Manhattan's Museum Mile. When it is two miles left the course enters into the park. The park is hilly and it is up and down all the time. Now all of a sudden my legs start to give up on me. I have to run slower and slower but I force my self not to start walking.  When I hear the people cheering at the finishing line I get some extra strength and I  cross the finishing line with a big smile. I made it. I finished the New York City Marathon. I get my medal and I am covered with a big warming aluminum blanket. I am so tired and so happy.

All runners have a data chip mounted on one of the shoes. This chip will be read at automatic timing pads and your time will be recorded every 5K. All your split times and your finish time are stored and can be found on the New York City Marathon result page. To see my results, enter my start number 31363.

Posted at 04:06 am by svenand
Comment (1)  

 
Nov 4, 2006
Wireless freedom
When walking around in New York City you will find wireless hotspots almost everywhere. Every Starbucks cafe has a Wi-Fi connection to  connect you to Internet. When we were walking on Prince Street we passed the McNally Robinson bookstore. They had a small cosy cafe where everybody had their laptops on the table and was surfing the web. We walked in and ordered a cappuccino and a tea. The tea was served from a Japanese iron teapot and the cappuccino was the best I have had in New York. I took up my MacBook and in 30 seconds I was connected to Internet.
Posted at 02:24 am by svenand
Make a comment  

 
Nov 1, 2006
38000 feet above see level

I am sitting in an airplane heading for New York. We have been traveling for 5 hours and still have 3 more to go. I have read all the newspapers and magazines I can find and we have been served a tasteless lunch. Airlines try to save money on everything and the food is no exception. I have tried to watch one of the movies on the 12 by 10 cm display in the seat in front of me but lost interest pretty soon. I have navigated through the menu and read about the Airbus 340 and how to exercise sitting in your seat. Flying is boring.

But what cheered me up was the possibility to connect to Internet using the connexion by Boeing service
www.connexionbyboeing.com. The service worked flawlessly and to impress on some of my friends I sent  them an email telling them I am in a airplane on my way to New York. It is sad that this service will  close down end of this year. I guess it wasn't profitable for Boeing. This blog entry is written and published using this service.

I will run the New York Marathon next Sunday. I am one of almost 600 Swedes that have the chance to take part in this great race. The travel agency arranging this trip is called SpringTime Travel
www.springtime.se. Run in Swedish is "springa" which explain the name. I applied for the race more than a year ago and have been running more than 1500 km since than. I have lost 10 kg and was in perfect shape up to a week ago when I caught a cold. The cold is almost gone  and race will take place November 5th so there is still some time to recover.

My wife accompanies me and we will spend some days exploring New York before the marathon. Tomorrow night we have a table reserved at the River Cafe
www.rivercafe.com



Posted at 05:30 pm by svenand
Make a comment  

 
Oct 30, 2006
Starting a blog
I have decided to start my own blog. I have a lot of spare time after leaving my job at Ericsson the telecommunications company. They gave me 18 months pay so I will stay afloat until I find something else to do. My plan is to start my own company and do consulting work in ASIC and FPGA design. I never wrote a diary in my whole life but the prospect of having hundreds of readers makes it more thrilling. I will write about everything that happens in my life from running the marathon to building my own wine cellar. I will write in English although my mother tongue is Swedish. I would like to make contacts all over the world not only in Sweden. That is why I named my blog "New Horizons".

Welcome to my blog!


Posted at 08:33 pm by svenand
Comments (3)  

 
Sep 8, 2006
Verilog Testbench Body

//$$HEADER
/*************************************************************************/
/*                                                                       */
/*                H E A D E R   I N F O R M A T I O N                    */
/*                                                                       */
/*************************************************************************/

// Module:        ETC_TEST
// Design:        ETC
// Written by:    Sven-Ake Andersson
// Description:   Testbench body file for functional testing  of the
//                embedded test controller (ETC)

//$$UPDATE
/*************************************************************************/
/*                                                                       */
/*                U P D A T E   I N F O R M A T I O N                    */
/*                                                                       */
/*************************************************************************/

// Date        Version     Change
//------------------------------------------------------------------------
// 070102       1.0        First version
// 070108       1.1        Changed names of include setup files

//$$DESCRIPTION
/*************************************************************************/
/*                                                                       */
/*                T E S T B E N C H   D E S C R I P T I O N              */
/*                                                                       */
/*************************************************************************/


//$$DEFINE
/*************************************************************************/
/*                                                                       */
/*                  D E F I N E   D I R E C T I V E S                    */
/*                                                                       */
/*************************************************************************/




//$$TIMESCALE
/*************************************************************************/
/*                                                                       */
/*                T I M E S C A L E   D I R E C T I V E                  */
/*                                                                       */
/*************************************************************************/

`timescale 1ns / 10ps


//$$MODULE
/*************************************************************************/
/*                                                                       */
/*                          M O D U L E   S T A R T                      */
/*                                                                       */
/*************************************************************************/

module ETC_TEST();


//$$VERSION
/*************************************************************************/
/*                                                                       */
/*                    V E R S I O N   D E F I N I T I O N S              */
/*                                                                       */
/*************************************************************************/

parameter TestbenchVersion  = 1.1;


//$$PARAMETER
/*************************************************************************/
/*                                                                       */
/*            U S E R  D E F I N E D   P A R A M E T E R S               */
/*                                                                       */
/*************************************************************************/

parameter MaxNumberPins         = 1000;    // Defines array sizes
parameter MaxNumberOfTdiBits    = 4095;    // Maximum number of TDI/TDO data bits
                                        // for one task

//$$TIMING
/*************************************************************************/
/*                                                                       */
/*                          F U N C T I O N A L                          */
/*                         T I M I N G  S E T U P                        */
/*                                                                       */
/*************************************************************************/

parameter    I_CLK_ClockStart        =   0;
parameter    I_CLK_ClockWidth        =  10;
parameter    I_CLK_ClockPeriod       =  20;


//$$PROGRAM DEFINED
/*************************************************************************/
/*                                                                       */
/*         P R O G R A M  D E F I N E D   P A R A M E T E R S            */
/*                                                                       */
/*************************************************************************/

// Set maximum values for counters and memory sizes

parameter PROGRAM_SIZE_MAX           = 1024;    // Maximum size of testprogram ram
parameter WAIT_CYCLES_MAX            = 67108863;   
parameter TRTZ_LOW_CYCLES_MAX        = 4095;   
parameter TMS_HIGH_CYCLES_MAX        = 4095;   

parameter CLOCK_RATE_DIV_BY_4        = 3'b000;
parameter CLOCK_RATE_DIV_BY_8        = 3'b001;
parameter CLOCK_RATE_DIV_BY_16       = 3'b010;
parameter CLOCK_RATE_DIV_BY_32       = 3'b011;
parameter CLOCK_RATE_DIV_BY_64       = 3'b100;

parameter ENABLE_TCK                 = 1'b1;
parameter DISABLE_TCK                = 1'b0;
parameter ENABLE_SINGLE_STEP         = 1'b1;
parameter DISABLE_SINGLE_STEP        = 1'b0;

parameter ENABLE_INTERRUPT           = 1'b1;
parameter DISABLE_INTERRUPT          = 1'b0;

parameter NO_SHIFT_DR                = 12'b0;
parameter NO_SHIFT_IR                = 12'b0;

parameter SAVE_ALL_TDO               = 2'b00;
parameter SKIP_TDO_SHIFTIR           = 2'b01;
parameter SKIP_TDO_SHIFTDR           = 2'b10;
parameter SKIP_TDO_ALL               = 2'b11;

parameter ENABLE_LOOP_MODE           = 1'b1;
parameter DISABLE_LOOP_MODE          = 1'b0;

parameter NOT_USED                   = 2'b0;

parameter STOP_ETC                   = 32'h0;
parameter START_ETC                  = 32'h1;
parameter RESET_ETC                  = 32'h8;



//$$ETC ADDRESSES USED
/*************************************************************************/
/*                                                                       */
/*                   E T C   A D D R E S S   M A P                       */
/*                                                                       */
/*************************************************************************/

parameter  ControlRegister      =  32'h00000200;    // write
parameter  StatusRegister       =  32'h00000204;    // read
parameter  ExecuteRegister      =  32'h00000208;    // write
parameter  DebugRegister        =  32'h0000020c;    // read

parameter  TestProgramMemory    =  32'h00000000;    // write
parameter  TestResultMemory     =  32'h00000100;    // read


//$$CONFIG REGISTER SETUP
/*************************************************************************/
/*                                                                       */
/*               C O N F I G   R E G I S T E R   S E T U P               */
/*                                                                       */
/*************************************************************************/


parameter  BoardTest            =  4'b0000;    // Connect external JTAG tester
parameter  InternalTest         =  4'b0001;    // ETC connects to JTC internally
parameter  ExternalTestDBCincl  =  4'b0010;    // ETC connects externally to the board
parameter  ExternalTestDBCexcl  =  4'b0011;    // ETC connects externally to the board
parameter  SystemTestDBCincl    =  4'b0100;    // ETC connects externally to the system
parameter  SystemTestDBCexcl    =  4'b0101;    // ETC connects externally to the system


//$$ETC INSTRUCTION CODES
/*************************************************************************/
/*                                                                       */
/*               M T C   I N S T R U C T I O N   C O D E S               */
/*                                                                       */
/*************************************************************************/

parameter  NoOperationOpCode             =   4'b0000;
parameter  TestResetTrstzLowOpCode       =   4'b0001;
parameter  TestResetTmsHighOpCode        =   4'b0010;
parameter  LoadInstructionOpCode         =   4'b0011;
parameter  LoadDataOpCode                =   4'b0100;
parameter  LoadInstructionAndDataOpCode  =   4'b0101;
parameter  LoadDataAndInstructionOpCode  =   4'b0110;
parameter  LoadDataPauseOpCode           =   4'b0111;
parameter  LoadDataContinueOpCode        =   4'b1000;
parameter  LoadDataContinuePauseOpCode   =   4'b1001;
parameter  WaitInRunTestIdleOpCode       =   4'b1010;
parameter  PauseInRunTestIdleOpCode      =   4'b1011;
parameter  EndOfTestOpCode               =   4'b1100;


//$$TAP CONTROLLER
/*************************************************************************/
/*                                                                       */
/*             T A P  C O N T R O L L E R   C O N S T A N T S            */
/*                                                                       */
/*************************************************************************/

parameter ASIC_IDCODE           = 32'h14012049;

parameter BoundaryScanRegLen    = 51;
parameter MbistEnableRegLen     = 40;
parameter MbistResultRegLen     =  1;
parameter IdentificationRegLen  = 32;
parameter BypassRegLen          =  1;

//$$TAP_STATES
/*************************************************************************/
/*                                                                       */
/*                 T A P  C O N T R O L L E R   S T A T E S              */
/*                                                                       */
/*************************************************************************/

parameter  TEST_LOGIC_RESET = 4'b1111;  // F
parameter  RUN_TEST_IDLE    = 4'b0100;  // 4
parameter  SELECT_DR_SCAN   = 4'b1100;  // C
parameter  SELECT_IR_SCAN   = 4'b0111;  // 7
parameter  CAPTURE_IR       = 4'b0110;  // 6
parameter  SHIFT_IR         = 4'b1001;  // 9
parameter  EXIT1_IR         = 4'b0010;  // 2
parameter  PAUSE_IR         = 4'b0011;  // 3
parameter  EXIT2_IR         = 4'b0000;  // 0
parameter  UPDATE_IR        = 4'b0101;  // 5 
parameter  CAPTURE_DR       = 4'b1110;  // E
parameter  SHIFT_DR         = 4'b0001;  // 1 
parameter  EXIT1_DR         = 4'b1010;  // A 
parameter  PAUSE_DR         = 4'b1011;  // B
parameter  EXIT2_DR         = 4'b1000;  // 8
parameter  UPDATE_DR        = 4'b1101;  // D 


//$$JTAG INSTRUCTION
/*************************************************************************/
/*                                                                       */
/*                    J T A G   I N S T R U C T I O N S                  */
/*                                                                       */
/*************************************************************************/

// INSTRUCTION OPCODES

 parameter   INSTRUCTION_LENGTH = 4;
 
 parameter   EXTEST           = 4'b0000;
 parameter   IDCODE           = 4'b0010;
 parameter   SAMPLE           = 4'b0011;
 parameter   CLAMP            = 4'b0100;
 parameter   HIGHZ            = 4'b0101;
 parameter   MBIST_ENABLE     = 4'b0110;
 parameter   MBIST_RESULT     = 4'b0111;
 parameter   FAULT_INJECT     = 4'b1000;
 parameter   EXTEST_PULSE     = 4'b1001;
 parameter   EXTEST_TRAIN     = 4'b1010;
 parameter   BYPASS           = 4'b1111;



//$$INTEGER DEFINITIONS
/*************************************************************************/
/*                                                                       */
/*                    I N T E G E R   D E F I N I T I O N S              */
/*                                                                       */
/*************************************************************************/

integer i,j,jj;
integer cycles;
integer Address;
integer TestProgramSize;
integer ExpectedDataSize;
integer LoadModuleSize;
integer HeaderSize;
integer ExpectedDataAddress;
integer ExpectedDataBit;
integer NumberOfTdoDataWords;
integer CompilationError;        // Set when error found during compilation
integer ShiftDataLen;
integer ShiftInstructionLen;
integer DataLenAdjust;
integer DataFinished;
integer FuncErrors;             // Number of functional errors
integer EndOfTestIncluded;      // Set when EndOfTest task included
integer TckClockCount;
integer SystemClockCount;

//$$REAL DEFINITIONS
/*************************************************************************/
/*                                                                       */
/*                       R E A L   D E F I N I T I O N S                 */
/*                                                                       */
/*************************************************************************/



//$$REGISTER DEFINITIONS
/*************************************************************************/
/*                                                                       */
/*                  R E G I S T E R   D E F I N I T I O N S              */
/*                                                                       */
/*************************************************************************/

// Setup register

reg [31:0]   TestProgram    [0:1023];    // Store test program for ETC test
reg [31:0]   ExpectedData   [0:1023];    // Store expected data from ETC test
reg [31:0]   MaskData       [0:1023];    // Store mask data from ETC test

reg [31:0]   TdoSavedData;               // Store data when reading result memory

reg [31:0]   InstructionCode;
reg [31:0]   TdiDataWord;

reg [29:0]   TdiDataTemp;
reg [29:0]   TdiDataFix;


//$$DEVICE PINS
/*************************************************************************/
/*                                                                       */
/*                        D E V I C E  P I N S                           */
/*                                                                       */
/*************************************************************************/

// Found in setup include file


//$$PROGRAM REGISTERS
/*************************************************************************/
/*                                                                       */
/*     R E G I S T E R   U S E D  D U R I N G  S I M U L A T I O N       */
/*                                                                       */
/*************************************************************************/

// These register declarations must not be changed

reg [MaxNumberPins:1]      COMPARE_VALUE; 
reg [MaxNumberPins:1]      MASK_VALUE; 
reg [MaxNumberPins:1]      RESULT_VALUE;

// Log file pointers
reg [31:0]      AllFiles;
reg [31:0]      Report;
reg [31:0]      LoadModule;

reg [8*30:1]    TaskName;               // Store executing task name

reg [ 9 : 0]    DesignIdentity;
reg [ 9 : 0]    TestCaseIdentity;
reg [11 : 0]    TestCaseVersion;
reg [31 : 0]    LoadModuleIdentity;
reg [31 : 0]    TdoRecordingMode;

reg             BusyBit;
reg             PauseBit;
reg             FinishBit;
reg  [3:0]      LoadedTask;
reg  [2:0]      ErrorCode;
reg             PauseShiftDr;
reg  [5:0]      RecAddress;
reg  [4:0]      Reserved;
reg  [15:0]     TdoBitCount;
reg  [15:0]     ExpectedTdoBits;    // Count expected TDO data bits during
                                    // test program compilatio

reg             TimeStamp;

//$$PROBES
/*************************************************************************/
/*                                                                       */
/*               P R O B E S  I N T O  T H E  D E S I G N                */
/*                                                                       */
/*************************************************************************/


wire [3:0] tapstate    = {
          ETC_TEST.ETC_TOP.ASIC_INSTANCE.JTAG_MODULE/TAP_CONTROLLER/TCB_Y4 .D ,
          ETC_TEST.ETC_TOP.ASIC_INSTANCE.JTAG_MODULE/TAP_CONTROLLER/TCB_Y3 .D ,
          ETC_TEST.ETC_TOP.ASIC_INSTANCE.JTAG_MODULE/TAP_CONTROLLER/TCB_Y2 .D ,
          ETC_TEST.ETC_TOP.ASIC_INSTANCE.JTAG_MODULE/TAP_CONTROLLER/TCB_Y1 .D  };
               
              
               
wire shiftdr      = ETC_TEST.ETC_TOP.ASIC_INSTANCE.JTAG_SHIFTDR_STATE;
wire shiftir      = ETC_TEST.ETC_TOP.ASIC_INSTANCE.JTAG_MODULE/JTAG_SHIFTIR ;


`ifdef INTERNAL_TEST
    wire TCK          = ETC_TEST.ETC_TOP.ETC_INSTANCE.JTC_TCK;
`endif

`ifdef EXTERNAL_TEST
    wire TCK          = ETC_TEST.ETC_TOP.ETC_INSTANCE.JTC_TCK;
`endif

`ifdef SYSTEM_TEST
    wire TCK          = ETC_TEST.ETC_TOP.ETC_INSTANCE.JTC_TCK;
`endif

`ifdef BOARD_TEST
    wire TCK          = ETC_TEST.ETC_DBC3_TOP.BOARD_TESTER.ETC_TCKO;
`endif

       
//$$INCLUDE FILES
/*************************************************************************/
/*                                                                       */
/*                        I N C L U D E   F I L E S                      */
/*                                                                       */
/*************************************************************************/

`ifdef INTERNAL_TEST
   `include   "ETC_InternalTestbench.setup"
`endif

`ifdef EXTERNAL_TEST
   `include   "ETC_ExternalTestbench.setup"
`endif

`ifdef SYSTEM_TEST
   `include   "ETC_SystemTestbench.setup"
`endif

`ifdef BOARD_TEST
   `include   "ETC_BoardtestTestbench.setup"
`endif

`include   "ETC_SystemTasks.v"

`ifdef BOARD_TEST
   `include   "ETC_BoardtestTasks.v"
`endif


//$$INITIALIZATION
/*************************************************************************/
/*                                                                       */
/*              I N I T I A L I Z A T I O N  R O U T I N E S             */
/*                                                                       */
/*************************************************************************/


initial
begin

  Address              = 0;
  ExpectedDataAddress  = 0;
  ExpectedDataSize     = 0;
  TestProgramSize      = 0;
  ExpectedDataBit      = 0;
  NumberOfTdoDataWords = 0;
  CompilationError     = 0;
  FuncErrors           = 0;
  MASK_VALUE           = 0;
  COMPARE_VALUE        = 0;
  EndOfTestIncluded    = 0;
  TckClockCount        = 0;
  SystemClockCount     = 0;
  ExpectedTdoBits      = 0;
  TimeStamp            = 1'b0;
  LoadModuleIdentity   = 32'h0;
  TdoRecordingMode     = 32'h0;
  $timeformat(-9, 0, " ns",10);        // 1ns precision
  DesignIdentity       = 9'h171;       // Identifies the design
 
end



/*************************************************************************/
/*                                                                       */
/*                   O P E N  O U T P U T  F I L E S                     */
/*                                                                       */
/*************************************************************************/


initial
 begin

`ifdef MONGOOSE_START

  Report     = $fopen({"result/",`TESTCASE_STRING,".res"});    
  if (Report == 0) $finish;

  LoadModule = $fopen({"result/",`TESTCASE_STRING,".lm"});    
  if (LoadModule == 0) $finish;

`endif

  AllFiles = (Report | 1); 

 end 
 

//$$COUNT CLOCKS
/*************************************************************************/
/*                                                                       */
/*                      C O U N T   C L O C K S                          */
/*                                                                       */
/*************************************************************************/


 always
 
   begin
    @(posedge TCK)  TckClockCount = TckClockCount + 1;
   end


 always
 
   begin
    @(posedge I_CLK)  SystemClockCount = SystemClockCount + 1;
   end



//$$TEST OUTPUT SIGNALS
/*************************************************************************/
/*                                                                       */
/*              T E S T   O U T P U T   S I G N A L S                    */
/*                                                                       */
/*************************************************************************/


 always
 
   begin

    @(posedge TCK) begin

     `ifdef INTERNAL_TEST

       if (ETC_ENB != 1'b0 && FuncErrors == 0) begin
           $fdisplay(AllFiles,"ETC_ENB signal not equal 0");
           FuncErrors = FuncErrors + 1; end
     
     `endif

     `ifdef BOARD_TEST

       if (ETC_ENB != 1'b0 && FuncErrors == 0) begin
           $fdisplay(AllFiles,"ETC_ENB signal not equal 0");
           FuncErrors = FuncErrors + 1; end
     
     `endif

     end

   end


//$$CLOCKS
/*************************************************************************/
/*                                                                       */
/*                      G E N E R A T E  C L O C K S                     */
/*                                                                       */
/*************************************************************************/

// Generate system clock

 always
 
   begin
    #I_CLK_ClockStart I_CLK = 1;
    #I_CLK_ClockWidth I_CLK = 0;
    #(I_CLK_ClockPeriod-I_CLK_ClockStart-I_CLK_ClockWidth);
   end


//$$END OF FILE
/*************************************************************************/
/*                                                                       */
/*                E N D  O F  T E S T B E N C H  B O D Y                 */
/*                                                                       */
/*************************************************************************/

// Endmodule is found in testcase file
-------------------------------------------------------------------------------------------

Posted at 09:13 am by svenand
Make a comment  

Next Page