camj.analog package
camj.analog.component module
Analog Component Interface
This module contains the high-level interface to configure analog component and performs functional and energy simulation.
Each analog component class contains two main functions, energy() and noise(input_signals).
energy() function calculates the energy of the analog component. noise(input_signals) function
simulates the functional properties with the given input signals.
Examples
To run energy simulation:
>>> energy_number = [analog_component].energy()
To run functional simulation:
>>> output_signals = [analog_component].noise(input_signals)
- class camj.analog.component.AbsoluteDifference(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=1.0, differential=False, i_bias=1e-05, t_readout=1e-09, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectAbsolute Difference
This class models the behavior of absolution difference in analog processing. It can be used to model element-wise subtraction for two matrices of analog signals. This class contains one comparator and one column ampilifer.
The comparator determines which input element is larger. The amplifier first samples the larger input element to the output then subtracts the smaller input element from the larger input element at the output. Note that the digital logic that determines the amplifier’s sampling order based on the comparator’s output is ignored.
This class can be implemented as a pixel-wise component (each pixel contains an abs) or a column-wise component (one-dimensional array to perform absolute difference for all 2D pixel array).
- For instance:
two lists as input signals,
[0, 1, 2, 3]and[3, 2, 1, 0]will output[3, 1, 1, 3]as the result.
To see the details of function modeling, please refer its function
noise().- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
i_bias (float) – [unit: A] bias current of the circuit in comparator.
t_readout (float) – [unit: s] readout time in comparator, during which the comparison is finished.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of an absolute difference. This function takes two input signals and performs absolute difference element-wise.
- Parameters:
input_signal_list (list) – A list of input signals. The length of this list of 2. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.ActiveAnalogMemory(sample_capacitance=2e-12, comp_capacitance=2.5e-12, t_sample=1e-06, t_hold=0.01, supply=1.8, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectActive Analog Memory
This class models the behavior of active analog memory. The model itself consists of a capacitor, a compensation capacitor, and an amplifier which holds the stored analog data through feedback.
- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
sample_capacitance (float) – [unit: F] sample capacitance.
comp_capacitance (float) – [unit: F] compensation capacitance
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ActiveAnalogMemoryEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
Simulate the functional behavior of an acitve analog memory. Here, we use a generic functional modeling class.
- To see the details of function modeling, please refer:
analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 2D/3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.ActiveAverage(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=1, differential=False, noise=None, enable_prnu=False, prnu_std=0.001, enable_offset=False, pixel_offset_voltage=0.1, col_offset_voltage=0.05)
Bases:
objectActive Average
The class performs element-wise average. It is implemented by two column amplifiers. [TODO:fixed]. The two amplifiers first transfer the two input elements to two load capacitors, respectively, then the two capacitors are connected together for charge-redistribution.
- For instance:
if two input signals,
[1, 2, 3]and[3, 4, 5], are used as input innoise()function, the expected output signals will be[2, 3, 4].- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.enable_offset (bool) – flag to enable adding offset voltage. Default value is
False.pixel_offset_voltage – pixel offset voltage in unit of volt (V). Default value is
0.1.col_offset_voltage – column-wise offset voltage in unit of volt (V). Default value is
0.05.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of averaging.
- To see the details of function modeling, please refer:
analog.function_model.ColumnwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.ActiveBinning(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=2, differential=False, noise=None, enable_prnu=False, prnu_std=0.001, enable_offset=False, pixel_offset_voltage=0.1, col_offset_voltage=0.05)
Bases:
objectActive Binning
The class performs binning operations. It is implemented by one column amplifier. The amplifier transfers the input elements sequentially to its load capacitor, and the transferred inputs are averaged at the capacitor by charge-redistribution.
The binning kernel size and stride are determined by the mapped software stage.
- For instance:
if
[[1, 2], [3, 4]]is used as input for a2x2binning, the expected output signals will be[2.5].- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.enable_offset (bool) – flag to enable adding offset voltage. Default value is
False.pixel_offset_voltage – pixel offset voltage in unit of volt (V). Default value is
0.1.col_offset_voltage – column-wise offset voltage in unit of volt (V). Default value is
0.05.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of binning.
- To see the details of function modeling, please refer:
analog.function_model.ColumnwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.ActivePixelSensor(pd_capacitance=1e-13, pd_supply=1.8, dynamic_sf=False, output_vs=1, num_transistor=3, enable_cds=False, fd_capacitance=1e-14, load_capacitance=1e-12, tech_node=130, pitch=4, array_vsize=128, dark_current_noise=0.0, enable_dcnu=False, enable_prnu=False, dcnu_std=0.001, fd_gain=1.0, fd_noise=None, fd_prnu_std=0.001, sf_gain=1.0, sf_noise=None, sf_prnu_std=0.001)
Bases:
objectActive Pixel Sensor Model
Our APS model includes modeling photodiode (PD), floating diffusion (FD), source follower (SF), and parasitic during the readout. This APS model supports energy estimation for both 3T-APS and 4T-APS. Users need to define
num_transistorto get the correct energy estimation.- Input/Output domains:
input domain:
ProcessDomain.OPTICAL.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
pd_capacitance (float) – [unit: F] the capacitance of PD.
pd_supply (float) – [unit: V] supply voltage of pixel.
dynamic_sf (bool) – using dynamic SF or not. In most cases, the in-pixel SF is not dynamic, meaning that it is statically-biased by a constant current. However, some works [JSSC-2021] use dynamic SF to save energy.
output_vs (float) – [unit: V] voltage swing at SF’s output node. Typically it is one or two units of threshold voltage smaller than pd_supply, depending on the pixel’s circuit structure.
num_transistor (int) – {3 or 4}. It defines using 3T APS or 4T APS.
enable_cds (bool) – enabling CDS or not.
fd_capacitance (float) – the capacitance of FD.
load_capacitance (float) – [unit: F] load capacitance at the SF’s output node.
tech_node (int) – [unit: nm] pixel’s process node.
pitch (float) – [unit: um] pixel pitch size (width or height).
array_vsize (int) – the vertical size of the entire pixel array. This is used to estimate the parasitic capacitance on the SF’s readout wire.
dark_current_noise (float) – average dark current noise in unit of electrons (e-).
enable_dcnu (bool) – flag to enable dark current non-uniformity, the default value is
False.enable_prnu (bool) – flag to enable PRNU. Default value is
False.dcnu_std (float) – dcnu standard deviation percentage. it is relative number respect to
dark_current_noise, the dcnu standard deviation is,dcnu_std*dark_current_noise, the default value is0.001.fd_gain (float) – the gain of FD, the default value is
1.0.fd_noise (float) – the standard deviation of FD read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.fd_prnu_std (float) – relative PRNU standard deviation respect to FD gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.sf_gain (float) – the gain of SF, the default value is
1.0.sf_noise (float) – the stadard deviation of SF read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_prnu_std (float) – relative PRNU standard deviation respect to SF gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.
- energy()
Calculate Energy
- This APS model is a wrapper class for its energy model:
analog.energy_model.ActivePixelSensorEnergy.
Please check out this class for more details.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list: list)
Perform functional simulation
This function simulates the signal processing behavior inside APS, including signal processing in photodiode, floating diffusion and source follower. Each input signal in
input_signal_listwill go through each analog componennt functional simulation sequentially.- Please refer to these functions for more detailed descriptions:
Photodiode:
analog.function_model.PhotodiodeFunc.Floating Diffusion:
analog.function_model.FloatingDiffusionFunc.Source Follower:
analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is the simulated result.
- Return type:
Simulation result (tuple)
- class camj.analog.component.Adder(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=1.0, differential=False, columnwise_op=True, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectThis class models the behavior of adder in analog processing. It can be used to model element-wise addition for two matrices of analog signals. This class contains one column ampilifer. [TODO:fixed] The amplifier first samples one input element to the output then accumulates the other input element to the previous input element at the output.
This class can be implemented as a pixel-wise component (each pixel contains an adder) or a column-wise component (one-dimensional array to perform addition for all 2D pixel array).
- For instance:
two lists as input signals,
[0, 1, 2, 3]and[3, 2, 1, 0]will output[3, 3, 3, 3]as the result.
To see the details of function modeling, please refer its function
noise().- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
columnwise_op (bool) – flag to set if this operation is column-wise or not. This flag will affect the PRNU.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of an adder. This function takes two input signals and adds them together element-wise. Because we implement this adder using amplifier, the input signals are first read by amplifiers and then add together. Here, we model this behavior by first simulating the noise effects on these two inputs and then adding the noising outputs (out of the amplifier) together.
- Parameters:
input_signal_list (list) – A list of input signals. The length of this list of 2. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.AnalogReLU(supply=1.8, i_bias=1e-05, t_readout=1e-09, enable_prnu=False, prnu_std=0.001)
Bases:
objectAnalog ReLU
This class performs ReLU operation using analog comparator. Funtionally, this class performs ReLU after getting the convolutional results: the class outputs 0 when the result is negative and outputs the result as-is when the result is positive. Note that in real circuits the analog ReLU is performed before getting the convolutional results: the convolutional results are stored at two memories (positive part and negative part) based on the output polarity. If the positive part is smaller than the negative part, the output is set to 0; otherwise, the ReLU transfers the two parts as-is to the next analog processing stage. No subtractor is needed since the next stage usually takes differential inputs.
- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
supply (float) – [unit: V] supply voltage.
i_bias (float) – [unit: A] bias current of the circuit.
t_readout (float) – [unit: s] readout time, during which the comparison is finished.
enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain, the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ComparatorEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of ReLU operation.
- To see the details of function modeling, please refer:
analog.function_model.ComparatorFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.AnalogToDigitalConverter(supply=1.8, type='SS', fom=1e-13, resolution=8, adc_noise=0.0)
Bases:
objectAnalog-to-Digital Converter.
This class model the behavior of ADC.
- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.DIGITAL.
- Parameters:
supply (float) – [unit: V] supply voltage.
type (str) – ADC type.
fom (float) – [unit: J/conversion] ADC’s Figure-of-Merit, expressed by energy per conversion.
resolution (int) – ADC resolution.
adc_noise (float) – ADC noise.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.AnalogToDigitalConverterEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of a ADC. The output value range depends on the
resolutionparameter. For instance, whenresolution = 8, the output value range is[0, 256).- To see the details of function modeling, please refer:
analog.function_model.AnalogToDigitalConverterFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.BinaryWeightConv(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=2, differential=False, noise=None, enable_prnu=False, prnu_std=0.001, enable_offset=False, pixel_offset_voltage=0.1, col_offset_voltage=0.05)
Bases:
objectBinary Weight Convolution [TODO: questionable]
This class performs binary convolution operations in analog domain. All the kernel weights in this convolution operation should be either
-1or1. The convolution is realized by driving all positive weight input signals to one capacitor and all negative ones to another capacitor, and then, uses a comparator to generate the final output.Note
Map corresponding
WeightInputin software pipeline definition directly to this class for correct functional simulation.- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
noise (float) – the standard deviation of read noise. Default value is
None.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.enable_offset (bool) – flag to enable adding offset voltage. Default value is
False.pixel_offset_voltage – pixel offset voltage in unit of volt (V). Default value is
0.1.col_offset_voltage – column-wise offset voltage in unit of volt (V). Default value is
0.05.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of convolution operation. This function inherits some functionalities from
analog.function_model.ColumnwiseFunc.- To see the details of function modeling, please refer:
analog.function_model.ColumnwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. One input should be input signal and the other one should be weight signal.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.ColumnAmplifier(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=2, gain_open=256, differential=False, gain=1, noise=None, enable_prnu=False, prnu_std=0.001, enable_offset=False, pixel_offset_voltage=0.1, col_offset_voltage=0.05)
Bases:
objectColumn Amplifier
The class models the hardware behavior of a typical column amplifier. It includes an input capacitor, a feedback capacitor, a load capacitor, and an amplifier. This amplifier can be used either as pixel array’s column amplifier or as a general-purpose switched-capacitor amplifier, such as switched-capacitor integrator, switched-capacitor subtractor, and switched-capacitor multiplier.
- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
gain (float) – the average gain. Default value is
1.0.noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.enable_offset (bool) – flag to enable adding offset voltage. Default value is
False.pixel_offset_voltage – pixel offset voltage in unit of volt (V). Default value is
0.1.col_offset_voltage – column-wise offset voltage in unit of volt (V). Default value is
0.05.
- energy()
Calculate Energy
- This class supports both energy modeling and functional modeling. The details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the signal processing behavior of column amplifier. Each input signal in
input_signal_listwill perform functional simulation sequentially.- To see the details of function modeling, please refer:
analog.function_model.ColumnwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.Comparator(supply=1.8, i_bias=1e-05, t_readout=1e-09, enable_prnu=False, prnu_std=0.001)
Bases:
objectDynamic Voltage Comparator
The class models the behavior of dynamic voltage comparator.
Note
The functional simulation of this class is slightly different than the actual analog comparator. In the actual comparator, it compares the two different input signals (
In1andIn2) and output eitherVdd(ifIn1>=In2) or0(ifIn1<In2). Here, in order to support other computations, we modified the output of the comparator to beIn1(ifIn1>=In2) or0(ifIn1<In2).- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
supply (float) – [unit: V] supply voltage.
i_bias (float) – [unit: A] bias current of the circuit.
t_readout (float) – [unit: s] readout time, during which the comparison is finished.
enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ComparatorEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of a comparator.
- To see the details of function modeling, please refer:
analog.function_model.ComparatorFunc.
- Parameters:
input_signal_list (list) – A list of input signals. The length of this list is 2. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.CurrentMirror(supply=1.8, load_capacitance=2e-12, t_readout=1e-06, i_dc=1e-06, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectCurrent Mirror.
This class models the behavior of current mirror. The class models a constant current path and a load capacitor.
Note
This class can perform current duplication or current-time multiplication depending on user’s definition. When
i_dcis not None, this class will perform current duplication and the output signal domain is current. Otherwise, this class performs current-time multiplication and accumulate the charges on its own load capacitor. The output signal domain would be voltage.- Input/Output domains:
input domain:
ProcessDomain.CURRENTandProcessDomain.TIME.output domain: if
i_dcisNone, thenProcessDomain.VOLTAGE, else,ProcessDomain.CURRENT.
- Parameters:
supply (float) – [unit: V] supply voltage.
load_capacitance (float) – [unit: F] load capacitance.
t_readout (float) – [unit: s] readout time, during which the constant current drives the load capacitance from 0 to VDD.
i_dc (float) – [unit: A] the constant current. If
i_dc == None, then i_dc is estimated from the other parameters.noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. The default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.CurrentMirrorEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of an current mirror.
Note
This function accepts two types of inputs. When the length of
input_signal_listis1. This function will perform copy operation that directly copy the input signal to the output signal with noise simulation. When the length ofinput_signal_listis2. This function will perform element-wise multiplication. One input is the time signal and the second one is the current signal.- To see the details of function modeling, please refer:
analog.function_model.CurrentMirrorFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array. The length of
input_signal_listshould be either1or2.- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.DigitalPixelSensor(pd_capacitance=1e-13, pd_supply=1.8, dynamic_sf=False, output_vs=1, num_transistor=3, enable_cds=False, fd_capacitance=1e-14, load_capacitance=1e-12, tech_node=130, pitch=4, array_vsize=128, adc_type='SS', adc_fom=1e-13, adc_reso=8, dark_current_noise=0.0, enable_dcnu=False, enable_prnu=False, dcnu_std=0.001, fd_gain=1.0, fd_noise=None, fd_prnu_std=0.001, sf_gain=1.0, sf_noise=None, sf_prnu_std=0.001, cds_gain=1.0, cds_noise=None, cds_prnu_std=0.001, adc_noise=0.0)
Bases:
objectDigital Pixel Sensor
This class models the energy consumption of digital pixel sensor (DPS). This DPS class models behavior of a APS and an per-pixel ADC.
- Input/Output domains:
input domain:
ProcessDomain.OPTICAL.output domain:
ProcessDomain.DIGITAL.
- Parameters:
pd_capacitance (float) – [unit: F] the capacitance of PD.
pd_supply (float) – [unit: V] supply voltage of pixel.
dynamic_sf (bool) – using dynamic SF or not. In most cases, the in-pixel SF is not dynamic, meaning that it is statically-biased by a constant current. However, some works [JSSC-2021] use dynamic SF to save energy.
output_vs (float) – [unit: V] voltage swing at SF’s output node. Typically it is one or two units of threshold voltage smaller than pd_supply, depending on the pixel’s circuit structure.
num_transistor (int) – {3 or 4}. It defines using 3T APS or 4T APS.
enable_cds (bool) – enabling CDS or not.
fd_capacitance (float) – [unit: F] the capacitance of FD.
load_capacitance (float) – [unit: F] load capacitance at the SF’s output node.
tech_node (int) – [unit: nm] pixel’s process node.
pitch (float) – [unit: um] pixel pitch size (width or height).
array_vsize (int) – the vertical size of the entire pixel array. This is used to estimate the parasitic capacitance on the SF’s readout wire.
adc_type (str) – the actual ADC type. Please check ADC class for more details.
adc_fom (float) – [unit: J/conversion] ADC’s Figure-of-Merit, expressed by energy per conversion.
adc_resolution (int) – ADC’s resolution.
8stands for 8-bit digital resolution, [0, 256).dark_current_noise (float) – average dark current noise in unit of electrons (e-).
enable_dcnu (bool) – flag to enable dark current non-uniformity, the default value is
False.enable_prnu (bool) – flag to enable PRNU. Default value is
False.dcnu_std (float) – dcnu standard deviation percentage. it is relative number respect to
dark_current_noise, the dcnu standard deviation is,dcnu_std*dark_current_noise, the default value is0.001.fd_gain (float) – the gain of FD, the default value is
1.0.fd_noise (float) – the stadard deviation of FD read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.fd_prnu_std (float) – relative PRNU standard deviation respect to FD gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.sf_gain (float) – the gain of SF, the default value is
1.0.sf_noise (float) – the stadard deviation of SF read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_prnu_std (float) – relative PRNU standard deviation respect to SF gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.cds_gain (float) – the gain of CDS, the default value is
1.0.cds_prnu_std (float) – relative PRNU standard deviation respect to CDS gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.adc_noise (float) – the standard deviation of read noise from ADC. the default value is
0..
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.DigitalPixelSensorEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the signal processing behavior inside DPS, including signal processing in photodiode, floating diffusion, source follower and ADC. Each input signal in
input_signal_listwill perform functional simulation sequentially.- To see the details of function modeling, please refer:
Photodiode:
analog.function_model.PhotodiodeFunc.Floating Diffusion:
analog.function_model.FloatingDiffusionFunc.Source Follower:
analog.function_model.PixelwiseFunc.Correlated Double Sampling:
analog.function_model.CorrelatedDoubleSamplingFunc.Analog-To-Digital Converter:
analog.function_model.AnalogToDigitalConverterFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is the simulated result.
- Return type:
Simulation result (tuple)
- class camj.analog.component.DigitalToCurrentConverter(supply=1.8, load_capacitance=2e-12, t_readout=1.6e-05, gain=3.90625e-08, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectDigital-to-Current Converter
This class models the behavior of Digital-to-Current Converter. This model consists of a constant current path and a load capacitor.
- Input/Output domains:
input domain:
ProcessDomain.DIGITAL.output domain:
ProcessDomain.CURRENT.
- Parameters:
supply (float) – [unit: V] supply voltage.
load_capacitance (float) – [unit: F] load capacitance.
t_readout (float) – [unit: s] readout time, during which the constant current drives the load capacitance from 0 to VDD.
gain (float) – the average gain. Default value is
10e-6/256in unit of [A/digital number]. Here, we assume the maximum current is 10 uA and the input digital resolution is 8 bits.noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.DigitalToCurrentConverterEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of a DAC.
- To see the details of function modeling, please refer:
analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.GeneralCircuit(supply=1.8, t_operation=0.03, i_dc=1e-06)
Bases:
objectA model for general circuits from first principle.
TODO: Tianrui.
Note
This class is just a rough estimation for its energy, no functional simulation is implemented.
- Parameters:
supply (float) – [unit: V] supply voltage.
t_operation (float) – [unit: s] operation time, during which the circuit completes its particular operation.
i_dc (float) – [unit: A] direct current of the circuit.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
- class camj.analog.component.MaxPool(supply=1.8, t_hold=0.03, t_readout=1e-06, load_capacitance=1e-12, gain=10, noise=None)
Bases:
objectMax Pooling
This class performs max pooling in analog processing. The model consists of a constant current path, a group of common-source amplifiers, and a load capacitor.
Based on the mapping software stage, it will perform max pooling with the given kernel size.
- For instance:
If the input signal is a 2D matrix,
[[1, 1], [2, 3]], a2x2max pooling will output[[3]]as the result.- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
supply (float) – [unit: V] supply voltage.
t_hold (float) – [unit: s] holding time, during which the circuit is turned on and consumes power relentlessly.
t_readout (float) – [unit: s] readout time, during which the maximum voltage is output.
load_capacitance (float) – [unit: F] load capacitance
gain (float) – open-loop gain of the common-source amplifier.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.
- energy()
Calculate Energy
Here, we use some functionalities of
analog.energy_model.MaximumVoltageEnergyto model the energy of this class.- To see the details of energy modeling, please check out:
analog.energy_model.MaximumVoltageEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of an max pooling.
Here, we use some functionalities of
analog.energy_model.MaximumVoltageFuncto model the noise simulation of this class.- To see the details of function modeling, please refer:
analog.function_model.MaximumVoltageFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.MaximumVoltage(supply=1.8, t_hold=0.03, t_readout=1e-06, load_capacitance=1e-12, gain=10, noise=None)
Bases:
objectMaximum Voltage
A circuit that outputs the maximum voltage among the input voltages. The output of its
noise()function takes a list of input signals matrices and compare element-wise across those input signals. The return of “noise()” is the maximum value for each element-wise comparison across those input signals.- For instance:
two lists as input signals,
[0, 1, 2, 3]and[3, 2, 1, 0]will output[3, 2, 2, 3]as the result.- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
supply (float) – [unit: V] supply voltage.
t_hold (float) – [unit: s] holding time, during which the circuit is turned on and consumes power relentlessly.
t_readout (float) – [unit: s] readout time, during which the maximum voltage is output.
load_capacitance (float) – [unit: F] load capacitance
gain (float) – open-loop gain of the common-source amplifier.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.MaximumVoltageEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of a maximum voltage. This function takes a list of input signals and performs element-wise max comparison. The output of this function is a list of signal with length of 1.
- To see the details of function modeling, please refer:
analog.function_model.MaximumVoltageFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.PassiveAnalogMemory(sample_capacitance=1e-12, supply=1.8, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectPassive Analog Memory
This class models the behavior of passive analog memory. The model only contains a sample capacitor. Compared to active analog memory, it has higher data leakage rate.
- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
sample_capacitance (float) – [unit: F] sample capacitance.
supply (float) – [unit: V] supply voltage.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.PassiveAnalogMemoryEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
Simulate the functional behavior of an passive analog memory. The functional behavior of this component is used a generic noise model.
- To see the details of function modeling, please refer:
analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 2D/3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.PassiveAverage(capacitance_array, vs_array, sf_load_capacitance=1e-12, sf_supply=1.8, sf_output_vs=1, sf_bias_current=5e-06, psca_noise=None, sf_noise=None, sf_enable_prnu=False, sf_prnu_std=0.001)
Bases:
objectPassive Average
The class performs element-wise average. It uses passive switched capacitor array to realize the functionality of averaging (charge redistribution) and uses source followers for signal readout.
- For instance:
if two input signals,
[1, 2, 3]and[3, 4, 5], are used as input innoise()function, the expected output signals will be[2, 3, 4].- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
capacitance_array (array, float) – [unit: F] a list of capacitors.
vs_array (array, float) – [unit: V] a list of voltages that corresponds to the voltage swing at each capacitor.
sf_load_capacitance (float) – [unit: F] load capacitance.
sf_supply (float) – [unit: V] supply voltage.
sf_output_vs (float) – [unit: V] voltage swing at the SF’s output node.
sf_bias_current (float) – [unit: A] bias current.
psca_noise (float) – the stadard deviation of passive switched capacitor array’s read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_noise (float) – the stadard deviation of SF read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_enable_prnu (bool) – flag to enable SF PRNU. Default value is
False.sf_prnu_std (float) – the relative prnu standard deviation respect to SF gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
Passive average inherits some of the functionalities of the energy class below.
- To see the details of energy modeling, please check out:
analog.energy_model.PassiveSwitchedCapacitorArrayEnergy.analog.energy_model.SourceFollowerEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of an averaging.
- To see the details of function modeling, please refer:
analog.function_model.PassiveSwitchedCapacitorArrayFunc.analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.PassiveBinning(capacitance_array, vs_array, sf_load_capacitance=1e-12, sf_supply=1.8, sf_output_vs=1, sf_bias_current=5e-06, psca_noise=None, sf_noise=None, sf_enable_prnu=False, sf_prnu_std=0.001)
Bases:
objectPassive Binning
The class performs binning operations. It uses passive switched capacitor array to realize the functionality of binning (via charge redistribution) and uses source followers for signal readout.
The binning kernel size and stride are determined by the mapped software stage.
- For instance:
if
[[1, 2], [3, 4]]is used as input for a2x2binning, the expected output signals will be[2.5].- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
capacitance_array (array, float) – [unit: F] a list of capacitors.
vs_array (array, float) – [unit: V] a list of voltages that corresponds to the voltage swing at each capacitor.
sf_load_capacitance (float) – [unit: F] load capacitance.
sf_supply (float) – [unit: V] supply voltage.
sf_output_vs (float) – [unit: V] voltage swing at the SF’s output node.
sf_bias_current (float) – [unit: A] bias current.
psca_noise (float) – the stadard deviation of passive switched capacitor array’s read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_noise (float) – the stadard deviation of SF read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_enable_prnu (bool) – flag to enable SF PRNU. Default value is
False.sf_prnu_std (float) – the relative prnu standard deviation respect to SF gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.PassiveSwitchedCapacitorArrayEnergy.analog.energy_model.SourceFollowerEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of binning.
- To see the details of function modeling, please refer:
analog.function_model.PassiveSwitchedCapacitorArrayFunc.analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.PassiveSwitchedCapacitorArray(capacitance_array, vs_array, noise=None)
Bases:
objectPassive Switched Capacitor Array
The model consists of a list of capacitors and a list of voltages that corresponds to the voltage swing at each capacitor. The model is used to represent all passive switched-capacitor computational circuits, including charge-redistribution-based MAC operation.
Note
The default behavior of this class is to perform element-wise accumulation. For instance, if
input_signal_listis[np.array([1, 2, 3]), np.array([1, 2, 3]), np.array([1, 2, 3])], the output fromnoisefunction isnp.array([3, 6, 9]). For achieve functionality of convolution, please check outanalog.component.Voltage2VoltageConv.- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
capacitance_array (array, float) – [unit: F] a list of capacitors.
vs_array (array, float) – [unit: V] a list of voltages that corresponds to the voltage swing at each capacitor.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.PassiveSwitchedCapacitorArrayEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of a passive switched capacitor array.
- To see the details of function modeling, please refer:
analog.function_model.PassiveSwitchedCapacitorArrayFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.PulseWidthModulationPixel(pd_capacitance=1e-13, pd_supply=1.8, array_vsize=126, ramp_capacitance=1e-12, gate_capacitance=1e-14, num_readout=1)
Bases:
objectPulse-Width-Modulation (PWM) Pixel
The modeled PWM pixel consists of a photodiode (PD), a ramp signal generator, and a comparator. The comparator output toggles when the ramp signal is smaller than the pixel voltage at PD.
This PWM pixel class ONLY supports energy modeling, currently no functional modeling.
- Input/Output domains:
input domain:
ProcessDomain.OPTICAL.output domain:
ProcessDomain.TIME.
- Parameters:
pd_capacitance – PD capacitance.
pd_supply – PD voltage supply.
array_vsize – , the vertical size of the pixel array. For A
720x1280(H, W) resolution pixel array, its vertical size is720.ramp_capacitance – the capacitance of ramp signal generator.
gate_capacitance – the gate capacitance of readout transistor.
num_readout – number of read from pixel.
- energy()
Calculate Energy
For energy modeling, please check out
analog.energy_model.PulseWidthModulationPixelEnergyfor more details.- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
TODO: (tianrui)
Note
Currently, we don’t support the functional simulation for PWM pixels,
input_signal_listwill be directly returned ny this function.- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is the simulated result.
- Return type:
Simulation result (tuple)
- class camj.analog.component.SourceFollower(load_capacitance=1e-12, supply=1.8, output_vs=1, bias_current=5e-06, gain=1.0, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectSource Follower
This class models the behavior of source follower. It can be applied to not only the single-transistor source follower but also flipped-voltage-follower (FVF).
- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
supply (float) – [unit: V] supply voltage.
output_vs (float) – [unit: V] voltage swing at the SF’s output node.
bias_current (float) – [unit: A] bias current.
gain (float) – the average gain. Default value is
1.0.noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.SourceFollowerEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
Simulate the functional behavior of a source follower. Here, we use a generic functional modeling class to model source follower.
- To see the details of function modeling, please refer the pixel-wise generic modeling class:
analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.Subtractor(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=1.0, differential=False, columnwise_op=True, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectThis class models the behavior of subtractor in analog processing. It can be used to model element-wise subtraction for two matrices of analog signals. This class contains one column ampilifer. The amplifier first samples one input element to the output then subtracts the other input element from the previous input element at the output.
This class can be implemented as a pixel-wise component (each pixel contains an sub) or a column-wise component (one-dimensional array to perform subtraction for all 2D pixel array).
- For instance:
two lists as input signals,
[0, 1, 2, 3]and[3, 2, 1, 0]will output[-3, -1, 1, 3]as the result.
To see the details of function modeling, please refer its function
noise().- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance.differential (bool) – if using differential-input amplifier or single-input amplifier.
noise (float) – the stadard deviation of read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.ColumnAmplifierEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of an subtractor. This function takes two input signals (
In1andIn2) and subtractIn2fromIn1element-wise.- Parameters:
input_signal_list (list) – A list of input signals. The length of this list of 2. Each input signal should be a 3D array.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.Time2VoltageConv(cm_supply=1.8, cm_load_capacitance=2e-12, cm_t_readout=1e-06, cm_i_dc=1e-06, am_sample_capacitance=1e-12, am_supply=1.8, cm_noise=None, cm_enable_prnu=False, cm_prnu_std=0.001, am_noise=None, am_enable_prnu=False, am_prnu_std=0.001)
Bases:
objectTime-to-Voltage Convolution
This class performs convolution operations in analog domain. The convolution is realized by current mirror, the input current is used as kernel weight and the time signal from PWM pixel is used as input in convolution layer. Passive Analog Memory is used to store convolution output. [TODO:fixed] The memory accumulates convolutional partial sums sequentially.
Note
Map corresponding
WeightInputin software pipeline definition to aDigitalToCurrentConverterand then connect theDigitalToCurrentConverterto this class for correct functional simulation.- Input/Output domains:
input domain:
ProcessDomain.CURRENTandProcessDomain.TIME.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
cm_supply (float) – [unit: V] supply voltage of current mirror.
cm_load_capacitance (float) – [unit: F] load capacitance of current mirror.
cm_t_readout (float) – [unit: s] readout time of current mirror, during which the constant current drives the load capacitance from 0 to VDD.
cm_i_dc (float) – [unit: A] the constant current of current mirror. If
i_dc == None, then i_dc is estimated from the other parameters.am_sample_capacitance (float) – [unit: F] sample capacitance of passive analog memory.
am_supply (float) – [unit: V] supply voltage of passive analog memory.
cm_noise (float) – the standard deviation of current mirror read noise. Default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.cm_ennable_prnu (bool) – flag to enable PRNU of current mirror. Default value is
False.cm_prnu_std (float) – the relative PRNU standard deviation respect to current mirror gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.am_noise (float) – the standard deviation of analog memory read noise. Default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.am_ennable_prnu (bool) – flag to enable PRNU of analog memory. Default value is
False.am_prnu_std (float) – the relative PRNU standard deviation respect to gain of analog memory. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.CurrentMirrorEnergy.analog.energy_model.PassiveAnalogMemoryEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of convolution operation.
- To see the details of function modeling, please refer:
analog.function_model.CurrentMirrorFunc.analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. One input should be input signal and the other one should be weight signal.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
- class camj.analog.component.Voltage2VoltageConv(capacitance_array, vs_array, sf_load_capacitance=1e-12, sf_supply=1.8, sf_output_vs=1, sf_bias_current=5e-06, psca_noise=None, sf_noise=None, sf_enable_prnu=False, sf_prnu_std=0.001)
Bases:
objectVoltage-to-Voltage Convolution
This class performs convolution operations in analog domain. The convolution is realized by passive switched capacitor array, the capacitance of each capacitor is served as kernel weight. Source follower is used for signal readout.
Note
Map corresponding
WeightInputin software pipeline definition directly to this class for correct functional simulation.- Input/Output domains:
input domain:
ProcessDomain.VOLTAGE.output domain:
ProcessDomain.VOLTAGE.
- Parameters:
capacitance_array (array, float) – [unit: F] a list of capacitors in passive switched capacitor array.
vs_array (array, float) – [unit: V] a list of voltages that corresponds to the voltage swing at each capacitor.
sf_load_capacitance (float) – [unit: F] load capacitance.
sf_supply (float) – [unit: V] supply voltage.
sf_output_vs (float) – [unit: V] voltage swing at the SF’s output node.
sf_bias_current (float) – [unit: A] bias current.
psca_noise (float) – the stadard deviation of passive switched capacitor array’s read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_noise (float) – the stadard deviation of SF read noise, the default value is
None. If users do not specific this parameter, CamJ will calculate the noise STD based on the kTC noise.sf_enable_prnu (bool) – flag to enable SF PRNU. Default value is
False.sf_prnu_std (float) – the relative prnu standard deviation respect to SF gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- energy()
Calculate Energy
- To see the details of energy modeling, please check out:
analog.energy_model.PassiveSwitchedCapacitorArrayEnergy.analog.energy_model.SourceFollowerEnergy.
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- noise(input_signal_list)
Perform functional simulation
This function simulates the functional behavior of convolution operation.
- To see the details of function modeling, please refer:
analog.function_model.PassiveSwitchedCapacitorArrayFunc.analog.function_model.PixelwiseFunc.
- Parameters:
input_signal_list (list) – A list of input signals. One input should be input signal and the other one should be weight signal.
- Returns:
The first element in the tuple is the name of this simulated analog component, the second one is a list of simulation results.
- Return type:
Simulation result (tuple)
camj.analog.energy_model module
- class camj.analog.energy_model.ActiveAnalogMemoryEnergy(sample_capacitance=2e-12, comp_capacitance=2.5e-12, t_sample=1e-06, t_hold=0.01, supply=1.8)
Bases:
objectAnalog memory with active feedback.
The model is based on the design in [JSSC-2004]. The model consists of a sample capacitor, a compensation capacitor, and an amplifier which holds the stored analog data through feedback.
- Parameters:
sample_capacitance (float) – [unit: F] sample capacitance.
comp_capacitance (float) – [unit: F] compensation capacitance
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
- References Link:
- JSSC-2004: A 10-nW 12-bit accurate analog storage cell with 10-aA leakage.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.ActivePixelSensorEnergy(pd_capacitance, pd_supply, dynamic_sf=False, output_vs=1, num_transistor=4, fd_capacitance=1e-14, num_readout=2, load_capacitance=1e-12, tech_node=130, pitch=4, array_vsize=128)
Bases:
PinnedPhotodiodeEnergyActive pixel sensor (APS).
The model includes photodiode (PD), floating diffusion (FD), source follower (SF), and parasitic capacitance on the SF’s readout wire.
Our APS model supports energy estimation for both 3T-APS and 4T-APS. Users need to define num_transistor to get the correct energy estimation.
- Parameters:
pd_capacitance (float) – [unit: F] the capacitance of PD.
pd_supply (float) – [unit: V] supply voltage of pixel.
dynamic_sf (bool) – using dynamic SF or not. In most cases, the in-pixel SF is not dynamic, meaning that it is statically-biased by a constant current. However, some works [JSSC-2021] use dynamic SF to save energy.
output_vs (float) – [unit: V] voltage swing at SF’s output node. Typically it is one or two units of threshold voltage smaller than pd_supply, depending on the pixel’s circuit structure.
num_transistor (int) – {3 or 4}. It defines using 3T APS or 4T APS.
num_readout (int) – {2 or 1}. It defines enabling CDS or not.
load_capacitance (float) – [unit: F] load capacitance at the SF’s output node.
tech_node (int) – [unit: nm] pixel’s process node.
pitch (float) – [unit: um] pixel pitch size (width or height).
array_vsize (int) – the vertical size of the entire pixel array. This is used to estimate the parasitic capacitance on the SF’s readout wire.
- References Link:
- JSSC-2021: A 51-pJ/Pixel 33.7-dB PSNR 4× Compressive CMOS Image Sensor With Column-Parallel Single-Shot Compressive Sensing.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.AnalogToDigitalConverterEnergy(supply=1.8, type='SS', fom=1e-13, resolution=8)
Bases:
objectAnalog-to-digital converter.
- Parameters:
supply (float) – [unit: V] supply voltage.
type (str) – ADC type.
fom (float) – [unit: J/conversion] ADC’s Figure-of-Merit, expressed by energy per conversion.
resolution (int) – ADC resolution.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.ColumnAmplifierEnergy(load_capacitance=1e-12, input_capacitance=1e-12, t_sample=2e-06, t_hold=0.01, supply=1.8, gain_cl=2, differential=False)
Bases:
objectSwitched-capacitor amplifier.
The model is based on Fig. 13.5 in [Book-Razavi]. The model includes an input capacitor, a feedback capacitor, a load capacitor, and an amplifier. This amplifier can be used either as pixel array’s column amplifier or as a general-purpose switched-capacitor amplifier, such as switched-capacitor integrator, switched-capacitor subtractor, and switched-capacitor multiplier.
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
input_capacitance (float) – [unit: F] input capacitance.
t_sample (float) – [unit: s] sampling time, which mainly consists of the amplifier’s settling time.
t_hold (float) – [unit: s] holding time, during which the amplifier is turned on and consumes power relentlessly.
supply (float) – [unit: V] supply voltage.
gain_cl (int) – amplifier’s closed-loop gain. This gain describes the ratio of
input_capacitanceover feedback capacitance, and determines the amplifier’s bias current in gm/id method.differential (bool) – if using differential-input amplifier or single-input amplifier.
- References Link:
Book-Razavi: Design of Analog CMOS Integrated Circuits (Second Edition)
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.ComparatorEnergy(supply=1.8, i_bias=1e-05, t_readout=1e-09)
Bases:
objectDynamic voltage comparator.
- Parameters:
supply (float) – [unit: V] supply voltage.
i_bias (float) – [unit: A] bias current of the circuit.
t_readout (float) – [unit: s] readout time, during which the comparison is finished.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.CurrentMirrorEnergy(supply=1.8, load_capacitance=2e-12, t_readout=1e-06, i_dc=1e-06)
Bases:
objectCurrent mirror.
The model consists of a constant current path and a load capacitor.
- Parameters:
supply (float) – [unit: V] supply voltage.
load_capacitance (float) – [unit: F] load capacitance.
t_readout (float) – [unit: s] readout time, during which the constant current drives the load capacitance from 0 to VDD.
i_dc (float) – [unit: A] the constant current. If
i_dc == None, then i_dc is estimated from the other parameters.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.DigitalPixelSensorEnergy(pd_capacitance, pd_supply, dynamic_sf, output_vs, num_transistor, fd_capacitance, num_readout, load_capacitance, tech_node, pitch, array_vsize, adc_type='SS', adc_fom=1e-13, adc_reso=8)
Bases:
ActivePixelSensorEnergyDigital pixel sensor (DPS).
The model consists of an APS and an in-pixel ADC.
- Parameters:
pd_capacitance (float) – [unit: F] the capacitance of PD.
pd_supply (float) – [unit: V] supply voltage of pixel.
dynamic_sf (bool) – using dynamic SF or not. In most cases, the in-pixel SF is not dynamic, meaning that it is statically-biased by a constant current. However, some works [JSSC-2021] use dynamic SF to save energy.
output_vs (float) – [unit: V] voltage swing at SF’s output node. Typically it is one or two units of threshold voltage smaller than pd_supply, depending on the pixel’s circuit structure.
num_transistor (int) – {3 or 4}. It defines using 3T APS or 4T APS.
num_readout (int) – {2 or 1}. It defines enabling CDS or not.
load_capacitance (float) – [unit: F] load capacitance at the SF’s output node.
tech_node (int) – [unit: nm] pixel’s process node.
pitch (float) – [unit: um] pixel pitch size (width or height).
array_vsize (int) – the vertical size of the entire pixel array. This is used to estimate the parasitic capacitance on the SF’s readout wire.
adc_type (str) – the actual ADC type. Please check ADC class for more details.
adc_fom (float) – [unit: J/conversion] ADC’s Figure-of-Merit, expressed by energy per conversion.
adc_resolution (int) – ADC’s resolution.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.DigitalToCurrentConverterEnergy(supply=1.8, load_capacitance=2e-12, t_readout=1.6e-05)
Bases:
objectCurrent digital-to-analog converter.
The model consists of a constant current path and a load capacitor.
- Parameters:
supply (float) – [unit: V] supply voltage.
load_capacitance (float) – [unit: F] load capacitance.
t_readout (float) – [unit: s] readout time, during which the constant current drives the load capacitance from 0 to VDD.
- energy()
- class camj.analog.energy_model.GeneralCircuitEnergy(supply=1.8, i_dc=1e-05, t_operation=1e-09)
Bases:
objectEnergy model for general circuits from first principle.
- Parameters:
supply (float) – [unit: V] supply voltage.
i_dc (float) – [unit: A] direct current of the circuit.
t_operation (float) – [unit: s] operation time, during which the circuit completes its particular operation.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.MaximumVoltageEnergy(supply=1.8, t_hold=0.03, t_readout=1e-06, load_capacitance=1e-12)
Bases:
objectA circuit that outputs the maximum voltage among the input voltages.
The model is based on the design in [Sensors-2020]. The model consists of a constant current path, a group of common-source amplifiers, and a load capacitor. The number of common-source amplifiers matches the number of input voltages. Note that all common-source amplifiers share one bias current so the bias current doesn’t scale with the number of input voltages.
- Parameters:
supply (float) – [unit: V] supply voltage.
t_hold (float) – [unit: s] holding time, during which the circuit is turned on and consumes power relentlessly.
t_readout (float) – [unit: s] readout time, during which the maximum voltage is output.
load_capacitance (float) – [unit: F] load capacitance
- References Link:
- Sensors-2020: Design of an Always-On Image Sensor Using an Analog Lightweight Convolutional Neural Network.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.PassiveAnalogMemoryEnergy(sample_capacitance=1e-12, supply=1.8)
Bases:
objectAnalog memory without active feedback.
The model only contains a sample capacitor. Compared to ActiveAnalogMemory it has higher data leakage rate.
- Parameters:
sample_capacitance (float) – [unit: F] sample capacitance.
supply (float) – [unit: V] supply voltage.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.PassiveSwitchedCapacitorArrayEnergy(capacitance_array, vs_array)
Bases:
objectPassive switched-capacitor array.
The model consists of a list of capacitors and a list of voltages that corresponds to the voltage swing at each capacitor. The model is used to represent all passive switched-capacitor computational circuits, including charge-redistribution-based MAC operation.
- Parameters:
capacitance_array (array, float) – [unit: F] a list of capacitors.
vs_array (array, float) – [unit: V] a list of voltages that corresponds to the voltage swing at each capacitor.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.PinnedPhotodiodeEnergy(pd_capacitance=1e-13, pd_supply=3.3)
Bases:
objectPinned photodiode (PD).
The model only contains the dynamic energy of the PD’s internal capacitance.
- Parameters:
pd_capacitance (float) – [unit: F] the capacitance of PD.
pd_supply (float) – [unit: V] supply voltage of pixel.
- energy()
- class camj.analog.energy_model.PulseWidthModulationPixelEnergy(pd_capacitance, pd_supply, array_vsize, ramp_capacitance=1e-12, gate_capacitance=1e-14, num_readout=1)
Bases:
PinnedPhotodiodeEnergyPulse-Width-Modulation (PWM) Pixel.
The model is based on the design in [JSSC-2020] and [ISSCC-2022]. The model consists of a photodiode (PD), a ramp signal generator, and a comparator. The comparator output toggles when the ramp signal is smaller than the pixel voltage at PD.
- Parameters:
pd_capacitance (float) – [unit: F] PD capacitance.
pd_supply (float) – [unit: V] PD voltage supply.
array_vsize (int) – the vertical size of the entire pixel array. This is used to estimate the parasitic capacitance on the SF’s readout wire.
ramp_capacitance (float) – [unit: F] capacitance of ramp signal generator.
gate_capacitance (float) – [unit: F] the gate capacitance of readout transistor.
num_readout (int) – number of read from pixel.
- References Link:
- JSSC-2020: A 0.5-V Real-Time Computational CMOS Image Sensor With Programmable Kernel for Feature Extraction.
- ISSCC-2022: A 0.8V Intelligent Vision Sensor with Tiny Convolutional Neural Network and Programmable Weights Using Mixed-Mode Processing-in-Sensor Technique for Image Classification.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
- class camj.analog.energy_model.SourceFollowerEnergy(load_capacitance=1e-12, supply=1.8, output_vs=1, bias_current=5e-06)
Bases:
objectSource follower (SF) with constant current bias.
This model is applicable to not only the simplest single-transistor source follower but also flipped-voltage-follower (FVF).
- Parameters:
load_capacitance (float) – [unit: F] load capacitance.
supply (float) – [unit: V] supply voltage.
output_vs (float) – [unit: V] voltage swing at the SF’s output node.
bias_current (float) – [unit: A] bias current.
- energy()
Calculate Energy
- Returns:
the energy consumption of this analog compoenent in unit of
J.- Return type:
float
camj.analog.energy_utils module
- camj.analog.energy_utils.get_delay(current_stage_output_impedance, next_stage_input_impedance, current_stage_output_capacitance, next_stage_input_capacitance)
Compute analog component delay.
This model assumes the delay of an analog component is 5 times of the RC constant at the analog component’s output node. The total impedance (R) is the sum of the output impedance of this analog component and the input impedance of the following analog component. The total capacitance (C) is the sum of the output capacitance of this analog component and the input capacitance of the following analog component. 5 times of the RC constant represents the latency required by charging the total capacitance to 99% of the nodal voltage swing.
- Parameters:
current_stage_output_impedance (float) – [unit: Ohm] output impedance of the current analog component.
next_stage_input_impedance (float) – [unit: Ohm] output impedance of the next analog component.
current_stage_output_capacitance (float) – [unit: F] output capacitance of the current analog component.
next_stage_input_capacitance (float) – [unit: F] output capacitance of the next analog component.
- Returns:
delay [unit: s]
- Return type:
float
- camj.analog.energy_utils.get_nominal_supply(tech_node)
Compute nominal supply voltage under different process nodes.
- Parameters:
tech_node (int) – [unit: nm] pixel’s process node.
- Returns:
supply voltage [unit: V]
- Return type:
float
- camj.analog.energy_utils.get_pixel_parasitic(array_v, tech_node, pitch)
Compute column parasitic capacitance (Farad per column) on the pixel’s output node.
This parasitic capacitance usually dominates the load capacitance if the pixel’s follow-up circuitry (e.g., readout or processing) is placed at the column level. Based on [JSSC-2019] where the parasitic capacitance is 9fF/pixel under 130nm process node and 5um pixel pitch, this model assumes the parasitic capacitance scales with process node, pixel pitch, and pixel array’s vertical size (i.e., the number of pixels in one column).
- References Link:
- JSSC-2019: A Data-Compressive 1.5/2.75-bit Log-Gradient QVGA Image Sensor With Multi-Scale Readout for Always-On Object Detection.
- Parameters:
array_v (int) – vertical size of the pixel array.
tech_node (int) – [unit: nm] pixel’s process node.
pitch (float) – [unit: um] pixel’s pitch size.
- Returns:
parasitic capacitance [unit: F]
- Return type:
float
- camj.analog.energy_utils.gm_id(load_capacitance, gain, bandwidth, differential=True, inversion_level='moderate')
Compute transconductance (gm) and drain current (id) of linear amplifiers.
The method is based on [Book-Jespers].
- References Link:
- Book-Jespers: Systematic Design of Analog CMOS Circuits: Using Pre-Computed Lookup Tables.
- Parameters:
load_capacitance (float) – [unit: F] amplifier’s load capacitance.
gain (float) – amplifier’s open-loop gain.
bandwidth (float) – [unit: Hz] amplifier’s bandwidth.
differential (bool) – if using differential-input amplifier or single-input amplifier.
inversion_level (str) – [‘weak’, ‘moderate’, or ‘strong’] the inversion level of the transistors in the amplifier.
- Returns:
drain current (id) [unit: A], transconductance (gm) [unit: S]
- Return type:
float, float
- camj.analog.energy_utils.parallel_impedance(impedance_array)
Compute parallel impedance of an array of input impedance.
- Parameters:
impedance_array (array, float) – [unit: Ohm] input impedance array.
- Returns:
parallel impedance [unit: Ohm]
- Return type:
float
camj.analog.function_model module
Func Model Module
This module includes all basic noise model for CamJ functional simulation.
Note
CamJ models the output of each component by applying a gain and a read noise to its input.
Analytically, the model performs output = input * gain + read_noise.
This formula implies that we only consider two main types of hardware non-idealities: gain variation (or, PRNU) and read noise (zero-mean Gaussian).
Note
Because nearly all of our implemented components are linear circuits which have linear transfer functions, we can use “gain” and “gain variation” as the proxy to describe the component’s functional behavior.
The proxy is also applicable to quantization circuits (ADCs and comparators), which are non-linear circuits but have uniformly-stepped transfer functions. We describe these transfer functions by applying a “gain” and a “gain variation” to their linear frontiers but ignoring the non-linear effect at each quantization step (i.e., DNL, INL).
The proxy is also applicable to those non-linear circuits whose transfer functions are non-uniform but can be approximated in piece-wise linear manner. For example, the circuit that performs quantize(log(x1/x2)) in [JSSC-2019] can be described by a set of “gain”s and “gain variation”s and each pair of “gain” and “gain variation” describes a linear segment of the transfer function.
However, the proxy is not applicable to the non-linear circuits which do not belong to either of the above, such as the circuit that generates the maximum output voltage from a group of input voltages in [Sensors-2020]. For those circuits, we only add the read_noise and do not apply the gain.
Note
Note that the proxy doesn’t always reflect the physical reality of the circuit, meaning that the “gain” may not be an explicit parameter in the circuit and the “gain variation” is not analytically derived from the circuit parameters. However, the proxy trades low level circuit details off for the model’s simplicity.
- References Link:
- JSSC-2019: A Data-Compressive 1.5/2.75-bit Log-Gradient QVGA Image Sensor With Multi-Scale Readout for Always-On Object Detection.
- Sensors-2020: Design of an Always-On Image Sensor Using an Analog Lightweight Convolutional Neural Network.
- class camj.analog.function_model.AbsoluteDifferenceFunc(name: str, gain=1.0, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectFunc model for absolute difference subtractor.
This noise model simulates the noises happened in absolute difference operation. Two inputs will first compute the absolute difference, and then, apply gain and noises.
- Mathematical Expression:
out = gain * (Abs(in1 - in2)) + Norm(noise)
- Parameters:
name (str) – the name of the noise.
gain (float) – the gain applied in absolute difference, the default value is
1.0.noise (float) – the read noise standard deviation during readout in the unit of voltage (V).
enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.
- simulate_output(input_signal1, input_signal2)
apply gain and noise to input signal
- Parameters:
input_signal1 – the first input signal to ABS component in a 2D/3D tensor.
input_signal2 – the second input signal to ABS component in a 2D/3D tensor.
- Returns:
signal values after ABS component.
- Return type:
2D/3D tensor
- class camj.analog.function_model.AnalogToDigitalConverterFunc(name: str, adc_noise: float, max_val: float, resolution: int)
Bases:
objectFunc model for ADC.
This model only considers a coarse-scale ADC noise, which we model in normal distribution. We don’t consider non-linear noise errors which can be calibrated during manufacture.
- Mathematical Expression:
output_signal = Quantization(input_signal + Norm(adc_noise))
- Parameters:
name (str) – the name of the noise.
adc_noise (float) – the overall noise on ADC.
max_val (float) – the maximum value in ADC input. We assume the input voltage range is from [0, max_val]
resolution (int) – the resolution of the output value in digital domain.
8means the maximum value in digital value is8^2 - 1==255bit.
- simulate_output(input_signal)
apply gain and noise to input signal
- Parameters:
input_signal – input signal to ADC in unit of voltage in a 2D/3D tensor.
- Returns:
digital values after quantization of ADC.
- Return type:
2D/3D tensor
- class camj.analog.function_model.ColumnwiseFunc(name, gain=1.0, noise=None, enable_prnu=False, prnu_std=0.001, enable_offset=False, pixel_offset_voltage=0.1, col_offset_voltage=0.05)
Bases:
objectA general interface for column-wise function.
A general interface for any noise source that applies to each column, such as column amplifier. Assumption for this class is that it has a row-like struction such as column amplifier, and this class can capture the different properties in column-wise structure. One example is the column amplifier has PRNU column-wisely.
- Mathematical Expression:
output = gain * in + Norm(noise)
- Parameters:
name (str) – the name of the noise.
gain (float) – the average gain. Default value is
1.0.noise (float) – the standard deviation of read noise. Default value is
None.ennable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is
0.001.enable_offset (bool) – flag to enable adding offset voltage. Default value is
False.pixel_offset_voltage – pixel offset voltage in unit of volt (V). Default value is
0.1.col_offset_voltage – column-wise offset voltage in unit of volt (V). Default value is
0.05.
- simulate_output(input_signal)
apply gain and noise to input signal
- Parameters:
input_signal – the input signals.
- Returns:
signal values after processed by column-wise noise component.
- Return type:
2D/3D tensor
- class camj.analog.function_model.ComparatorFunc(name, gain=1.0, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectFunc model for comparator.
The general assumption for comparator component is that its gain is 1, and its noise follows zero-mean normal distribution.
- Mathematical Expression:
output = GreaterThanOne(Diff(input_signal1 - input_signal2) * gain + Norm(noise))
- Parameters:
name (str) – the name of the noise.
gain (float) – the average gain. Default value is
1.0.noise (float) – the standard deviation of read noise. Default value is
None.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative PRNU standard deviation respect to gain. PRNU gain standard deviation = prnu_std * gain. The default value is 0.001
- simulate_output(input_signal1, input_signal2)
apply gain and noise to input signals.
- Parameters:
input_signal1 – the first input signal.
input_signal2 – the second input signal.
- Returns:
signal values in
input_signal1that are greater that corresponding values ininput_signal2. Otherwise, output zeros.- Return type:
2D/3D tensor
Bases:
objectFunc model for correlated double sampling circuit.
General assumption of CDS is gain is 1, read noise follows
zero-meannormal distribution.- Mathematical Expression:
output = (input_signal - reset_signal) * gain + Norm(noise)
- Parameters:
name (str) – the name of the noise.
gain (float) – the average gain. Default value is
1.0.noise (float) – the standard deviation of read noise. Default value is
None.enable_prnu – flag to enable PRNU. Default value is
False.prnu_std – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. The default value is
0.001.
apply gain and noise to input signal
- Parameters:
input_signal – the input signals.
reset_noise – reset noise signal from floating diffusion.
- Returns:
signal values after processed by CDS.
- Return type:
2D/3D tensor
- class camj.analog.function_model.CurrentMirrorFunc(name: str, gain=1, noise=None, enable_compute=False, enable_prnu=False, prnu_std=0.001)
Bases:
objectFunc model for current mirror.
Current mirror has two possible outputs to model two functionalities of current mirror. 1. output charge: in this case, the input current will multiply with integrated time and output the charge which is
current*time. 2. output current: in this case, there is no computation, just perform gain amplification.- Mathematical Expression:
out = gain * (input_signal * weight_signal) + Norm(noise)
out = gain * input_signal + Norm(noise).
- Parameters:
name (str) – the name of the noise.
gain (float) – the average gain. Default value is
1.0.noise (float) – the standard deviation of read noise. Default value is
None.enable_compute (bool) – flag to enable compute and output charges. Default value is
False.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. The default value is
0.001.
- simulate_output(input_signal, weight_signal=None)
apply gain and noise to input signal
- Parameters:
input_signal – the input signal to current mirror in a 2D/3D tensor.
weight_signal – the weight signal to current mirror in a 2D/3D tensor.
- Returns:
signal values after current mirror.
- Return type:
2D/3D tensor
- class camj.analog.function_model.FloatingDiffusionFunc(name: str, gain=1.0, noise=None, enable_cds=False, enable_prnu=False, prnu_std=0.001)
Bases:
objectFunc model for floating diffusion.
General assumption of the noise model is that the noise follows a
zero-meanGaussian distribution. Users need to provide the average noise error (sigma value). Gain is generally slightly less than 1, here, the default value is 1.0.To enable CDS and PRNU, just set enable flag to be True. If
enable_cdsis True, simulate_output function will return two values, one is the input + reset noise, and the other is the reset noise.- Mathematical Expression:
out = (gain * in) + Norm(noise)
- Parameters:
name (str) – the name of the noise.
gain (float) – the average gain. Default value is
1.0.noise (float) – the standard deviation of read noise. Default value is
None.enable_cds (bool) – flag to enable CDS (correlated double sampling). Default value is
False.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- simulate_output(input_signal)
apply gain and noise to input signal
- Parameters:
input_signal – the input signals.
- Returns:
signal values after processed by floating diffusion. If
enable_cdsisTrue, then the second return value is reset noise.- Return type:
2D/3D tensor
- class camj.analog.function_model.MaximumVoltageFunc(name, noise=None)
Bases:
objectFunc model for max voltage comparator.
Maximum voltage produce element-wise maximum for a list of input signals. It is used for operations like MaxPool.
- Mathematical Expression:
out = Max(in_1, …, in_N) + Norm(noise)
- Parameters:
name (str) – the name of the noise.
noise (float) – the standard deviation of read noise. Default value is
None.
- simulate_output(input_signal_list: list)
apply gain and noise to input signal
- Parameters:
input_signal_list – a list of input signals to maximum voltage.
- Returns:
maximum signal after maximum voltage.
- Return type:
2D/3D tensor
- class camj.analog.function_model.PassiveSwitchedCapacitorArrayFunc(name, num_capacitor, noise=None)
Bases:
objectFunc model for passive switched capacitor array.
Passive switched capacitor array can realize many mathematical operations such as average, addition/subtraction, and multiplication.
- Mathematical Expression:
out = Average(in_1, …, in_N) + Norm(noise)
- Parameters:
name (str) – the name of the noise.
num_capacitor (int) – number of capacitor in capacitor array.
noise (float) – the standard deviation of read noise. Default value is
None.
- simulate_output(input_signal_list: list)
apply gain and noise to input signal
- Parameters:
input_signal_list – a list of input signals to passive switched capacitor array.
- Returns:
averaged signal value after passive switched capacitor array.
- Return type:
2D/3D tensor
- class camj.analog.function_model.PhotodiodeFunc(name: str, dark_current_noise: float, enable_dcnu=False, dcnu_std=0.001)
Bases:
objectFunc model for photediode.
This model simulates the behavior of photodiode, including shot noise, dark current and dark current non-uniformity.
- Mathematical Expression:
output_signal = Poisson(x_in) + Norm(DCNU * dark_current)
- Parameters:
name (str) – the name of this noise.
dark_current_noise (float) – average dark current noise in unit of electrons (e-).
enable_dcnu (bool) – flag to enable dark current non-uniformity, the default value is
False.dcnu_std (float) – dcnu standard deviation percentage. it is relative number respect to
dark_current_noise, the dcnu standard deviation is,dcnu_std*dark_current_noise, the default value is 0.001.
- simulate_output(input_signal)
apply gain and noise to input signal
- Parameters:
input_signal – input signal to photodiode in unit of photons in a 2D tensor.
- Returns:
signal out of photodiode in unit of voltage.
- Return type:
2D tensor
- class camj.analog.function_model.PixelwiseFunc(name, gain=1.0, noise=None, enable_prnu=False, prnu_std=0.001)
Bases:
objectA general interface for pixel-wise function.
A general interface for any noise source resided inside each pixel, including floating diffusion, source follower, etc. General assumption of the noise source is that the noise follows a “zero-mean” Gaussian distribution. Users need to provide mean noise (sigma value).
- Mathematical Expression:
out = (gain * in) + Norm(noise)
- Parameters:
name (str) – the name of the noise.
gain (float) – the average gain. Default value is
1.0.noise (float) – the standard deviation of read noise. Default value is
None.enable_prnu (bool) – flag to enable PRNU. Default value is
False.prnu_std (float) – the relative prnu standard deviation respect to gain. prnu gain standard deviation = prnu_std * gain. the default value is
0.001.
- simulate_output(input_signal)
apply gain and noise to input signal
- Parameters:
input_signal – the input signals.
- Returns:
signal values after processed by analog component.
- Return type:
2D/3D tensor
camj.analog.function_utils module
- camj.analog.function_utils.default_functional_simulation(functional_pipeline_list, input_list)
- camj.analog.function_utils.process_signal_stage(stage, input_signals)
camj.analog.infra module
- class camj.analog.infra.AnalogArray(name: str, layer: int, num_input: list, num_output: tuple)
Bases:
objectThe High-level interface to define analog structures. In
CamJ, each analog array is defined as a 2D structure. In this structure, it contains multipleAnalogComponents. Additionally, eachAnalogArrayhas a regular input/output rate.- Parameters:
name (str) – the name of this analog array.
layer (int) – the location of this analog array. Please see
general.enum.ProcessorLocation.num_input (list) – a list of input 3D shapes in (H, W, C) format. Each input defines the number of input signals needed per cycle in order to obtain the output define in
num_output.num_output (tuple) – output signals per cycle in 3D shape (H, W, C).
- add_component(component: AnalogComponent, component_size: tuple)
Add components to its component list
This function adds the analog components that construct this analog array. Multiple calls of this function will add multiple components to this analog array.
- Parameters:
component (AnalogComponent) – the analog component that constructs this analog array.
component_size (tuple) – the number of compoenent needs for this analog array.
Component_sizeneeds in a 3D shape (H, W, C).
- Returns:
None
- add_input_array(analog_array)
Add producer of this analog array
Define the producer of this analog array. If multiple producers are needed, call this function multiple times.
- Parameters:
analog_array (AnalogArray) – the producer of this analog array.
- Returns:
None
- add_output_array(analog_array)
Add consumer of this analog array
Define the consumer of this analog array. If multiple consumers are needed, call this function multiple times.
- Parameters:
analog_array (AnalogArray) – the consumer of this analog array.
- Returns:
None
- energy()
Energy consumption
Calculate the energy needed to generate the given output shape.
- Returns:
energy consumption in J.
- Return type:
Energy (float)
- noise(input_signal_list: list)
Function and Noise Simulation
This function will iterate each component in the component list and perform functional and noise simulation for each component.
- Parameters:
input_signal_list (list) – a list of input signal to this analog array.
- Returns:
the signal simulation result after each analog component. Each item in this list is a tuple in (component_name, output_signal_list) format.
- Return type:
Simulation result (list)
- class camj.analog.infra.AnalogComponent(name: str, input_domain: list, output_domain: int, component_list=None, num_input: list = [(1, 1, 1)], num_output: tuple = (1, 1, 1))
Bases:
objectAnalog Component
This is the low-level interface to define an analog component. This class serves as a container that consists of mulitple analog components from
analog.componentmodule.- Parameters:
name (str) – the name of this analog component.
input_domain (list) – a list contains input domains. Each input domain defines the domain of each input signal. This
input_domainlist should matchnum_input. Domains are defined ingeneral.enum.ProcessDomain.output_domain (enum) – the domain of the output signal of this analog component. Domains are defined in
general.enum.ProcessDomain.component_list (list) – a list of analog components that construct this
AnalogComponentinstance.num_input (list) – a list of tuple, each tuple represents an input shape. Each input shape represents the number of input signals needed to obtain the output signal (
num_output) per cycle. Each input shape is a 3D tuple in (H, W, C) format.num_output (tuple) – the number of output signals per cycle in this output shape.
Examples
To create a mega-pixel component with 2x2 binning capability.
>>> AnalogComponent( name = "BiningPixel", input_domain =[ProcessDomain.OPTICAL], output_domain = ProcessDomain.VOLTAGE, component_list = [(ActivePixelSensor(...), 4)], num_input = [], num_output = (1, 1, 1) )
Here,
ProcessDomain.OPTICALshows pixel takes photons as input and converts toProcessDomain.VOLTAGEas shown inoutput_domain.component_listshows how this analog component is implemented. In this case, it isActivePixelSensor. Each Pixel needs 4ActivePixelSensorto achieve 2x2 binning.- energy()
Calculate the energy consumption of this analog compoenent.
This function calculates the overall energy consumption for this analog component per cycle. The overall energy equals to the energy consumption of each component in
component_listtimes the count of each component.- Returns:
Energy (float) in pJ.
- noise(input_signal_list)
Noise Simulation
The noise function performs the functional/noise simulation based on the functional model of each component in
component_list. The input signal will pass through each component’s functional model one-by-one.- Parameters:
input_signal_list (list) – a list of input signals in a form of numpy array.
- Returns:
Simulated output signal after each analog component (dict)
camj.analog.utils module
- camj.analog.utils.analog_energy_simulation(analog_arrays, sw_desc, mapping)
Launch Energy Simulation in Analog Domain
The harness function for analog energy simulation.
- Parameters:
analog_arrays – a list of analog arrays.
sw_desc – software pipeline description.
mapping – software-hardware mapping.
- Returns:
energy numbers from simulation, stores in a dictionary.
- Return type:
Energy Result (dict)
- camj.analog.utils.check_analog_connect_consistency(analog_arrays: list)
Check analog connection correctness
This function checks the correctness of two connected analog components. It checks if the output domain of any producer analog component matches the input domain of the consumer analog component.
- Parameters:
analog_arrays (list) – a list of analog arrays.
- Returns:
None
- camj.analog.utils.compute_total_energy(analog_arrays, analog_sw_desc, mapping)
Compute Energy in Analog Domain
This function calculates the overall energy consumption of simulated CIS in analog domain.
- Parameters:
analog_arrays – a list of analog arrays.
sw_desc – software pipeline description corresponding to analog domain.
mapping – software-hardware mapping.
- Returns:
energy numbers from simulation, stores in a dictionary.
- Return type:
Energy Result (dict)