CPLD: Extract row addresses so I can output to C file.

This commit is contained in:
Jared Boone
2019-03-09 16:34:14 -08:00
parent 5876fc9121
commit 16d36c54aa

View File

@ -6,6 +6,7 @@ bits_of_address = 7
bits_of_data = 274 bits_of_data = 274
bytes_of_data = (bits_of_data + 7) // 8 bytes_of_data = (bits_of_data + 7) // 8
bits_in_program_row = bits_of_address + bits_of_data bits_in_program_row = bits_of_address + bits_of_data
address_sequence = (0x00, 0x40, 0x60, 0x20, 0x30, 0x70, 0x50, 0x10, 0x18, 0x58, 0x78, 0x38, 0x28, 0x68, 0x48, 0x08, 0x0c, 0x4c, 0x6c, 0x2c, 0x3c, 0x7c, 0x5c, 0x1c, 0x14, 0x54, 0x74, 0x34, 0x24, 0x64, 0x44, 0x04, 0x06, 0x46, 0x66, 0x26, 0x36, 0x76, 0x56, 0x16, 0x1e, 0x5e, 0x7e, 0x3e, 0x2e, 0x6e, 0x4e, 0x0e, 0x0a, 0x4a, 0x6a, 0x2a, 0x3a, 0x7a, 0x5a, 0x1a, 0x12, 0x52, 0x72, 0x32, 0x22, 0x62, 0x42, 0x02, 0x03, 0x43, 0x63, 0x23, 0x33, 0x73, 0x53, 0x13, 0x1b, 0x5b, 0x7b, 0x3b, 0x2b, 0x6b, 0x4b, 0x0b, 0x0f, 0x4f, 0x6f, 0x2f, 0x3f, 0x7f, 0x5f, 0x1f, 0x17, 0x57, 0x77, 0x37, 0x27, 0x67, 0x47, 0x07, 0x05, 0x45,)
def values_list_line_wrap(values): def values_list_line_wrap(values):
line_length = 16 line_length = 16
@ -102,8 +103,6 @@ def extract_programming_data(commands):
} }
def validate_programming_data(programming_data): def validate_programming_data(programming_data):
expected_address_sequence = (0x00, 0x40, 0x60, 0x20, 0x30, 0x70, 0x50, 0x10, 0x18, 0x58, 0x78, 0x38, 0x28, 0x68, 0x48, 0x08, 0x0c, 0x4c, 0x6c, 0x2c, 0x3c, 0x7c, 0x5c, 0x1c, 0x14, 0x54, 0x74, 0x34, 0x24, 0x64, 0x44, 0x04, 0x06, 0x46, 0x66, 0x26, 0x36, 0x76, 0x56, 0x16, 0x1e, 0x5e, 0x7e, 0x3e, 0x2e, 0x6e, 0x4e, 0x0e, 0x0a, 0x4a, 0x6a, 0x2a, 0x3a, 0x7a, 0x5a, 0x1a, 0x12, 0x52, 0x72, 0x32, 0x22, 0x62, 0x42, 0x02, 0x03, 0x43, 0x63, 0x23, 0x33, 0x73, 0x53, 0x13, 0x1b, 0x5b, 0x7b, 0x3b, 0x2b, 0x6b, 0x4b, 0x0b, 0x0f, 0x4f, 0x6f, 0x2f, 0x3f, 0x7f, 0x5f, 0x1f, 0x17, 0x57, 0x77, 0x37, 0x27, 0x67, 0x47, 0x07, 0x05, 0x45,)
# Validate program blocks: # Validate program blocks:
# There should be two extracted program blocks. The first contains the # There should be two extracted program blocks. The first contains the
@ -113,7 +112,7 @@ def validate_programming_data(programming_data):
# First program phase writes the bitstream to flash (or SRAM) with # First program phase writes the bitstream to flash (or SRAM) with
# special bit(s) not asserted, so the bitstream is not yet valid. # special bit(s) not asserted, so the bitstream is not yet valid.
assert(extract_addresses(programming_data['program'][0]) == expected_address_sequence) assert(extract_addresses(programming_data['program'][0]) == address_sequence)
# Second program phase updates a single row to finish the programming # Second program phase updates a single row to finish the programming
# process. # process.
@ -129,8 +128,8 @@ def validate_programming_data(programming_data):
assert(programming_data['verify'][0] == programming_data['verify'][1]) assert(programming_data['verify'][0] == programming_data['verify'][1])
# Check the row address order of the second verify block. # Check the row address order of the second verify block.
assert(extract_addresses(programming_data['verify'][0]) == expected_address_sequence) assert(extract_addresses(programming_data['verify'][0]) == address_sequence)
assert(extract_addresses(programming_data['verify'][1]) == expected_address_sequence) assert(extract_addresses(programming_data['verify'][1]) == address_sequence)
# Checks across programming and verification: # Checks across programming and verification: