Last active
May 15, 2025 14:05
-
-
Save wolfmanjm/1a789cbd6d5b5fc32f952ca3188ae01b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.foreach('RP2350.svd') do |line| | |
if line.include?('<bitRange>') | |
# Extract range from <bitRange>[31:0]</bitRange> | |
range_match = line.match(/\[(\d+):(\d+)\]/) | |
if range_match | |
hr = range_match[1].to_i | |
lr = range_match[2].to_i | |
puts "<bitOffset>#{lr}</bitOffset>" | |
puts "<bitWidth>#{(hr - lr) + 1}</bitWidth>" | |
end | |
end | |
puts line | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment