Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fw-objec-name
Browse files Browse the repository at this point in the history
  • Loading branch information
bocchino committed Feb 26, 2024
2 parents da19326 + d9fa43a commit b76f713
Show file tree
Hide file tree
Showing 26 changed files with 507 additions and 416 deletions.
25 changes: 2 additions & 23 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,7 @@ Copyright (c) 2020 California Institute of Technology ("Caltech").
U.S. Government sponsorship acknowledged.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of Caltech nor its operating division, the Jet Propulsion
Laboratory, nor the names of its contributors may be used to endorse or
Neither the name of Caltech nor its operating division, the Jet Propulsion
Laboratory, nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ object ComponentInstance {
queueSize <- getQueueSize(
a,
data.name,
Locations.get(node.id),
componentKind,
data.queueSize
)
Expand Down Expand Up @@ -130,6 +131,7 @@ object ComponentInstance {
private def getQueueSize(
a: Analysis,
name: String,
loc: Location,
componentKind: Ast.ComponentKind,
nodeOpt: Option[AstNode[Ast.Expr]]
): Result.Result[Option[BigInt]] = {
Expand All @@ -140,8 +142,12 @@ object ComponentInstance {
"passive component may not have queue size"
)
case (_, Some(_)) => a.getNonnegativeBigIntValueOpt(nodeOpt)
case (_, None) =>
Right(None)
case (Ast.ComponentKind.Passive, None) => Right(None)
case _ => invalid(
name,
loc,
s"$componentKind component must have queue size"
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,12 @@ case class ComponentCommands (
cmdSeqParam
),
CppDoc.Type("void"),
lines("// Defaults to no-op; can be overridden"),
lines(
s"""|// Defaults to no-op; can be overridden
|(void) opCode;
|(void) cmdSeq;
|"""
),
CppDoc.Function.Virtual
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ case class ComponentDataProducts (
| sizeof(FwDpIdType) +
| $typeSize;
|Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
|if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
|if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
| const FwDpIdType id = this->baseId + RecordId::$name;
| status = this->dataBuffer.serialize(id);
| status = this->m_dataBuffer.serialize(id);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| status = this->dataBuffer.serialize(elt);
| status = this->m_dataBuffer.serialize(elt);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| this->dataSize += sizeDelta;
| this->m_dataSize += sizeDelta;
|}
|else {
| status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down Expand Up @@ -425,11 +425,11 @@ case class ComponentDataProducts (
// Optimize the U8 case
case Type.U8 =>
"""| const bool omitSerializedLength = true;
| status = this->dataBuffer.serialize(array, size, omitSerializedLength);
| status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);"""
case _ =>
"""| for (FwSizeType i = 0; i < size; i++) {
| status = this->dataBuffer.serialize(array[i]);
| status = this->m_dataBuffer.serialize(array[i]);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| }"""
}).stripMargin
Expand All @@ -440,14 +440,14 @@ case class ComponentDataProducts (
| sizeof(FwSizeType) +
| size * $eltSize;
|Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
|if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
|if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
| const FwDpIdType id = this->baseId + RecordId::$name;
| status = this->dataBuffer.serialize(id);
| status = this->m_dataBuffer.serialize(id);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| status = this->dataBuffer.serialize(size);
| status = this->m_dataBuffer.serialize(size);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
|$serializeElts
| this->dataSize += sizeDelta;
| this->m_dataSize += sizeDelta;
|}
|else {
| status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/active_no_queue_size.fpp:9.1
instance c: C base id 0x100 \
^
error: invalid component instance definition c: active component must have queue size
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_no_queue_size.fpp:9.1
instance c: C base id 0x100
^
error: invalid component instance definition c: queued component must have queue size
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * ActiveAsyncProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -130,13 +130,13 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
ActiveAsyncProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -156,17 +156,17 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -181,13 +181,13 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32Record;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -207,16 +207,16 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U8);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
const bool omitSerializedLength = true;
status = this->dataBuffer.serialize(array, size, omitSerializedLength);
status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3380,6 +3380,8 @@ void ActiveCommandsComponentBase ::
)
{
// Defaults to no-op; can be overridden
(void) opCode;
(void) cmdSeq;
}

void ActiveCommandsComponentBase ::
Expand All @@ -3389,6 +3391,8 @@ void ActiveCommandsComponentBase ::
)
{
// Defaults to no-op; can be overridden
(void) opCode;
(void) cmdSeq;
}

void ActiveCommandsComponentBase ::
Expand All @@ -3398,6 +3402,8 @@ void ActiveCommandsComponentBase ::
)
{
// Defaults to no-op; can be overridden
(void) opCode;
(void) cmdSeq;
}

void ActiveCommandsComponentBase ::
Expand All @@ -3407,6 +3413,8 @@ void ActiveCommandsComponentBase ::
)
{
// Defaults to no-op; can be overridden
(void) opCode;
(void) cmdSeq;
}

void ActiveCommandsComponentBase ::
Expand All @@ -3416,6 +3424,8 @@ void ActiveCommandsComponentBase ::
)
{
// Defaults to no-op; can be overridden
(void) opCode;
(void) cmdSeq;
}

// ----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * ActiveGetProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -128,13 +128,13 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
ActiveGetProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -154,17 +154,17 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -179,13 +179,13 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32Record;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -205,16 +205,16 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U8);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
const bool omitSerializedLength = true;
status = this->dataBuffer.serialize(array, size, omitSerializedLength);
status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Loading

0 comments on commit b76f713

Please sign in to comment.