Fix streaming concatenation uninitialized RMW access (#8143)
This commit is contained in:
parent
d9fb606869
commit
94a63dd407
|
|
@ -2289,7 +2289,7 @@ inline QData VL_PACK_Q_UQ(int /*obits*/, int lbits, const VlUnpacked<QData, N_De
|
|||
}
|
||||
|
||||
inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue<CData>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger
|
||||
const int offset = obits - q.size() * lbits;
|
||||
for (size_t i = 0; i < q.size(); ++i)
|
||||
|
|
@ -2299,7 +2299,7 @@ inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue
|
|||
}
|
||||
|
||||
inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue<SData>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger
|
||||
const int offset = obits - q.size() * lbits;
|
||||
for (size_t i = 0; i < q.size(); ++i)
|
||||
|
|
@ -2309,7 +2309,7 @@ inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue
|
|||
}
|
||||
|
||||
inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue<IData>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger
|
||||
const int offset = obits - q.size() * lbits;
|
||||
for (size_t i = 0; i < q.size(); ++i)
|
||||
|
|
@ -2321,7 +2321,7 @@ inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue
|
|||
template <std::size_t N_Depth>
|
||||
inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
|
||||
const VlUnpacked<CData, N_Depth>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
for (size_t i = 0; i < N_Depth; ++i)
|
||||
_vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
|
||||
return owp;
|
||||
|
|
@ -2330,7 +2330,7 @@ inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
|
|||
template <std::size_t N_Depth>
|
||||
inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
|
||||
const VlUnpacked<SData, N_Depth>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
for (size_t i = 0; i < N_Depth; ++i)
|
||||
_vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
|
||||
return owp;
|
||||
|
|
@ -2339,14 +2339,14 @@ inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
|
|||
template <std::size_t N_Depth>
|
||||
inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
|
||||
const VlUnpacked<IData, N_Depth>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
for (size_t i = 0; i < N_Depth; ++i)
|
||||
_vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
|
||||
return owp;
|
||||
}
|
||||
|
||||
inline WDataOutP VL_PACK_W_RQ(int obits, int lbits, WDataOutP owp, const VlQueue<QData>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger
|
||||
const int offset = obits - q.size() * lbits;
|
||||
for (size_t i = 0; i < q.size(); ++i)
|
||||
|
|
@ -2358,7 +2358,7 @@ inline WDataOutP VL_PACK_W_RQ(int obits, int lbits, WDataOutP owp, const VlQueue
|
|||
template <std::size_t N_Depth>
|
||||
inline WDataOutP VL_PACK_W_UQ(int obits, int lbits, WDataOutP owp,
|
||||
const VlUnpacked<QData, N_Depth>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
for (size_t i = 0; i < N_Depth; ++i)
|
||||
_vl_insert_WQ(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
|
||||
return owp;
|
||||
|
|
@ -2367,7 +2367,7 @@ inline WDataOutP VL_PACK_W_UQ(int obits, int lbits, WDataOutP owp,
|
|||
template <std::size_t N_Words>
|
||||
inline WDataOutP VL_PACK_W_RW(int obits, int lbits, WDataOutP owp,
|
||||
const VlQueue<VlWide<N_Words>>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger
|
||||
const int offset = obits - q.size() * lbits;
|
||||
for (size_t i = 0; i < q.size(); ++i)
|
||||
|
|
@ -2379,7 +2379,7 @@ inline WDataOutP VL_PACK_W_RW(int obits, int lbits, WDataOutP owp,
|
|||
template <std::size_t N_Depth, std::size_t N_Words>
|
||||
inline WDataOutP VL_PACK_W_UW(int obits, int lbits, WDataOutP owp,
|
||||
const VlUnpacked<VlWide<N_Words>, N_Depth>& q) {
|
||||
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
|
||||
VL_MEMSET_ZERO_W(owp, VL_WORDS_I(obits));
|
||||
if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger
|
||||
const int offset = obits - q.size() * lbits;
|
||||
for (size_t i = 0; i < N_Depth; ++i)
|
||||
|
|
|
|||
|
|
@ -516,6 +516,51 @@ module t ( /*AUTOARG*/
|
|||
1024'hab3156d4b752f843537d68dfbf48f1f78af787ff8df2c257cd6fa7c795d300000000000000000000000000000000ffffffffa5bbf5cc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
|
||||
end
|
||||
|
||||
// Streaming a queue into a packed destination wider than the source must assign the whole
|
||||
// of the destination, including the bits below the left aligned source data. Each case
|
||||
// first streams a source that is as wide as the destination, so all of the destination is
|
||||
// set to a non-zero value, then streams a narrower source into the same destination.
|
||||
begin
|
||||
cdata_q_t cdata_q;
|
||||
qdata_logic_q_t qdata_q;
|
||||
wide_q_t wide_q;
|
||||
logic [255:0] p256;
|
||||
logic [383:0] p384;
|
||||
|
||||
// 8-bit elements
|
||||
cdata_q = cdata_q_t'(
|
||||
256'h00010203_04050607_08090a0b_0c0d0e0f_10111213_14151617_18191a1b_1c1d1e1f);
|
||||
p256 = {>>{cdata_q}};
|
||||
`checkh(p256,
|
||||
256'h00010203_04050607_08090a0b_0c0d0e0f_10111213_14151617_18191a1b_1c1d1e1f);
|
||||
cdata_q = cdata_q_t'(64'h00010203_04050607);
|
||||
p256 = {>>{cdata_q}};
|
||||
`checkh(p256,
|
||||
256'h00010203_04050607_00000000_00000000_00000000_00000000_00000000_00000000);
|
||||
|
||||
// 64-bit elements
|
||||
qdata_q = qdata_logic_q_t'(
|
||||
256'hdeadbeef_cafebabe_feedface_12345678_11112222_33334444_55556666_77778888);
|
||||
p256 = {>>{qdata_q}};
|
||||
`checkh(p256,
|
||||
256'hdeadbeef_cafebabe_feedface_12345678_11112222_33334444_55556666_77778888);
|
||||
qdata_q = qdata_logic_q_t'(128'hdeadbeef_cafebabe_feedface_12345678);
|
||||
p256 = {>>{qdata_q}};
|
||||
`checkh(p256,
|
||||
256'hdeadbeef_cafebabe_feedface_12345678_00000000_00000000_00000000_00000000);
|
||||
|
||||
// 128-bit (VlWide) elements
|
||||
wide_q = wide_q_t'(
|
||||
384'hdeadbeef_cafebabe_feedface_12345678_11112222_33334444_55556666_77778888_aaaabbbb_ccccdddd_eeeeffff_00001111);
|
||||
p384 = {>>{wide_q}};
|
||||
`checkh(p384,
|
||||
384'hdeadbeef_cafebabe_feedface_12345678_11112222_33334444_55556666_77778888_aaaabbbb_ccccdddd_eeeeffff_00001111);
|
||||
wide_q = wide_q_t'(128'hdeadbeef_cafebabe_feedface_12345678);
|
||||
p384 = {>>{wide_q}};
|
||||
`checkh(p384,
|
||||
384'hdeadbeef_cafebabe_feedface_12345678_00000000_00000000_00000000_00000000_00000000_00000000_00000000_00000000);
|
||||
end
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue