---
name: "addlocap"
section: "3"
platform: "linux"
package: "alliance"
version: "5.1.1-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/addlocap"
---

# addlocap(3)

create a logical capacitor

## NAME

addlocap - create a logical capacitor

## SYNOPSYS

```
#include "mlo.h"
locap_list ∗addlocap(ptfig,type,capa,tcon,bcon,name)
lofig_list ∗ptfig ;
char type ;
double capa ;
losig_list ∗tcon, ∗bcon ;
const char ∗name ;
```

## PARAMETERS

- *ptfig*

  Pointer to the figure in which the capacitor should be added

- *type*

  Capacitor type

- *capa*

  Capacitance value in Farads

- *tcon*

  Pointer to the signal to be connected on the capacitor top plate

- *bcon*

  Pointer to the signal to be connected on the capacitor bottom plate

- *name*

  Capacitor instance name

## DESCRIPTION

**addlocap** creates a new capacitor, and adds it to the list of capacitors pointed to by *ptfig -\> LOCAP*. The new capacitor is  added in front of the list, and becomes itself the list head.\
 The *type* parameter can take two values :

- **CAPMIM**

  for a metal/metal capacitor (the top plate and the bottom plate layers are different metal layers)

- **CAPPNWELL**

  for a POLY/NWELL capacitor (if available in the technology). The top plate layer is POLY, bottom plate is NWELL.

The *capa* argument is the capacitance value in Farads.\
 Two connectors are created each time a capacitor is added, and the *tcon* and *bcon* **losigs** are attached to the *SIG* field of the **locon** of the appropriate connector. The connectors names are *tcon*  (top plate) and *bcon* (bottom plate); their direction, *DIR*, are set to **'P'**, and their *TYPE* **INTERNAL**. For details on the structures, see [**locon**(3)](/locon/3.md) and [**locap**(3)](/locap/3.md).

## RETURN VALUE

**addlocap** returns a pointer to the newly created capacitor.

## ERRORS

**"∗∗∗ mbk error ∗∗∗ illegal capacitor type :** *type***"**

The *type* is not a legal capacitor type.

## EXAMPLE

```
#include "mlo.h"
void parallel_capacitors(void) /∗ netlist of two parallel capacitors ∗/
{
  lofig_list ∗pt  = NULL ;
  losig_list ∗in  = NULL ;
  losig_list ∗out = NULL ;
  pt = addlofig("parallel_capacitors") ;
  addlocon(pt,"in",in = givelosig(pt,0),IN) ;
  addlocon(pt,"out",out = givelosig(pt,1),OUT) ;
  addlocap(pt,CAPMIM,0.5e-6,in,out,"cap1") ;
  addlocap(pt,CAPMIM,0.5e-6,in,out,"cap2") ;
}
```

## SEE ALSO

**mbk**(1), [**lofig**(3)](/lofig/3.md), [**locap**(3)](/locap/3.md), [**locon**(3)](/locon/3.md), [**dellocap**(3)](/dellocap/3.md).
