From b3856e879b4f48ff7d5d934de14ae8c83ecba976 Mon Sep 17 00:00:00 2001 From: morgan Date: Mon, 11 Sep 2023 11:46:17 +0800 Subject: [PATCH] refactor `write_rustc_cfg_file()` --- src/gateware/config.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gateware/config.py b/src/gateware/config.py index 10150dfc..78f97a45 100644 --- a/src/gateware/config.py +++ b/src/gateware/config.py @@ -12,11 +12,5 @@ def write_mem_file(soc, filename): def write_rustc_cfg_file(soc, filename): with open(filename, "w") as f: - for name, origin, busword, obj in soc.get_csr_regions(): - f.write("has_{}\n".format(name.lower())) - for name, value in soc.get_constants(): - if name.upper().startswith("CONFIG_"): - if value is None: - f.write("{}\n".format(name.lower()[7:])) - else: - f.write("{}=\"{}\"\n".format(name.lower()[7:], str(value))) + f.write(cpu_interface.get_rust_cfg( + soc.get_csr_regions(), soc.get_constants()))