Test_DataTypeConversion_to_UInt32 Icon
Test_DataTypeConversion_to_UInt32
Usage
PrimitiveComponents.Test_DataTypeConversion_to_UInt32()
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( constant_{1_{+}y(t)}, datatypeconversion_{to\_UInt32\_1_{+}u(t)} \right) \\ \mathrm{connect}\left( constant_{2_{+}y(t)}, datatypeconversion_{to\_UInt32\_2_{+}u(t)} \right) \\ \mathrm{connect}\left( constant_{3_{+}y(t)}, datatypeconversion_{to\_UInt32\_3_{+}u(t)} \right) \\ \mathrm{connect}\left( constant_{4_{+}y(t)}, datatypeconversion_{to\_UInt32\_4_{+}u(t)} \right) \\ \mathrm{connect}\left( constant_{5_{+}y(t)}, datatypeconversion_{to\_UInt32\_5_{+}u(t)} \right) \\ \mathtt{datatypeconversion\_to\_UInt32\_1.y}\left( t \right) = to\_uint32\_floor\left( \mathtt{datatypeconversion\_to\_UInt32\_1.u}\left( t \right), \mathtt{datatypeconversion\_to\_UInt32\_1.saturate\_on\_overflow} \right) \\ \mathtt{constant\_1.y}\left( t \right) = \mathtt{constant\_1.k} \\ \mathtt{datatypeconversion\_to\_UInt32\_2.y}\left( t \right) = to\_uint32\_floor\left( \mathtt{datatypeconversion\_to\_UInt32\_2.u}\left( t \right), \mathtt{datatypeconversion\_to\_UInt32\_2.saturate\_on\_overflow} \right) \\ \mathtt{constant\_2.y}\left( t \right) = \mathtt{constant\_2.k} \\ \mathtt{datatypeconversion\_to\_UInt32\_3.y}\left( t \right) = to\_uint32\_floor\left( \mathtt{datatypeconversion\_to\_UInt32\_3.u}\left( t \right), \mathtt{datatypeconversion\_to\_UInt32\_3.saturate\_on\_overflow} \right) \\ \mathtt{constant\_3.y}\left( t \right) = \mathtt{constant\_3.k} \\ \mathtt{datatypeconversion\_to\_UInt32\_4.y}\left( t \right) = to\_uint32\_floor\left( \mathtt{datatypeconversion\_to\_UInt32\_4.u}\left( t \right), \mathtt{datatypeconversion\_to\_UInt32\_4.saturate\_on\_overflow} \right) \\ \mathtt{constant\_4.y}\left( t \right) = \mathtt{constant\_4.k} \\ \mathtt{datatypeconversion\_to\_UInt32\_5.y}\left( t \right) = to\_uint32\_floor\left( \mathtt{datatypeconversion\_to\_UInt32\_5.u}\left( t \right), \mathtt{datatypeconversion\_to\_UInt32\_5.saturate\_on\_overflow} \right) \\ \mathtt{constant\_5.y}\left( t \right) = \mathtt{constant\_5.k} \\ \end{array} \right] \end{equation} \]
Source
# This test model validates the DataTypeConversion_to_UInt32 block using five constant inputs
# with both overflow modes (saturation and wrap).
#
# The test cases include:
# 42.7 → 42 (overflow=true, saturated)
# 4294967300.7 → 4 (overflow=false, wrapped)
# 4294967300.7 → 4294967295 (overflow=true, saturated)
# -3.2 → 0 (overflow=true, saturated)
# -3.2 → 4294967292 (overflow=false, wrapped)
component Test_DataTypeConversion_to_UInt32
datatypeconversion_to_UInt32_1 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = true) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 680, "y1": 210, "x2": 780, "y2": 310, "rot": 0}
}
}
}
constant_1 = BlockComponents.Constant(k = 42.7) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 240, "y1": 210, "x2": 340, "y2": 310, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_2 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = false) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 690, "y1": 380, "x2": 790, "y2": 480, "rot": 0}
}
}
}
constant_2 = BlockComponents.Constant(k = 4294967300.7) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 250, "y1": 380, "x2": 350, "y2": 480, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_3 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = true) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 570, "x2": 800, "y2": 670, "rot": 0}
}
}
}
constant_3 = BlockComponents.Constant(k = 4294967300.7) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 250, "y1": 570, "x2": 350, "y2": 670, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_4 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = true) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 710, "y1": 750, "x2": 810, "y2": 850, "rot": 0}
}
}
}
constant_4 = BlockComponents.Constant(k = -3.2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 260, "y1": 750, "x2": 360, "y2": 850, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_5 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = false) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 720, "y1": 950, "x2": 820, "y2": 1050, "rot": 0}
}
}
}
constant_5 = BlockComponents.Constant(k = -3.2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 250, "y1": 950, "x2": 350, "y2": 1050, "rot": 0}
}
}
}
relations
connect(constant_1.y, datatypeconversion_to_UInt32_1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_2.y, datatypeconversion_to_UInt32_2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_3.y, datatypeconversion_to_UInt32_3.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_4.y, datatypeconversion_to_UInt32_4.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_5.y, datatypeconversion_to_UInt32_5.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
metadata {
"Dyad": {
"experiments": {"Test_DataTypeConversion_to_UInt32_": {"stop": 2}},
"tests": {
"case1": {
"stop": 5,
"abstol": 0.00001,
"reltol": 0.00001,
"expect": {
"signals": [
"datatypeconversion_to_UInt32_1.y",
"datatypeconversion_to_UInt32_1.u",
"datatypeconversion_to_UInt32_2.y",
"datatypeconversion_to_UInt32_2.u",
"datatypeconversion_to_UInt32_3.y",
"datatypeconversion_to_UInt32_3.u",
"datatypeconversion_to_UInt32_4.y",
"datatypeconversion_to_UInt32_4.u",
"datatypeconversion_to_UInt32_5.y",
"datatypeconversion_to_UInt32_5.u"
]
}
}
}
}
}
end
Flattened Source
component Test_DataTypeConversion_to_UInt32
datatypeconversion_to_UInt32_1 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = true) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 680, "y1": 210, "x2": 780, "y2": 310, "rot": 0}
}
}
}
constant_1 = BlockComponents.Constant(k = 42.7) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 240, "y1": 210, "x2": 340, "y2": 310, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_2 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = false) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 690, "y1": 380, "x2": 790, "y2": 480, "rot": 0}
}
}
}
constant_2 = BlockComponents.Constant(k = 4294967300.7) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 250, "y1": 380, "x2": 350, "y2": 480, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_3 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = true) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 570, "x2": 800, "y2": 670, "rot": 0}
}
}
}
constant_3 = BlockComponents.Constant(k = 4294967300.7) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 250, "y1": 570, "x2": 350, "y2": 670, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_4 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = true) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 710, "y1": 750, "x2": 810, "y2": 850, "rot": 0}
}
}
}
constant_4 = BlockComponents.Constant(k = -3.2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 260, "y1": 750, "x2": 360, "y2": 850, "rot": 0}
}
}
}
datatypeconversion_to_UInt32_5 = PrimitiveComponents.WIP.DataTypeConversion_to_UInt32(saturate_on_overflow = false) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 720, "y1": 950, "x2": 820, "y2": 1050, "rot": 0}
}
}
}
constant_5 = BlockComponents.Constant(k = -3.2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 250, "y1": 950, "x2": 350, "y2": 1050, "rot": 0}
}
}
}
relations
connect(constant_1.y, datatypeconversion_to_UInt32_1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_2.y, datatypeconversion_to_UInt32_2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_3.y, datatypeconversion_to_UInt32_3.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_4.y, datatypeconversion_to_UInt32_4.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
connect(constant_5.y, datatypeconversion_to_UInt32_5.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
metadata {
"Dyad": {
"experiments": {"Test_DataTypeConversion_to_UInt32_": {"stop": 2}},
"tests": {
"case1": {
"stop": 5,
"abstol": 0.00001,
"reltol": 0.00001,
"expect": {
"signals": [
"datatypeconversion_to_UInt32_1.y",
"datatypeconversion_to_UInt32_1.u",
"datatypeconversion_to_UInt32_2.y",
"datatypeconversion_to_UInt32_2.u",
"datatypeconversion_to_UInt32_3.y",
"datatypeconversion_to_UInt32_3.u",
"datatypeconversion_to_UInt32_4.y",
"datatypeconversion_to_UInt32_4.u",
"datatypeconversion_to_UInt32_5.y",
"datatypeconversion_to_UInt32_5.u"
]
}
}
}
}
}
endTest Cases
Test Case case1
pltpltpltpltpltpltpltpltpltpltRelated
- Examples
- Experiments
- Analyses