diff options
author | Steven Koo <steven.koo@ni.com> | 2022-06-16 20:50:41 -0500 |
---|---|---|
committer | skooNI <60897865+skooNI@users.noreply.github.com> | 2022-07-20 15:57:20 -0500 |
commit | 8f2a9a9186221fd4610c617d7ac79a78f5476949 (patch) | |
tree | 36f2a21517d727eb6a36d816968fd33661d70ac8 | |
parent | 8d05b1cda1b26b4ba134f114b9424446b410ac76 (diff) | |
download | uhd-8f2a9a9186221fd4610c617d7ac79a78f5476949.tar.gz uhd-8f2a9a9186221fd4610c617d7ac79a78f5476949.tar.bz2 uhd-8f2a9a9186221fd4610c617d7ac79a78f5476949.zip |
uhd: refactor get_all_addrs to remove duplicates
This commit refactors the existing register definitions, so that
duplicate entries don't get added to the get_all_addrs method.
Duplicates caused long builds on macOS/Clang, where build times
would go from sub 5 min to 50 min or more likely because
of the compiler trying to optimize.
Signed-off-by: Steven Koo <steven.koo@ni.com>
-rwxr-xr-x | host/lib/ic_reg_maps/gen_zbx_cpld_regs.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/host/lib/ic_reg_maps/gen_zbx_cpld_regs.py b/host/lib/ic_reg_maps/gen_zbx_cpld_regs.py index fce051d53..5e5274930 100755 --- a/host/lib/ic_reg_maps/gen_zbx_cpld_regs.py +++ b/host/lib/ic_reg_maps/gen_zbx_cpld_regs.py @@ -399,19 +399,28 @@ void set_reg(uint16_t addr, uint32_t val) } } +<% + ro_regs = set() + for reg in filter(lambda reg: reg.is_readonly(), filter(all_addr_filter, regs)): + for index in range(reg.get_array_len() if reg.is_array else 1): + ro_regs.add(reg.get_addr() + index * reg.get_addr_step_size()) + + rw_regs = set() + for reg in filter(lambda reg: not reg.is_readonly(), filter(all_addr_filter, regs)): + for index in range(reg.get_array_len() if reg.is_array else 1): + rw_regs.add(reg.get_addr() + index * reg.get_addr_step_size()) +%> + template<typename T> std::set<T> get_all_addrs(bool include_ro = false) { std::set<T> addrs; - % for reg in filter(all_addr_filter, regs): - % if reg.is_readonly(): if (include_ro) { - % else: - { - % endif - % for index in range(reg.get_array_len() if reg.is_array else 1): - addrs.insert(${reg.get_addr() + index * reg.get_addr_step_size()}); - % endfor + % for reg in sorted(ro_regs): + addrs.insert(${reg}); + % endfor } + % for reg in sorted(rw_regs): + addrs.insert(${reg}); % endfor return addrs; } |