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

 
Sep 7, 2006
Verilog Testcase

//$$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:   Testcase file for functional testing  


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

// Date        Version    Description
//------------------------------------------------------------------------
// 060322    1.0    First version
// 060719    1.1    New method for generating the testprogram
// 060823    1.11   Added expected data
// 060828    1.12   Modified for OPB interface


//$$CURRENT VERSION
/*************************************************************************/
/*                                                                       */
/*                   C U R R E N T   V E R S I O N                       */
/*                                                                       */
/*************************************************************************/

initial
 begin
    TestCaseIdentity  = 10'ha;      // Identifies the testcase
    TestCaseVersion   = 12'h112;    // Identifies the testcase version
 end
    
//$$TEST DESCRIPTION
/*************************************************************************/
/*                                                                       */
/*                 T E S T   D E S C R I P T I O N                       */
/*                                                                       */
/*************************************************************************/

// JTAG instruction tested : BYPASS
// Scan data through the bypass register and observe the TDO out data
// which will be one TCK clock cycle delayed.



//$$PARAMETERS
/*************************************************************************/
/*                                                                       */
/*                       P A R A M E T E R S                             */
/*                                                                       */
/*************************************************************************/

parameter   MAXIMUM_NUMBER_OF_TCK_CYCLES        =  24'd1000;


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


task CompileTestProgram;

begin

  SetLoadModuleIdentity(DesignIdentity,TestCaseIdentity,TestCaseVersion);
  SetTdoRecordingMode(SKIP_TDO_SHIFTIR);
  TestResetKeepingTrstzLow (10);
  LoadInstruction(INSTRUCTION_LENGTH,BYPASS);
  ReadWriteDataRegister(BypassRegLen+20,{{BypassRegLen{1'b0}},20'b1110011101});
  SetExpectedData(BypassRegLen+20,{20'b1110011101,{BypassRegLen{1'bx}}});
  EndOfTestProgram;


end

endtask



/*************************************************************************/
/*                                                                       */
/*                  S T A R T    T H E   S I M U L A T I O N             */
/*                                                                       */
/*************************************************************************/

initial
begin

/*************************************************************************/
/*                    D I S P L A Y   H E A D E R                        */
/*************************************************************************/

  HeaderDisplay(AllFiles);


/*************************************************************************/
/*                 C O M P I L E   T E S T  P R O G R A M                */
/*************************************************************************/

  CompileTestProgram;
  CompilationCheck;
  if (CompilationError) begin
     $fdisplay(AllFiles,"Errors found during compilation of test program");
     $fdisplay(AllFiles,"Simulation stopped ");
     $finish(2);
   end

  
/*************************************************************************/
/*                S A V E   L O A D   M O D U L E                        */
/*************************************************************************/

  SaveLoadModule;

/*************************************************************************/
/*               D I S P L A Y   T E S T  P R O G R A M                  */
/*************************************************************************/

  DisplayTestProgramRam(TestProgramSize);


/*************************************************************************/
/*                 S E T   I N P U T   C O N D I T I O N S               */
/*************************************************************************/

  SetAllInpinsLow;            // Define all other inputs
  CE1               = 1;      // Default value
  SetAllInpinsFixed;          // Define all fixed inputs 
  SetAllDiffInputsLow;        // Define all differential inputs
  ForceAllIopinsTristated;    // Force all iopins from outside with "z"

/*************************************************************************/
/*                         R E S E T   E T C                             */
/*************************************************************************/

  ResetSystem(10,5);


/*************************************************************************/
/*                   L O A D   T E S T  P R O G R A M                    */
/*************************************************************************/

   LoadTestProgram(TestProgramSize);


/*************************************************************************/
/*             W R I T E   C O N T R O L   R E G I S T E R               */
/*************************************************************************/

  WriteTransfer(ControlRegister,{ENABLE_INTERRUPT,DISABLE_LOOP_MODE,
                                 SKIP_TDO_SHIFTIR,DISABLE_SINGLE_STEP,
                                 ENABLE_TCK,CLOCK_RATE_DIV_BY_8,
                                 ExternalTestDBCexcl});

  TestClockCycles(10);
 

/*************************************************************************/
/*                    S T A R T   T H E   T E S T                        */
/*************************************************************************/

  WriteTransfer(ExecuteRegister,START_ETC); 

/*************************************************************************/
/*         W A I T   F O R  I N T E R R U P T  ( E N D  O F  T E S T )   */
/*************************************************************************/

  WaitForInterrupt(MAXIMUM_NUMBER_OF_TCK_CYCLES);
  TestClockCycles(20);


/*************************************************************************/
/*                    S T O P   T H E   T E S T                          */
/*************************************************************************/

  WriteTransfer(ExecuteRegister,STOP_ETC); 
  TestClockCycles(10);


/*************************************************************************/
/*                      D I S A B L E   T C K                            */
/*************************************************************************/

  WriteTransfer(ControlRegister,{DISABLE_TCK,CLOCK_RATE_DIV_BY_8,
                                 ExternalTestDBCexcl});

  SystemClockCycles(100);


/*************************************************************************/
/*        F I N D   N U M B E R   O F   T D O   B I T S  S T O R E D     */
/*************************************************************************/

  ReadStatusRegisterBits(BusyBit,PauseBit,FinishBit,LoadedTask,PauseShiftDr,
                         RecAddress,Reserved,TdoBitCount);


/*************************************************************************/
/*              T D O   D A T A   C O M P A R I S O N                    */
/*************************************************************************/

  TdoDataComparison(ExpectedDataSize); 



/*************************************************************************/
/*                 D I S P L A Y   T E S T   R E S U L T                 */
/*************************************************************************/

  ResultDisplay(AllFiles);


/*************************************************************************/
/*                F I N I S H   T H E   S I M U L A T I O N              */
/*************************************************************************/

  $finish(2);

end

endmodule

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
Posted at 10:40 am by svenand
Make a comment  

Next Page