-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeedback_1_csv_variable_input.m
More file actions
181 lines (123 loc) · 5.68 KB
/
feedback_1_csv_variable_input.m
File metadata and controls
181 lines (123 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WBCAPD project - image sensing simulation variables - ".csv" file generator
% Instructions:
% 1. Matlab Code: change variables: i_min, max_photo_current, m, n
% output: ".cvs" file (to be imported to Virtuoso>>Maestro)
% 2. Transfer file to ws.
% 3. Open file, save file : "Use Text CSV Format" , click OK.
% 4. Open Virtuoso -> Maestro. right click on "Design Variables" -> import from CSV."
% NOTE: if you wish to upload an image, use the code in section 4,
% otherwise see section 2 and 3.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Initial Values for Simulation
% greyscale value of matlab per image pixel =[0,255]
% Minimal & Maxminal Photo Current
i_min = 1e-18; % [A]
i_max = 200e-12; % [A]
sizing_factor = 1/255;
% wbcapd array dimension (mxn) (one less than Pixel Array dimensions)
m = 15;
n = 15;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2. Matrix initialization
% Defualt - 0 - Min photocurrent
img_in = zeros(m,n);
% 255 - Max photocurrent
%img_in = 255* ones(m,n);
% 128 - half power photocurrent (middle)
%img_in = 128* ones(m,n);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3. image - [0,255,0,0] for n=2
% (square with top right quarter black)
% for i = 1:m
% for j = 1:n
% if(i<=round(m/2) && j>round(n/2))
% img_in(i, j) = 255;
% end
% end
% end
% top half 255, bottom half 0
% for i = 1:m
% for j = 1:n
% if(i<=round(m/2))
% img_in(i, j) = 255;
% end
% end
% end
%square
for i=5:11
for j=5:11
img_in(i, j) = 255;
end
end
% % gradation horizontal
%
% for i = 1:m
% for j = 1:n
% img_in(i, j) = (j/n)*255;
% end
% end
% gradation vertical
% for i = 1:m
% for j = 1:n
% img_in(i, j) = (i/m)*255;
% end
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4. Import (mxn) Image from path
%A = imread(img2);
%img_in = rgb2gray(A);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 5. Calculate Current Values from greyscale
img_in_t=img_in';
val = reshape(img_in_t, 1, []);
i_in = i_min + (i_max-i_min) * sizing_factor * val;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 6. Variable Setting
%table title
title_row = {'Type', 'Name', 'Value', 'Enabled', 'Tags', 'Notes'};
%Simulation Variables
variable_block = {'variable','vdd', '1.8', 'enabled','' ,'' ;
'variable','vss', '0', 'enabled','' ,'' ;
'variable','L_cm', '180n', 'enabled','' ,'';
'variable','L_tg', '180n', 'enabled','' ,'';
'variable','L_rst', '300n', 'enabled','' ,'';
'variable','L_sf', '300n', 'enabled','' ,'';
'variable','L_bias', '180n', 'enabled','' ,'';
'variable','L_rs', '180n', 'enabled','' ,'';
'variable','L_so', '180n', 'enabled','' ,'';
'variable','L_col_sel', '30*180n', 'enabled','' ,'';
'variable','N', '1', 'enabled','' ,''; % Current mirror sizing factor
'variable','W_cm', '220n', 'enabled','' ,'';
'variable','W_tg', '220n', 'enabled','' ,'';
'variable','W_rst', '220n', 'enabled','' ,'';
'variable','W_sf', '220n', 'enabled','' ,'';
'variable','W_bias', '220n', 'enabled','' ,'';
'variable','W_rs', '220n', 'enabled','' ,'';
'variable','W_so', '220n', 'enabled','' ,'';
'variable','W_col_sel', '220n', 'enabled','' ,'';
'variable','c_pd', '28.08f', 'enabled','' ,''; % Emulated PD Capacitance (WBCAPD cell)
'variable','c_fd', '17f', 'enabled','' ,''; % Floating Diffusion Capacitance (is_tb cell)
'variable','c_column', '40f', 'enabled','' ,''; % column capacitance sim (is_tb_4port_pixel)
'variable','v_ref', '500m', 'enabled','' ,''; % Emulated PD saturation voltage (WBCAPD cell)
'variable','i_in_D', '0', 'enabled','' ,''; %idc pulse Delay
'variable','i_in_P', '20m', 'enabled','' ,''; %idc pulse Period
'variable','i_in_PW', '15m', 'enabled','' ,''; %idc pulse Pulse Width
'variable','i_in_RF', '10n', 'enabled','' ,''; %idc pulse rise,fall times
};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 7. Image-Current Values data for csv table file
str = 'i_in%d';
current_block = cell(n*n, 6);
for i = 1:(m*n)
current_block(i,:) = {'variable',sprintf(str,i-1),i_in(i), 'enabled','',''};
end
% 8. write data to cvs file
data = title_row;
data = vertcat (data, variable_block);
data = vertcat (data, current_block);
writecell (data,'feedback_parameters_input.csv');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%