New AtdfService - provides conversion of Microchip ATDF files to Bloom's new TDF format

This commit is contained in:
Nav
2024-02-22 20:54:48 +00:00
parent ccf631fcc7
commit 35873cf031
4 changed files with 1015 additions and 0 deletions

View File

@@ -25,6 +25,21 @@ class MemorySegmentSection
$this->subSections = $subSections;
}
public function getInnermostSubSectionContainingAddressRange(int $startAddress, int $endAddress)
: ?MemorySegmentSection {
if ($this->containsAddressRange($startAddress, $endAddress)) {
return null;
}
foreach ($this->subSections as $section) {
if ($section->containsAddressRange($startAddress, $endAddress)) {
return $section->getInnermostSubSectionContainingAddressRange($startAddress, $endAddress);
}
}
return $this;
}
public function contains(MemorySegment $other): bool
{
$endAddress = !is_null($this->startAddress) && !is_null($this->size)
@@ -42,6 +57,19 @@ class MemorySegmentSection
;
}
public function containsAddressRange(int $subjectStartAddress, int $subjectEndAddress): bool
{
$endAddress = !is_null($this->startAddress) && !is_null($this->size)
? ($this->startAddress + $this->size - 1) : null;
return
$this->startAddress !== null
&& $endAddress !== null
&& $this->startAddress <= $subjectStartAddress
&& $endAddress >= $subjectEndAddress
;
}
public function intersectsWith(MemorySegmentSection $other): bool
{
$endAddress = !is_null($this->startAddress) && !is_null($this->size)