Author: Giuliana Beretta
The provided code is a MATLAB program for characterizing and simulating the behavior of a molecular circuit layout using the BBchar software. The program applies to molecular Field-Coupled Nanocomputing (molFCN) circuits designed in MagCAD and is able to:
- automatically generate input files for the simulation of the circuit in SCERPA;
- automatically characterize the circuit in order to provide a look-up-table with the input/output description plus some additional informations regarding timing and area;
- provide the output of a circuit in the library given a geneic combination of the inputs.
Below is the documentation for the launching script code.
The input script is organized into several sections, each addressing different aspects of the molFCN circuit simulation or characterization process. These sections include
- Paths definition
- Clock signal parameters
- Driver parameters
- Termination settings
- SCERPA settings
- Characterization settings
- Launch of the BBchar software
- Example
The launching script begins by defining various file paths for data storage and retrieval
myDataPath
: The root path for data storage.BBcharPath
: Path for BBchar-related files.BBcharCodePath
: Path for BBchar code files.thisPath
: Current working directory.scerpaPath
: Path for SCERPA files.libraryPath
: Path for the library files.outputPath
: Path for storing simulation output.file
: Name of the MagCAD layout file.
Define parameters related to the clock signal used in the simulation.
clock_low
andclock_high
: Low and high voltage levels for the clock signal.clock_step
: Number of steps in the clock signal.pSwitch
,pHold
,pRelease
, andpReset
: Clock signal profiles for different phases.pCycle
: Combined clock signal for a full simulation cycle.
Defines parameters related to the drivers of the circuit. All the variables must be a field of the same matlab structure.
-
doubleMolDriver
: Flag for using double-molecule driver. -
Ninputs
: Number of physical inputs. If a driver is repeated several times in the circuit (repeated input, constant input, bus layout, etc.), it still counts as 1. -
driverNames
: Names of the drivers as they are in the .qll layout file. -
maxVoltage
: Maximum voltage value in volts for the drivers. -
driverModes
: Values assumed by the drivers in the simulations, can be more than 1 value at a time. The possible values are:- sweep: variation vector between '0' and '1' (voltage variation between -
maxVoltage
andmaxVoltage
) - not_sweep: variation vector betwee '1' and '0' (voltage variation between
maxVoltage
and -maxVoltage
) - 0: constant value equal to logic '0'
- 1: constant value equal to logic '1'
- sweep: variation vector between '0' and '1' (voltage variation between -
-
sweepType
: Type of sweep for driver simulation. It can belin
for linear variations orlog
for logarithmic variations. -
NsweepSteps
: Number of steps in the sweep. -
cycleLength
: Length of a complete clock cycle. -
clockStep
: Number of steps in the clock signal. -
NclockRegions
: Number of clock regions. -
phasesRepetition
: Number of times clock regions repeat.
Defines parameters related to termination of the circuit. All the variables must be a field of the same matlab structure.
enableTermination
: Flag for enabling termination addition.customLength
: Custom number of cells for termination.busLayout
: Flag for bus or single line layouts.
Defines parameters related to the SCERPA simulation. Refer to the SCERPA documentation for details.
The program work only for layout generated with MagCAD, so the user must provide the qllFile
and magcadImporter
must be set to 1. Since the program used the AdditionalInformation.txt file generated by SCERPA, the algorithm settings must contain dumpVout
. Plot settings are free.
Defines parameters related to the molecular circuit characterization. All the variables must be a field of the same matlab structure.
LibPath
: Path for the library files.LibDeviceName
: Name of the library folder where the circuit characterization will be stored.out_path
: Path where the simulation results to be used for the characterization are stored.
Launches the BBchar software with specified settings and parameters. The possible commands of the program are related to the following three functionalities:
- SIMULATE: Launch a SCERPA simulation with the specified parameters
- command 'simulate'
- CHARACTERIZE: Starting from a previous SCERPA simulation, it characterize the device and store the library files where indicated.
- command 'characterize'
- LIBRARY EVALUATION: Provide the output of the specified device given the input combination.
- command 'evaluate'
Depending on the function required, the program automatically
- Checks for debug mode and library mode
- Builds the driver and clock matrix.
- Adds termination if enabled.
- Executes BBchar software in the specified mode.
Some sections include comments with "TODO" indicating incomplete parts of the code that need to be filled in.
The example below is the launching script for the simulation of a MUX21 circuit
clear variables
close all
myDataPath = '~';
BBcharPath = fullfile(myDataPath,'BBchar');
BBcharCodePath = fullfile(BBcharPath,'Code');
thisPath = pwd;
scerpaPath = fullfile(myDataPath,'scerpa');
libraryPath = fullfile(BBcharPath, 'Lib');
outputPath = fullfile(BBcharPath,'Layouts','mux21');
file = 'mux21.qll';