Prep for future queue slicing.
This commit is contained in:
parent
d8df216a8d
commit
4576644591
|
|
@ -281,7 +281,7 @@ public:
|
|||
// Clear array. Verilog: function void delete([input index])
|
||||
void clear() { m_deque.clear(); }
|
||||
void erase(size_t index) {
|
||||
if (VL_LIKELY(index < m_deque.size())) m_deque.erase(index);
|
||||
if (VL_LIKELY(index < m_deque.size())) m_deque.erase(m_deque.begin() + index);
|
||||
}
|
||||
|
||||
// Dynamic array new[] becomes a renew()
|
||||
|
|
@ -349,7 +349,7 @@ public:
|
|||
// function void q.insert(index, value);
|
||||
void insert(size_t index, const T_Value& value) {
|
||||
if (VL_UNLIKELY(index >= m_deque.size())) return;
|
||||
m_deque[index] = value;
|
||||
m_deque.insert(m_deque.begin() + index, value);
|
||||
}
|
||||
|
||||
// For save/restore
|
||||
|
|
|
|||
|
|
@ -151,7 +151,9 @@ public:
|
|||
if (!m_dtypep) {
|
||||
str << " VUP(s=" << m_stage << ",self)";
|
||||
} else {
|
||||
str << " VUP(s=" << m_stage << ",dt=" << cvtToHex(dtypep()) << ")";
|
||||
str << " VUP(s=" << m_stage << ",dt=" << cvtToHex(dtypep());
|
||||
dtypep()->dumpSmall(str);
|
||||
str << ")";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,85 +1,4 @@
|
|||
%Error-UNSUPPORTED: t/t_queue_slice.v:22:11: Unsupported: Assignment pattern applies against non struct/union data type: 'string[$]'
|
||||
: ... In instance t
|
||||
22 | q = '{"q", "b", "c", "d", "e", "f"};
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:21:11: Unsupported: Empty '{}
|
||||
21 | q = '{};
|
||||
| ^~
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:25:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
25 | q = {"q", "b", "c", "d", "e", "f"};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:28:9: Unsupported: Queue .delete(index) method, as is O(n) complexity and slow.
|
||||
: ... In instance t
|
||||
28 | q.delete(1);
|
||||
| ^~~~~~
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:32:9: Unsupported: Queue .insert method, as is O(n) complexity and slow.
|
||||
: ... In instance t
|
||||
32 | q.insert(2, "ins2");
|
||||
| ^~~~~~
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:38:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
38 | q = {"q", "b", "c", "d", "e", "f"};
|
||||
| ^
|
||||
%Error: t/t_queue_slice.v:39:12: Illegal range select; type already selected, or bad dimension: data type is 'string[$]'
|
||||
: ... In instance t
|
||||
39 | q = q[2:3];
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:41:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
41 | q = {"q", "b", "c", "d", "e", "f"};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:42:15: Unsupported/illegal unbounded ('$') in this context.
|
||||
: ... In instance t
|
||||
42 | q = q[3:$];
|
||||
| ^
|
||||
%Error: t/t_queue_slice.v:42:15: First value of [a:b] isn't a constant, maybe you want +: or -:
|
||||
: ... In instance t
|
||||
42 | q = q[3:$];
|
||||
| ^
|
||||
%Error: t/t_queue_slice.v:42:12: Illegal range select; type already selected, or bad dimension: data type is 'string[$]'
|
||||
: ... In instance t
|
||||
42 | q = q[3:$];
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:46:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
46 | q = {q, "f1"};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:47:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
47 | q = {q, "f2"};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:48:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
48 | q = {"b1", q};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:49:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
49 | q = {"b2", q};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:50:11: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
50 | q = {q[0], q[2:$]};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:50:22: Unsupported/illegal unbounded ('$') in this context.
|
||||
: ... In instance t
|
||||
50 | q = {q[0], q[2:$]};
|
||||
| ^
|
||||
%Error: t/t_queue_slice.v:50:22: First value of [a:b] isn't a constant, maybe you want +: or -:
|
||||
: ... In instance t
|
||||
50 | q = {q[0], q[2:$]};
|
||||
| ^
|
||||
%Error: t/t_queue_slice.v:50:19: Illegal range select; type already selected, or bad dimension: data type is 'string[$]'
|
||||
: ... In instance t
|
||||
50 | q = {q[0], q[2:$]};
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:54:25: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
54 | string ai[$] = { "Foo", "Bar" };
|
||||
| ^
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:59:14: Unsupported: Assignment pattern applies against non struct/union data type: 'string[$]'
|
||||
: ... In instance t
|
||||
59 | q = '{ "BB", "CC" };
|
||||
| ^~
|
||||
%Error-UNSUPPORTED: t/t_queue_slice.v:62:14: Unsupported: Replication to form 'string[$]' data type
|
||||
: ... In instance t
|
||||
62 | q = { "BB", "CC" };
|
||||
| ^
|
||||
%Error: Exiting due to
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ compile(
|
|||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
#execute(
|
||||
# check_finished => 1,
|
||||
# );
|
||||
execute(
|
||||
check_finished => 1,
|
||||
) if !$Self->{vlt_all};
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
`define stop $stop
|
||||
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
|
||||
`define checks(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
|
||||
`define checkg(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='%g' exp='%g'\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
initial begin
|
||||
|
|
@ -19,7 +18,14 @@ module t (/*AUTOARG*/);
|
|||
i = q.size(); `checkh(i, 1);
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"non-empty\"} ");
|
||||
|
||||
q = '{};
|
||||
i = q.size(); `checkh(i, 0);
|
||||
|
||||
q = '{"q"};
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"q\"} ");
|
||||
|
||||
q = '{"q", "b", "c", "d", "e", "f"};
|
||||
if (q[0] !== "q") $stop;
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"q\", \"b\", \"c\", \"d\", \"e\", \"f\"} ");
|
||||
|
||||
q = {"q", "b", "c", "d", "e", "f"};
|
||||
|
|
@ -27,6 +33,7 @@ module t (/*AUTOARG*/);
|
|||
|
||||
q.delete(1);
|
||||
v = q[1]; `checks(v, "c");
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"q\", \"c\", \"d\", \"e\", \"f\"} ");
|
||||
|
||||
q.insert(0, "ins0");
|
||||
q.insert(2, "ins2");
|
||||
|
|
@ -35,23 +42,32 @@ module t (/*AUTOARG*/);
|
|||
v = $sformatf("%p", q); `checks(v, "'{\"ins0\", \"q\", \"ins2\", \"c\", \"d\", \"e\", \"f\"} ");
|
||||
|
||||
// Slicing
|
||||
q = {"q", "b", "c", "d", "e", "f"};
|
||||
q = '{"q", "b", "c", "d", "e", "f"};
|
||||
q = q[2:3];
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"c\", \"d\"} ");
|
||||
q = {"q", "b", "c", "d", "e", "f"};
|
||||
q = '{"q", "b", "c", "d", "e", "f"};
|
||||
q = q[3:$];
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"d\", \"e\", \"f\"} ");
|
||||
q = q[$:$];
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"f\"} ");
|
||||
|
||||
// Similar using implied notation
|
||||
q = '{"f"};
|
||||
q = {q, "f1"}; // push_front
|
||||
q = {q, "f2"}; // push_front
|
||||
q = {"b1", q}; // push_back
|
||||
q = {"b2", q}; // push_back
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"b2\", \"b1\", \"f\", \"f1\", \"f2\"} ");
|
||||
|
||||
q = {q[0], q[2:$]}; // delete element 1
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"b2\", \"d\", \"e\", \"f\", \"f1\", \"f2\"} ");
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"b2\", \"f\", \"f1\", \"f2\"} ");
|
||||
|
||||
q = {"a", "b"};
|
||||
q = {q, q};
|
||||
v = $sformatf("%p", q); `checks(v, "'{\"a\", \"b\", \"a\", \"b\"} ");
|
||||
|
||||
begin
|
||||
string ai[$] = { "Foo", "Bar" };
|
||||
string ai[$] = '{ "Foo", "Bar" };
|
||||
q = ai; // Copy
|
||||
i = q.size(); `checkh(i, 2);
|
||||
v = q.pop_front(); `checks(v, "Foo");
|
||||
|
|
|
|||
Loading…
Reference in New Issue