Adjusts delay in monitoring script and adds clock frequency calculator
Increases the delay in the monitoring script from 1 second to 3 seconds to reduce resource strain during rapid file changes. Introduces a new Python script for calculating optimal clock frequency settings based on input and target frequencies.
This commit is contained in:
@@ -76,8 +76,8 @@ echo "👂 Monitoring $BITFILE for changes... (Press Ctrl+C to exit)"
|
|||||||
# ♻️ Infinite watch loop
|
# ♻️ Infinite watch loop
|
||||||
while true; do
|
while true; do
|
||||||
inotifywait -e close_write "$BITFILE" >/dev/null 2>&1
|
inotifywait -e close_write "$BITFILE" >/dev/null 2>&1
|
||||||
echo "🌀 Change detected. Waiting 1 second..."
|
echo "🌀 Change detected. Waiting 3 second..."
|
||||||
sleep 1
|
sleep 3
|
||||||
flash_bitstream
|
flash_bitstream
|
||||||
echo "✅ Done. Waiting for next change..."
|
echo "✅ Done. Waiting for next change..."
|
||||||
done
|
done
|
||||||
|
29
clkfx.py
Normal file
29
clkfx.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
def find_best_clkfx(input_freq, target_freq):
|
||||||
|
best_m = 0
|
||||||
|
best_d = 0
|
||||||
|
best_error = float('inf')
|
||||||
|
best_output = 0
|
||||||
|
|
||||||
|
for m in range(2, 33): # CLKFX_MULTIPLY 2..32
|
||||||
|
for d in range(1, 33): # CLKFX_DIVIDE 1..32
|
||||||
|
output_freq = input_freq * m / d
|
||||||
|
error = abs(output_freq - target_freq)
|
||||||
|
|
||||||
|
if error < best_error:
|
||||||
|
best_error = error
|
||||||
|
best_m = m
|
||||||
|
best_d = d
|
||||||
|
best_output = output_freq
|
||||||
|
|
||||||
|
relative_error = (best_error / target_freq) * 100
|
||||||
|
|
||||||
|
print(f"Beste Werte:")
|
||||||
|
print(f" CLKFX_MULTIPLY => {best_m}")
|
||||||
|
print(f" CLKFX_DIVIDE => {best_d}")
|
||||||
|
print(f"Erzeugte Frequenz: {best_output:.6f} MHz")
|
||||||
|
print(f"Abweichung: {best_error:.6f} MHz ({relative_error:.3f}%)")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
input_freq = float(input("Eingangsfrequenz (MHz): "))
|
||||||
|
target_freq = float(input("Ziel-Frequenz (MHz): "))
|
||||||
|
find_best_clkfx(input_freq, target_freq)
|
Reference in New Issue
Block a user