summaryrefslogtreecommitdiff
path: root/src/crossbar_generator.h
blob: b76179b66c238252213c6570d09912d5c2e25b35 (plain)
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
#ifndef CROSSBAR_GENERATOR_H
#define CROSSBAR_GENERATOR_H

#include <stddef.h>

typedef struct {
	/* Physical crossbar dimensions. */
	size_t rows;
	size_t columns;

	/*
	 * Flat row-major input voltages. Offline generation reads
	 * input_series[sample * rows + row] for num_samples samples. Online
	 * generation uses external voltage sources and does not read the values.
	 */
	const double *input_series;
	size_t num_samples;

	/*
	 * Flat row-major initial resistances with rows * columns elements:
	 * initial_resistance[row * columns + column].
	 */
	const double *initial_resistance;

	/* Path to the SPICE model included by the generated netlist. */
	const char *model_path;

	/* Name of the model's SPICE subcircuit. */
	const char *subcircuit_name;

	/* Resistance from each physical column to ground. */
	double load_resistance;

	/* Transient-analysis sample interval and stop time. */
	double time_step;
	double stop_time;

	/* Reserved for state-node output; currently must be 0 or 1. */
	int print_state_nodes;
} Crossbar_Config;

int generate_crossbar(const char *output_filename,
		      const Crossbar_Config *config);

/* Generate a netlist whose row voltages are supplied by libngspice callbacks. */
int generate_online_crossbar(const char *output_filename,
			     const Crossbar_Config *config);

#endif