2020年9月22日星期二

HSpice notes

 ** .OPTIONS
.OPTION POST      // will show all nets
.OPTION POST PROBE     // will only show the nets which declared in .PROBE
.OPTION POSTOP=<N>     // will show down to the N hierachy level from top, .OPTION POST will override this option


** Switching between Two Voltage Sources Connected to the Same Node

You can use the HSPICE voltage controlled voltage source (E-element) to
design a behavioral switch by creating a netlist as follows:

.option post
Vin1 in1 0 pwl ...
$ source 1
Vin2 in2 0 pwl ...
$ source 2
Ein in 0 vol='v(in1)*v(ctrl) + v(in2)*(1-v(ctrl))'
$ behavioral switch
vctrl ctrl 0 pwl 0 1 49n 1 50n 0
$ control voltage
.tran 1n 100n
.end
//In this example, the v(ctrl) value is 1 initially so that v(in)=v(in1). At
//50 ns, the control voltage changes to 0 and v(in)=v(in2).


** output waveform for cscope
.option post_version=2001

** post sim
.option posttop=2     // look for first 2 level signals from top
.option sim_la        // use RC reduction in post sim
.option altcc altchk    // when use .ALTER, reduce netlist process check time

** measure simulated output data without re-run simulation
hspice -i xx.tr0 -meas <meas_file> // reuse the simulated data to measure instead of re-run sim

** auto stop
.option autostop    // stop sim as long as last measurement is completed


** don't print mode data
.option nomod

 

** sim with case sensitive (for the case netlist converted from RTL)

hspice -case -d -i input.sp -o output.lis -mt 10

 

 

calibre hcell file format

 ***** calibre hcell file format *****
i.e.
//layout name    || cdl source name
ABC          DEF        //one to many
ABC          GHI        //one to many
UVW          XYZ        //many to one
RST          XYZ        //many to one
LMN          PQK        //one to one
JFQ          KPT        //one to one

output a shape/net to gds format

 ***** output a shape/net to gds format *****
DRC CHECK MAP "rule_check" GDSII "layer number" "datatype" "filename"
i.e.
Grow_Metal1 { @ Grow metal1 by 0.1u
        SIZE metal1 BY 0.1
    }
DRC CHECK MAP Grow_Metal1 GDSII 21 0 "./mask/grown_m1.gds"

i.e.
LAYER metal metal1 metal2 metal3 // define layer set "metal"
Plot_RESET { @ Output all metal shapes beloging to RESET net
        NET metal RESET
    }
DRC CHECK MAP Plot_RESET GDSII 1 0 "./plots/RESET.gds"

2013年7月30日星期二

Android cupcake development environment

OS requirements
host: linux
x86 32bit OS, android does not support 64bit OS.
gcc version 4.2.3 (32 bit gcc)
our testing env : Mandriva 2008.1 x86-32, Linux 2.6.24.7

virtual machine: windows xp

Compiling Android
Set up compiling environment

Install EABI compatable cross compiler
cp arm-none-linux-gnueabi-4.3.2.tar.bz2 ~/tools/
cd ~/tools/
tar -jxvf arm-none-linux-gnueabi-4.3.2.tar.bz2

install JAVA sdk
cp jdk-1_5_0_17-linux-i586.bin ~/tools/
run the file to install

Note: since Android does not support Java 6 (jdk1.6), we have to install this package (jdk1.5) to compile cupcake.

install Android sdk
cp android-sdk-1.5.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf android-sdk-1.5.tar.bz2

install Eclipse
cp eclipse-android.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf eclipse-android.tar.bz2

Setup path, ie, in bash:

ARM_GCC_PATH=~/tools/arm-none-linux-gnueabi-4.3.2
ANDROID_SDK_PATH=~/tools/android-sdk-1.5
ECLIPSE_PATH=~/tools/eclipse
export JAVA_HOME=~/tools/jdk1.5.0_17
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$PATH:$ARM_GCC_PATH/bin:$JAVA_HOME/bin:$ANDROID_SDK_PATH/tools: $ECLIPSE_PATH

Copy the following souce code to the working place and extract them:
linux source : s3c-linux-2.6.28-Real6410.tar.bz2
u-boot source : s3c-u-boot-1.1.6-Real6410.tar.bz2
android source : cupcake-1.5.2.tar.bz2

Compile u-boot
cd s3c-u-boot-1.1.6-Real6410

edit Makefile, and make sure the compiler set as below
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-none-linux-gnueabi-
endif
one more line:
CROSS_COMPILE =arm-none-linux-gnueabi-
export CROSS_COMPILE

boot from nand flash : run ./make_nand_image → output is “u-boot.bin”
boot from SD card : run ./make_mmc_image → output is “u-boot_mmc.bin”

Compile Linux kernel
cd s3c-linux-2.6.28

edit Makefile, and make sure that the compiler set as below
ARCH ?= arm
CROSS_COMPILE ?= arm-none-linux-gnueabi-

make xconfig to configure the kernel (detailed configuration setup in another page)
make to compile

the compiled image locate in:
arch/arm/boot/zImage

change the name “zImage” to “zImage-android”.

Compile Android (make sure the machine has enough memory, min 1.5G RAM)
cd cupcake-1.5.2
make to compile

