forked from lowRISC/ibex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec.py
21 lines (18 loc) · 790 Bytes
/
ec.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def process_cosf_values(file_path):
cosf_values = []
with open(file_path, 'r') as file:
lines = file.readlines()
for line in lines:
# Extract the `cosf` value
parts = line.split(',')
for part in parts:
if 'cosf' in part:
cosf_value = float(part.split(':')[1])
# Multiply by 10000 and format as a four-digit integer
formatted_value = int(cosf_value * 10000)
# cosf_values.append(f'{formatted_value:04d}')
cosf_values.append(f'{formatted_value}')
# Print the values as a comma-separated list
print(','.join(cosf_values))
# Call the function with the path to abs.txt
process_cosf_values('abc.txt')