-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Remove largest duplicate substr of reg name
Problem: Sometimes register names contain duplicate strings that unnecessarily lengthen them. Solution: Remove the largest duplicated substring, with a specified delimiter to avoid removing mere duplicated characters. Testing: Unit-level test of helper function, integration level test with SVD file in and expected out. Issues: Closes #267.
- Loading branch information
1 parent
666ee0d
commit 0e3ac47
Showing
4 changed files
with
315 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<device schemaVersion="1.1" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" | ||
xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_1.xsd"> | ||
<name>STM32L4x2</name> | ||
<peripherals> | ||
<peripheral> | ||
<name>DAC1</name> | ||
<description>Digital-to-analog converter</description> | ||
<groupName>DAC</groupName> | ||
<baseAddress>0x40007400</baseAddress> | ||
<addressBlock> | ||
<offset>0x0</offset> | ||
<size>0x400</size> | ||
<usage>registers</usage> | ||
</addressBlock> | ||
<registers> | ||
<register> | ||
<name>CR</name> | ||
<displayName>CR</displayName> | ||
<addressOffset>0x0</addressOffset> | ||
<size>0x20</size> | ||
<access>read-write</access> | ||
<resetValue>0x00000000</resetValue> | ||
<fields> | ||
<field> | ||
<name>EN1</name> | ||
<description>DAC channel1 enable</description> | ||
<bitOffset>0</bitOffset> | ||
<bitWidth>1</bitWidth> | ||
</field> | ||
</fields> | ||
</register> | ||
</registers> | ||
</peripheral> | ||
<peripheral> | ||
<name>DAC2</name> | ||
<description>Digital-to-analog converter</description> | ||
<groupName>DAC</groupName> | ||
<baseAddress>0x40007400</baseAddress> | ||
<addressBlock> | ||
<offset>0x0</offset> | ||
<size>0x400</size> | ||
<usage>registers</usage> | ||
</addressBlock> | ||
<registers> | ||
<register> | ||
<name>CR</name> | ||
<displayName>CR</displayName> | ||
<description>control register</description> | ||
<addressOffset>0x0</addressOffset> | ||
<size>0x20</size> | ||
<access>read-write</access> | ||
<resetValue>0x00000000</resetValue> | ||
<fields> | ||
<field> | ||
<name>EN1</name> | ||
<description>DAC channel1 enable</description> | ||
<bitOffset>0</bitOffset> | ||
<bitWidth>1</bitWidth> | ||
</field> | ||
</fields> | ||
</register> | ||
</registers> | ||
</peripheral> | ||
<peripheral> | ||
<name>DAC3</name> | ||
<description>Digital-to-analog converter</description> | ||
<groupName>DAC</groupName> | ||
<baseAddress>0x40007400</baseAddress> | ||
<addressBlock> | ||
<offset>0x0</offset> | ||
<size>0x400</size> | ||
<usage>registers</usage> | ||
</addressBlock> | ||
<registers> | ||
<register> | ||
<name>CR</name> | ||
<displayName>CR</displayName> | ||
<description>control register</description> | ||
<addressOffset>0x0</addressOffset> | ||
<size>0x20</size> | ||
<access>read-write</access> | ||
<resetValue>0x00000000</resetValue> | ||
<fields> | ||
<field> | ||
<name>EN1</name> | ||
<description>DAC channel1 enable</description> | ||
<bitOffset>0</bitOffset> | ||
<bitWidth>1</bitWidth> | ||
</field> | ||
</fields> | ||
</register> | ||
</registers> | ||
</peripheral> | ||
</peripherals> | ||
</device> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
_svd: stm32l4x2.svd | ||
|
||
"*": | ||
_remove_duplicate: | ||
- "_" | ||
# "*": | ||
# _remove_duplicate: | ||
# - "_" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<device schemaVersion="1.1" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" | ||
xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_1.xsd"> | ||
<name>STM32L4x2_STM32L4x2</name> | ||
<peripherals> | ||
<peripheral> | ||
<name>DAC1_DAC1</name> | ||
<description>Digital-to-analog converter</description> | ||
<groupName>DAC_DAC</groupName> | ||
<baseAddress>0x40007400</baseAddress> | ||
<addressBlock> | ||
<offset>0x0</offset> | ||
<size>0x400</size> | ||
<usage>registers</usage> | ||
</addressBlock> | ||
<registers> | ||
<register> | ||
<name>CR_CR</name> | ||
<displayName>CR_CR</displayName> | ||
<addressOffset>0x0</addressOffset> | ||
<size>0x20</size> | ||
<access>read-write</access> | ||
<resetValue>0x00000000</resetValue> | ||
<fields> | ||
<field> | ||
<name>EN1_EN1</name> | ||
<description>DAC channel1 enable</description> | ||
<bitOffset>0</bitOffset> | ||
<bitWidth>1</bitWidth> | ||
</field> | ||
</fields> | ||
</register> | ||
</registers> | ||
</peripheral> | ||
<peripheral> | ||
<name>DAC2</name> | ||
<description>Digital-to-analog converter</description> | ||
<groupName>DAC</groupName> | ||
<baseAddress>0x40007400</baseAddress> | ||
<addressBlock> | ||
<offset>0x0</offset> | ||
<size>0x400</size> | ||
<usage>registers</usage> | ||
</addressBlock> | ||
<registers> | ||
<register> | ||
<name>CR</name> | ||
<displayName>CR</displayName> | ||
<description>control register</description> | ||
<addressOffset>0x0</addressOffset> | ||
<size>0x20</size> | ||
<access>read-write</access> | ||
<resetValue>0x00000000</resetValue> | ||
<fields> | ||
<field> | ||
<name>EN1</name> | ||
<description>DAC channel1 enable</description> | ||
<bitOffset>0</bitOffset> | ||
<bitWidth>1</bitWidth> | ||
</field> | ||
</fields> | ||
</register> | ||
</registers> | ||
</peripheral> | ||
<peripheral> | ||
<name>DAC3</name> | ||
<description>Digital-to-analog converter</description> | ||
<groupName>DAC</groupName> | ||
<baseAddress>0x40007400</baseAddress> | ||
<addressBlock> | ||
<offset>0x0</offset> | ||
<size>0x400</size> | ||
<usage>registers</usage> | ||
</addressBlock> | ||
<registers> | ||
<register> | ||
<name>CR</name> | ||
<displayName>CR</displayName> | ||
<description>control register</description> | ||
<addressOffset>0x0</addressOffset> | ||
<size>0x20</size> | ||
<access>read-write</access> | ||
<resetValue>0x00000000</resetValue> | ||
<fields> | ||
<field> | ||
<name>EN1</name> | ||
<description>DAC channel1 enable</description> | ||
<bitOffset>0</bitOffset> | ||
<bitWidth>1</bitWidth> | ||
</field> | ||
</fields> | ||
</register> | ||
</registers> | ||
</peripheral> | ||
</peripherals> | ||
</device> |
This file contains 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