qubic.rfsoc.hwconfig
ElementConfig implementation for current QubiC gateware running on the RFSoC (ZCU216) platform. Responsible for converting phase/frequencies/amplitudes from natural units into words/buffers that can be loaded into FPGA memory. Instantiated during assembly based on provided channel config.
DCOffsetCfg
Bases: ElementConfig
ElementConfig implementation for DC offset channels (i.e. no amplitude modulation envelope)
Source code in qubic/rfsoc/hwconfig.py
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 | |
RFMixElementCfg
Bases: RFSoCElementCfg
Override RFSoCElementCfg for rdlo/downconversion channels. Currently the
only difference is a save_result switch is supported for the cfg_word
parameter.
Source code in qubic/rfsoc/hwconfig.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
RFSoCElementCfg
Bases: ElementConfig
ElementConfig implementation for RF sig gens on QubiC 2.0 on ZCU216.
Source code in qubic/rfsoc/hwconfig.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
add_env(env)
Adds a new envelope to the envelope buffer. This involves hashing the provided envelope, checking if it has already been registered, then adding it to the envelope library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
ndarray | Dict | str
|
If |
required |
Returns:
| Type | Description |
|---|---|
str
|
Hash of the provided envelope, corresponding to the key in the env dict. |
Source code in qubic/rfsoc/hwconfig.py
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 | |
add_freq(freq, freq_ind=None)
Registers a new frequency for this sig gen (i.e. adds it to the freq buffer).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freq
|
float
|
frequency in Hz |
required |
freq_ind
|
int
|
optional frequency index (useful for on-the-fly parameterization) |
None
|
Source code in qubic/rfsoc/hwconfig.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
compile_envs()
Computes the raw envelope buffer along with a dictionary of indices. Address is computed later by hwconfig
Returns:
| Name | Type | Description |
|---|---|---|
env_raw |
bytes
|
packed byte array of the raw envelope buffer. Each sample is a 32-bit word, with a signed 16-bit I value LSB followed by a signed 16-bit Q value MSB |
env_addr_map |
dict
|
dictionary of envelope addresses, to be used by pulse commands. Keys are the same as used by self._env_dict. The process element hardware module (element.v) has four separate memory banks for the envelope, with one output value per-clock (so 4x250 MHz = 1 GHz). Addresses index these buffers, so the address here is the envelope start index in env_raw divided by four. |
Source code in qubic/rfsoc/hwconfig.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
compile_freqs()
Converts the list of frequencies to a buffer, where each frequency has 16 elements:
[0]is a 32-bit freq word, encoding phase increment per clock cycle[1:15]are 16 bit I MSB + 16 bit Q LSB, encoding 15 phase offsets for each sample (except 0) within a clock cycle
16-element arrays for each frequency are concatenated into a single 1D numpy array. Returns the full raw freq buffer + index map
Returns:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
Frequency buffer: packed array of concatenated 16-element frequency lists |
Dict[float, int]:
|
Dictionary mapping the frequency in Hz to its location in the freq buffer |
Source code in qubic/rfsoc/hwconfig.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
freq_registered(freq)
Checks if the provided freq has been added to the frequency list.
freq: float
frequency in Hz
Source code in qubic/rfsoc/hwconfig.py
126 127 128 129 130 131 132 133 134 135 | |
get_cw_env_word(env_ind)
Returns the envelope word for a CW pulse. env_ind is required
since the CW pulse requires a single clock cycle of envelope
data to be stored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env_ind
|
int
|
starting index of the envelope in the envelope buffer |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
env_word |
Source code in qubic/rfsoc/hwconfig.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
get_env_word(env_ind, length_nsamples)
Returns the envelope word stored in the pulse command, which encodes the starting address and length of the pulse envelope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env_ind
|
int
|
starting index of the envelope in the envelope buffer |
required |
length_nsamples
|
int
|
length of the envelope in samples (could be the same as the pulse length in samples, or lower if interpolating). Note that this is the length in envelope samples, not DAC samples. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
env_word |
Source code in qubic/rfsoc/hwconfig.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
length_nclks(tlength)
Converts pulse length in seconds to integer number of clock cycles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tlength
|
float
|
time in seconds |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
time in clocks |
Source code in qubic/rfsoc/hwconfig.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |