Array access to queue variables.
This commit is contained in:
parent
0894bc6409
commit
9b4681918b
|
|
@ -104,7 +104,7 @@ static void string_ex_select(ivl_expr_t expr)
|
|||
|
||||
/* Assume the sub-expression is a signal */
|
||||
ivl_signal_t sig = ivl_expr_signal(sube);
|
||||
assert(ivl_signal_data_type(sig) == IVL_VT_DARRAY);
|
||||
assert(ivl_signal_data_type(sig) == IVL_VT_DARRAY || ivl_signal_data_type(sig) == IVL_VT_QUEUE);
|
||||
|
||||
draw_eval_expr_into_integer(shift, 3);
|
||||
fprintf(vvp_out, " %%load/dar/str v%p_0;\n", sig);
|
||||
|
|
|
|||
|
|
@ -1858,7 +1858,7 @@ static int show_push_frontback_method(ivl_statement_t net)
|
|||
fprintf(vvp_out, " %%store/%s/str v%p_0;\n", type_code, var);
|
||||
break;
|
||||
default:
|
||||
vec = draw_eval_expr(parm1, STUFF_OK_RO);
|
||||
vec = draw_eval_expr_wid(parm1, width_of_packed_type(element_type), STUFF_OK_RO);
|
||||
fprintf(vvp_out, " %%set/%s v%p_0, %u, %u;\n",
|
||||
type_code, var, vec.base, vec.wid);
|
||||
if (vec.base >= 4) clr_vector(vec);
|
||||
|
|
|
|||
|
|
@ -201,6 +201,36 @@ void vvp_queue_string::push_back(const string&val)
|
|||
array_.push_back(val);
|
||||
}
|
||||
|
||||
void vvp_queue_string::set_word(unsigned adr, const string&value)
|
||||
{
|
||||
if (adr >= array_.size())
|
||||
return;
|
||||
|
||||
list<string>::iterator cur = array_.begin();
|
||||
while (adr > 0) {
|
||||
cur ++;
|
||||
adr -= 1;
|
||||
}
|
||||
|
||||
*cur = value;
|
||||
}
|
||||
|
||||
void vvp_queue_string::get_word(unsigned adr, string&value)
|
||||
{
|
||||
if (adr >= array_.size()) {
|
||||
value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
list<string>::const_iterator cur = array_.begin();
|
||||
while (adr > 0) {
|
||||
cur ++;
|
||||
adr -= 1;
|
||||
}
|
||||
|
||||
value = *cur;
|
||||
}
|
||||
|
||||
vvp_queue_vec4::~vvp_queue_vec4()
|
||||
{
|
||||
}
|
||||
|
|
@ -210,6 +240,36 @@ size_t vvp_queue_vec4::get_size() const
|
|||
return array_.size();
|
||||
}
|
||||
|
||||
void vvp_queue_vec4::set_word(unsigned adr, const vvp_vector4_t&value)
|
||||
{
|
||||
if (adr >= array_.size())
|
||||
return;
|
||||
|
||||
list<vvp_vector4_t>::iterator cur = array_.begin();
|
||||
while (adr > 0) {
|
||||
cur ++;
|
||||
adr -= 1;
|
||||
}
|
||||
|
||||
*cur = value;
|
||||
}
|
||||
|
||||
void vvp_queue_vec4::get_word(unsigned adr, vvp_vector4_t&value)
|
||||
{
|
||||
if (adr >= array_.size()) {
|
||||
value = vvp_vector4_t();
|
||||
return;
|
||||
}
|
||||
|
||||
list<vvp_vector4_t>::const_iterator cur = array_.begin();
|
||||
while (adr > 0) {
|
||||
cur ++;
|
||||
adr -= 1;
|
||||
}
|
||||
|
||||
value = *cur;
|
||||
}
|
||||
|
||||
void vvp_queue_vec4::push_back(const vvp_vector4_t&val)
|
||||
{
|
||||
array_.push_back(val);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ class vvp_queue_vec4 : public vvp_queue {
|
|||
~vvp_queue_vec4();
|
||||
|
||||
size_t get_size(void) const;
|
||||
void set_word(unsigned adr, const vvp_vector4_t&value);
|
||||
void get_word(unsigned adr, vvp_vector4_t&value);
|
||||
void push_back(const vvp_vector4_t&value);
|
||||
void push_front(const vvp_vector4_t&value);
|
||||
|
||||
|
|
@ -123,8 +125,8 @@ class vvp_queue_string : public vvp_queue {
|
|||
~vvp_queue_string();
|
||||
|
||||
size_t get_size(void) const;
|
||||
//void set_word(unsigned adr, const std::string&value);
|
||||
//void get_word(unsigned adr, std::string&value);
|
||||
void set_word(unsigned adr, const std::string&value);
|
||||
void get_word(unsigned adr, std::string&value);
|
||||
void push_back(const std::string&value);
|
||||
//void push_front(const std::string&value);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue