#! /usr/bin/env python3 ############################################################################### # # Copyright 2022 # ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################################### # Author: Reinier vd Walle # Purpose: Generate the hex files for RAM initialization in SDP designs ############################################################################### from intelhex import IntelHex import struct for i in range(0,6): f = IntelHex() for j in range(0,2*488): #f.puts(j*4, struct.pack(">I",j)) f.puts(j*2, struct.pack(">H",j)) f.write_hex_file("bf_unit_ss_wide_"+str(i)+".hex", byte_count = 2) for i in range(0,12): f = IntelHex() for j in range(0,2*488): f[4*j] = 0x00 f[4*j + 1] = 0x00 f[4*j + 2] = 0x40 f[4*j + 3] = 0x00 f.write_hex_file("bf_unit_weights_"+str(i)+".hex", byte_count = 4) for i in range(0,6): f = IntelHex() for j in range(0,1024): f[4*j] = 0x00 f[4*j + 1] = 0x00 f[4*j + 2] = 0x20 f[4*j + 3] = 0x00 f.write_hex_file("gains_1024_complex_16b13f_unit_"+str(i)+".hex", byte_count = 4)