1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
###############################################################################
# Copyright (c) 2002-2024 by Altair Engineering, Inc.
# All rights reserved.
#
# Altair Engineering, Inc. makes this software available as part of the Vision
# tool platform.  As long as you are a licensee of the Vision tool platform
# you may make copies of the software and modify it to be used within the
# Vision tool platform, but you must include all of this notice on any copy.
# Redistribution without written permission to any third party, with or
# without modification, is not permitted.
# Altair Engineering, Inc. does not warrant that this software is error free
# or fit for any purpose.  Altair Engineering, Inc. disclaims any liability for
# all claims, expenses, losses, damages and costs any user may incur as a
# result of using, copying or modifying the software.
# =============================================================================
#   @userware
#       Load NAND
#   @section
#       Load Netlist Data
#   @description
#       Basic transistor example.
#   @files
#       oem/nand.tcl
#   @tag
#       zdb spice
###############################################################################


#
# ==================
# Basic nand example
# ==================
#
# create new database
# ===================
#
set db [zdb new]


# creating a primitives for nmos and pmos
# with ports
#
$db load primitive pmos PMOS
    $db load port D *
    $db load port G *
    $db load port S *

$db load primitive nmos NMOS
    $db load port D *
    $db load port G *
    $db load port S *

# creating hierarchical module
# with ports, instances
# and nets with connectivity
#
$db load module NAND
    $db load port out output
    $db load port in1 input
    $db load port in2 input

    $db load inst p1 pmos
    $db load inst p2 pmos
    $db load inst n1 nmos
    $db load inst n2 nmos
    $db load net out -port out -pin n1 S -pin p2 D -pin p1 D
    $db load net in1 -port in1 -pin n1 G -pin p1 G
    $db load net in2 -port in2 -pin n2 G -pin p2 G
    $db load net ground -flag ground -pin n2 D
    $db load net power -flag power -pin p2 S -pin p1 S
    $db load net w1 -pin n2 S -pin n1 D

# creating top module
# with portBusses, ports, instances
# and nets with connectivity
#
$db load module TOP -top
    $db load portBus A(1:0) input 2 A(1) A(0) -attr pbattr=test1
    $db load portBus B(1:0) input 2 B(1) B(0)
    $db load port A(0) input -attr bit=0
    $db load port A(1) input -attr bit=1
    $db load port B(0) input -attr bit=0
    $db load port B(1) input -attr bit=1
    $db load port Y output

    $db load inst n1 NAND
    $db load inst n2 NAND
    $db load inst n3 NAND

    $db load net A(0) -port A(0) -pin n1 in1
    $db load net A(1) -port A(1) -pin n1 in2
    $db load netBus A 2 A(1) A(0)
    $db load net B(0) -port B(0) -pin n2 in1
    $db load net B(1) -port B(1) -pin n2 in2
    $db load netBus B 2 B(1) B(0)
    $db load net y1 -pin n1 out -pin n3 in2
    $db load net y2 -pin n2 out -pin n3 in1
    $db load net out  -port Y -pin n3 out

# ==========
# Update GUI
#
gui database changed $db