Applications
Now we have all the tools. Let’s build something interesting. I’ll show 3 example: one analog, one digital, and one mixed.
Now we have all the tools. Let’s build something interesting. I’ll show 3 example: one analog, one digital, and one mixed.
To code SPICE, the main challenges are: how do you keep the component information, and how do you tell which value goes where
After building the framework for nonlinear components, I want to step into transistors. There are two choices:
Time for the inner loop of the SPICE algorithm: nonlinear components!
Here is a set of more linear elements. Voltage sources need an additional row from MNA (instead of supernodes in the Tsividis textbook, because we do want to keep track of every subnode in the supernode)
typedef struct {
int n1, n2, ni; // VSrc has an internal node
float *V;
} VSrc;
// dependent sources
typedef struct {
int n1, n2;
int np, nn, ni;
float A; // gain
} Vcvs;
typedef struct {
int n1, n2;
int np, nn;
float A;
} Vccs;
Register functions
void add_vsrc(int n1,int n2, int ni, float V) {
// ni for an internal node for an extra row in the equation.
Component *c = &comps[ncomps++];
c->type = STA_T;
c->stamp = vsrc_stamp;
c->u.vsrc = (VSrc){n1,n2, ni, V};
}
void add_vcvs(int n1, int n2, int np, int nn, int ni, float A) {
Component *c = &comps[ncomps++];
c->type = STA_T;
c->stamp = vcvs_stamp;
c->u.vcvs = (Vcvs){n1,n2, np,nn, ni, A};
}
void add_vccs(int n1, int n2, int np, int nn, float A) {
Component *c = &comps[ncomps++];
c->type = STA_T;
c->stamp = vccs_stamp;
c->update = NULL;
c->u.vccs = (Vccs){n1,n2, np,nn, A};
}
Update functions ```c /* add an ideal voltage source; stamps a “virtual” node (ni) to the circuit.*/ void vsrc_stamp(Component *c, float Gm[][MAT_SIZE], float I[]) { VSrc *s = &c->u.vsrc; float E = vsrc.V;
Now let’s add another dimension to our simulation: time
This file may not be fully adapted for web. Download the raw file here
git diff
shows unstaged changesgit add
ed)git diff --cached
shows staged changesmmap()
with MAP_SHARED | MAP_ANONYMOUS
, and then fork()
mmap()
with MAP_SHARED
, backed up by a real file with open()
, or virtual file with shm_open()
16 64-bit general purpose registers (super fast memory locations)
How is it implemented? Tracer fork()
s, and the child program becomes the tracee, but before that, makes a syscall ptrace()
, so the parent process can control this.
Executable and Linking Format (for Linux)
readelf
reads executable and finds all informationseald
Single root directory, not necessarily a single device Need to designate a disk to be the root file system For external devices’ file system, need to mount it to some place at that file system
mount -l
shows all mount points/dev/sda1 on / type ext4
students251 on /mnt/disks/aspstudents251 type zfs
dev
: a region for devicessda1
: hard disk devicetype ext4
: Metadata structure to use this deviceVM: Guest OS kernel run on top of a host OS (with the help of specialized software) controlling the actual hardware
ps axf # display process tree
ps axfj # with more info
ps axfjww # even if lines wrap around terminal
#include <signal.h>
int kill(pid_t pid, int signo);
int raise(int signo); // same as kill(), but yourself
pid < 0
, the signal is sent to the process group with pgid == |pid|
open()
int open(const char *path, int oflag, mode_t mode);
mode
for file permission if new file createdAn execution inside a process (two functions in a process running at the same time), sharing the same address space (same heap, same static var, but can’t share stack space) ^4bba4d
#include <pthread.h>
int pthread_create(pthread_t *thread,
const pthread_attr_t *attr,
void *(*start_routine)(void *),
void *arg);
int pthread_join(pthread_t thread, void **retval);
thread
: thread IDattr
: typically NULL
, a fine-grain control of thread behaviorstart_routine
: input void *
, return void *
arg
: for start_routine(arg)
retval
: stores the return value of start_routine()
Returns 0 if OK, error number on failureInteger value manipulated by two methods
sem_post()
)sem_wait()
)No file name, just an fd
#include <unistd.h>
int pipe(int fd[2]);
Kernel prepares a pipe structure, connecting fd[0]
(read) with fd[1]
(write) After fork()
, parent and child will share the same pipe.
close()
unused ends of pipeMaking slow (blocking forever) syscalls nonblocking
open()
with `O_NONBLOCKfcntl()
(file control) to turn on o_NONBLOCK
file status flag on already opened fd-1
and sets errno
to EAGAIN
if were to blockASP notes page
Welcome to AP!
Fundies ODS Notes
Biology video project
ODE final project
CST Final Project
SCHUDEM VIII outstanding award winner
Eco-Literature Final Project
Final project for MATH 312 Analysis I
Final project for PHYS 221 Relativity and Cosmology
HTTP server/client from scratch
Final Project for Computer Networks
SPICE on FPGA
2024
A new Gaussian Process-based modeling framework that predicts the physico-chemical properties of chemical species.
Recommended citation: Cao, X., Gong, M., Tula, A., Chen, X., Gani, R., & Venkatasubramanian, V. (2024). An improved machine learning model for pure component property estimation. Engineering, 39, 61–73. https://doi.org/10.1016/j.eng.2023.08.024
Download Paper
2025
Accurate tracing of grain boundaries in microscopy images is vital in material science, yet current models need more data and a more accurate loss function. In this report, we present a twofold contribution to improving grain-tracing U-nets.
2025
An experimental study of the scattering of ultrasonic compressional waves in an hcp Zn-Sn alloy, serving as an analog to the Fe alloy in Earth’s inner core to better understand the origin of inner core seismic attenuation.
This is a description of your talk, which is a markdown file that can be all markdown-ified like any other post. Yay markdown!
This is a description of your conference proceedings talk, note the different field in type. You can put anything in this field.
Class Tutor, Bard College at Simon's Rock, 2023
Class Tutor, Bard College at Simon's Rock, 2023
Class Tutor, Bard College at Simon's Rock, 2023
Class Tutor, Bard College at Simon's Rock, 2024
Class Tutor, Bard College at Simon's Rock, 2024
Class Tutor, Bard College at Simon's Rock, 2024
TA, Columbia University, 2025