OS requirements
host: linux
x86 32bit OS, android does not support 64bit OS.
gcc version 4.2.3 (32 bit gcc)
our testing env : Mandriva 2008.1 x86-32, Linux 2.6.24.7

virtual machine: windows xp

Compiling Android
Set up compiling environment

Install EABI compatable cross compiler
cp arm-none-linux-gnueabi-4.3.2.tar.bz2 ~/tools/
cd ~/tools/
tar -jxvf arm-none-linux-gnueabi-4.3.2.tar.bz2

install JAVA sdk
cp jdk-1_5_0_17-linux-i586.bin ~/tools/
run the file to install

Note: since Android does not support Java 6 (jdk1.6), we have to install this package (jdk1.5) to compile cupcake.

install Android sdk
cp android-sdk-1.5.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf android-sdk-1.5.tar.bz2

install Eclipse
cp eclipse-android.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf eclipse-android.tar.bz2

Setup path, ie, in bash:

ARM_GCC_PATH=~/tools/arm-none-linux-gnueabi-4.3.2
ANDROID_SDK_PATH=~/tools/android-sdk-1.5
ECLIPSE_PATH=~/tools/eclipse
export JAVA_HOME=~/tools/jdk1.5.0_17
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$PATH:$ARM_GCC_PATH/bin:$JAVA_HOME/bin:$ANDROID_SDK_PATH/tools: $ECLIPSE_PATH

Copy the following souce code to the working place and extract them:
linux source : s3c-linux-2.6.28-Real6410.tar.bz2
u-boot source : s3c-u-boot-1.1.6-Real6410.tar.bz2
android source : cupcake-1.5.2.tar.bz2

Compile u-boot
cd s3c-u-boot-1.1.6-Real6410

edit Makefile, and make sure the compiler set as below
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-none-linux-gnueabi-
endif
one more line:
CROSS_COMPILE =arm-none-linux-gnueabi-
export CROSS_COMPILE

boot from nand flash : run ./make_nand_image → output is “u-boot.bin”
boot from SD card : run ./make_mmc_image → output is “u-boot_mmc.bin”

Compile Linux kernel
cd s3c-linux-2.6.28

edit Makefile, and make sure that the compiler set as below
ARCH ?= arm
CROSS_COMPILE ?= arm-none-linux-gnueabi-

make xconfig to configure the kernel (detailed configuration setup in another page)
make to compile

the compiled image locate in:
arch/arm/boot/zImage

change the name “zImage” to “zImage-android”.

Compile Android (make sure the machine has enough memory, min 1.5G RAM)
cd cupcake-1.5.2
make to compile



2012年11月14日星期三

function inside a struct

//---- test function inside struct
typedef struct try {
    void (*init)();
    void (*set)();
    void (*print)();
    int x,y;
} foo;

void init(foo *p)
{
    p->x=0;
    p->y=0;
}

void set(foo *p, int x, int y)
{
    p->x = x;
    p->y = y;
}

void print(foo *p)
{
    printf("x=%d, y=%d\n\r", p->x, p->y);
}

foo *initialize(void)
{
    foo *p   = (foo*)malloc(sizeof(foo));
    p->init  = init;
    p->set   = set;
    p->print = print;
   
    return p;
}

//-------------------------------------
//----- test

foo *p = initialize();
p->init(p);
p->set(p, 10, 2);
p->print(p);
p->set(p, 15, 12);
p->print(p);

2012年10月24日星期三

JLink for Keil ARM

Use STM32F103T8 as an example:

Flash
  --> Configure Flash Tool
    --> Utilities --> Use Target Driver for Flash Programming
           --> select "Cortex-M/R J-LINK/J-Trace
           --> Settings --> Programming Algorithm
           --> Add --> select "STM32F10X Med-density Flash" On-Chip Flash 128K

     -->  Debug
          --> in Use, select "Cortex-M/R J-LINK/J-Trace"

2012年1月30日星期一

Layer mapping

Include the layer map file while stream-in a gds file from other libraries, the format are as below:

#Cadence layer name(by techfile)     Cadence layer purpose     Stream-in layer number(source)     Stream-in data type
  =========================      =================     =========================    =============== 
                Nwell                                              drawing                                         200                                                       0
               Poly                                                 drawing                                         204                                                       0
               Pisland                                            drawing                                         202                                                       0
               Nisland                                           drawing                                         201                                                       0
               Nselect                                            drawing                                         205                                                       0
               Pselect                                             drawing                                        206                                                        0
               Thickox                                          drawing                                        203                                                        0
               Silblk                                              drawing                                         207                                                       0
               Contact                                           drawing                                        208                                                       0
                Met1                                               drawing                                        209                                                       0
                Via1                                               drawing                                        210                                                        0
                Met2                                               drawing                                        211                                                      0
                Via2                                               drawing                                        212                                                       0
                Met3                                              drawing                                         213                                                      0
                HR                                                  drawing                                        214                                                      0
                M1text                                           text                                                226                                                      0
               M2text                                            text                                               227                                                       0
                text                                                 drawing                                        21                                                        0

the layers which did not specified in the layer map file will be ignored when stream-in.