vec4 versions of the %force instructions.
This commit is contained in:
parent
92a5e6a698
commit
660d59a7a9
|
|
@ -112,8 +112,8 @@ extern bool of_FLAG_SET_IMM(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_FLAG_SET_VEC4(vthread_t thr, vvp_code_t code);
|
extern bool of_FLAG_SET_VEC4(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_FORCE_LINK(vthread_t thr, vvp_code_t code);
|
extern bool of_FORCE_LINK(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_FORCE_VEC4(vthread_t thr, vvp_code_t code);
|
extern bool of_FORCE_VEC4(vthread_t thr, vvp_code_t code);
|
||||||
|
extern bool of_FORCE_VEC4_OFF(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_FORCE_WR(vthread_t thr, vvp_code_t code);
|
extern bool of_FORCE_WR(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_FORCE_X0(vthread_t thr, vvp_code_t code);
|
|
||||||
extern bool of_FORK(vthread_t thr, vvp_code_t code);
|
extern bool of_FORK(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_FREE(vthread_t thr, vvp_code_t code);
|
extern bool of_FREE(vthread_t thr, vvp_code_t code);
|
||||||
extern bool of_INV(vthread_t thr, vvp_code_t code);
|
extern bool of_INV(vthread_t thr, vvp_code_t code);
|
||||||
|
|
|
||||||
|
|
@ -159,10 +159,10 @@ static const struct opcode_table_s opcode_table[] = {
|
||||||
{ "%flag_get/vec4", of_FLAG_GET_VEC4, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
|
{ "%flag_get/vec4", of_FLAG_GET_VEC4, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
|
||||||
{ "%flag_set/imm", of_FLAG_SET_IMM, 2, {OA_NUMBER, OA_BIT1, OA_NONE} },
|
{ "%flag_set/imm", of_FLAG_SET_IMM, 2, {OA_NUMBER, OA_BIT1, OA_NONE} },
|
||||||
{ "%flag_set/vec4", of_FLAG_SET_VEC4, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
|
{ "%flag_set/vec4", of_FLAG_SET_VEC4, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
|
||||||
{ "%force/link",of_FORCE_LINK,2,{OA_FUNC_PTR, OA_FUNC_PTR2, OA_NONE} },
|
{ "%force/link", of_FORCE_LINK,2,{OA_FUNC_PTR, OA_FUNC_PTR2, OA_NONE} },
|
||||||
{ "%force/vec4",of_FORCE_VEC4,1,{OA_FUNC_PTR, OA_NONE, OA_NONE} },
|
{ "%force/vec4", of_FORCE_VEC4, 1,{OA_FUNC_PTR, OA_NONE, OA_NONE} },
|
||||||
{ "%force/wr", of_FORCE_WR, 1,{OA_FUNC_PTR, OA_NONE, OA_NONE} },
|
{ "%force/vec4/off",of_FORCE_VEC4_OFF,2,{OA_FUNC_PTR, OA_BIT1, OA_NONE} },
|
||||||
{ "%force/x0",of_FORCE_X0,3,{OA_FUNC_PTR, OA_BIT1, OA_BIT2} },
|
{ "%force/wr", of_FORCE_WR, 1,{OA_FUNC_PTR, OA_NONE, OA_NONE} },
|
||||||
{ "%free", of_FREE, 1, {OA_VPI_PTR, OA_NONE, OA_NONE} },
|
{ "%free", of_FREE, 1, {OA_VPI_PTR, OA_NONE, OA_NONE} },
|
||||||
{ "%inv", of_INV, 0, {OA_NONE, OA_NONE, OA_NONE} },
|
{ "%inv", of_INV, 0, {OA_NONE, OA_NONE, OA_NONE} },
|
||||||
{ "%ix/add", of_IX_ADD, 3, {OA_NUMBER, OA_BIT1, OA_BIT2} },
|
{ "%ix/add", of_IX_ADD, 3, {OA_NUMBER, OA_BIT1, OA_BIT2} },
|
||||||
|
|
|
||||||
|
|
@ -556,27 +556,21 @@ These instructions provide a means for accessing flag bits. The
|
||||||
stack, and the %flag_set/vec4 pops the top of the vec4 stack and
|
stack, and the %flag_set/vec4 pops the top of the vec4 stack and
|
||||||
writes the LSB to the selected flag.
|
writes the LSB to the selected flag.
|
||||||
|
|
||||||
* %force/v <label>, <bit>, <wid>
|
* %force/vec4 <label>
|
||||||
|
* %force/vec4/off <label>, <off>
|
||||||
|
|
||||||
Force a constant value to the target variable. This is similar to %set
|
Perform a "force" assign of a values to the tarvet variable. The value
|
||||||
and %cassign/vec4, but it uses the force port (port-2) of the signal
|
to be forced is popped from the vec4 stack and forced to the target
|
||||||
functor instead of the normal assign port (port-0), so the signal
|
variable. The /off variant forces a part of a vector. The width of the
|
||||||
responds differently. See "VARIABLE STATEMENTS" and "NET STATEMENTS"
|
part comes from the width of the popped value, and the <off> is an
|
||||||
in the README.txt file.
|
index register that contains the cannonical offset where the value
|
||||||
|
sets written.
|
||||||
|
|
||||||
* %force/wr <var-label>
|
* %force/wr <var-label>
|
||||||
|
|
||||||
Force a constant real value to the target variable. See %force/v
|
Force a constant real value to the target variable. See %force/v
|
||||||
above. The value is popped from the real value stack.
|
above. The value is popped from the real value stack.
|
||||||
|
|
||||||
* %force/x0 <label>, <bit>, <wid>
|
|
||||||
|
|
||||||
Force a constant value to part of the target variable. This is similar
|
|
||||||
to %set/x instruction, but it uses the force port (port-2) of the signal
|
|
||||||
functor instead of the normal assign port (port-0), so the signal
|
|
||||||
responds differently. See "VARIABLE STATEMENTS" and "NET STATEMENTS"
|
|
||||||
in the README.txt file.
|
|
||||||
|
|
||||||
* %fork <code-label>, <scope-label>
|
* %fork <code-label>, <scope-label>
|
||||||
|
|
||||||
This instruction is similar to %jmp, except that it creates a new
|
This instruction is similar to %jmp, except that it creates a new
|
||||||
|
|
|
||||||
|
|
@ -3008,6 +3008,43 @@ bool of_FORCE_VEC4(vthread_t thr, vvp_code_t cp)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* %force/vec4/off <net>, <off>
|
||||||
|
*/
|
||||||
|
bool of_FORCE_VEC4_OFF(vthread_t thr, vvp_code_t cp)
|
||||||
|
{
|
||||||
|
vvp_net_t*net = cp->net;
|
||||||
|
unsigned base_idx = cp->bit_idx[0];
|
||||||
|
long base = thr->words[base_idx].w_int;
|
||||||
|
vvp_vector4_t value = thr->pop_vec4();
|
||||||
|
unsigned wid = value.size();
|
||||||
|
|
||||||
|
assert(net->fil);
|
||||||
|
|
||||||
|
// This is the width of the target vector.
|
||||||
|
unsigned use_size = net->fil->filter_size();
|
||||||
|
|
||||||
|
if (base >= (long)use_size)
|
||||||
|
return true;
|
||||||
|
if (base < -(long)use_size)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((base + wid) > use_size)
|
||||||
|
wid = use_size - base;
|
||||||
|
|
||||||
|
// Make a mask of which bits are to be forced, 0 for unforced
|
||||||
|
// bits and 1 for forced bits.
|
||||||
|
vvp_vector2_t mask (vvp_vector2_t::FILL0, use_size);
|
||||||
|
for (unsigned idx = 0 ; idx < wid ; idx += 1)
|
||||||
|
mask.set_bit(base+idx, 1);
|
||||||
|
|
||||||
|
vvp_vector4_t tmp (use_size, BIT4_Z);
|
||||||
|
tmp.set_vec(base, value);
|
||||||
|
|
||||||
|
net->force_vec4(tmp, mask);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool of_FORCE_WR(vthread_t thr, vvp_code_t cp)
|
bool of_FORCE_WR(vthread_t thr, vvp_code_t cp)
|
||||||
{
|
{
|
||||||
vvp_net_t*net = cp->net;
|
vvp_net_t*net = cp->net;
|
||||||
|
|
@ -3018,52 +3055,6 @@ bool of_FORCE_WR(vthread_t thr, vvp_code_t cp)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool of_FORCE_X0(vthread_t thr, vvp_code_t cp)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
vvp_net_t*net = cp->net;
|
|
||||||
unsigned base = cp->bit_idx[0];
|
|
||||||
unsigned wid = cp->bit_idx[1];
|
|
||||||
|
|
||||||
assert(net->fil);
|
|
||||||
|
|
||||||
// Implicitly, we get the base into the target vector from the
|
|
||||||
// X0 register.
|
|
||||||
long index = thr->words[0].w_int;
|
|
||||||
|
|
||||||
if (index < 0 && (wid <= (unsigned)-index))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (index < 0) {
|
|
||||||
wid -= (unsigned) -index;
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned use_size = net->fil->filter_size();
|
|
||||||
|
|
||||||
|
|
||||||
if (index >= (long)use_size)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (index+wid > use_size)
|
|
||||||
wid = use_size - index;
|
|
||||||
|
|
||||||
vvp_vector2_t mask(vvp_vector2_t::FILL0, use_size);
|
|
||||||
for (unsigned idx = 0 ; idx < wid ; idx += 1)
|
|
||||||
mask.set_bit(index+idx, 1);
|
|
||||||
|
|
||||||
vvp_vector4_t vector = vthread_bits_to_vector(thr, base, wid);
|
|
||||||
vvp_vector4_t value(use_size, BIT4_Z);
|
|
||||||
value.set_vec(index, vector);
|
|
||||||
|
|
||||||
net->force_vec4(value, mask);
|
|
||||||
#else
|
|
||||||
fprintf(stderr, "XXXX NOT IMPLEMENTED: %%force/x0 ...\n");
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The %fork instruction causes a new child to be created and pushed
|
* The %fork instruction causes a new child to be created and pushed
|
||||||
* in front of any existing child. This causes the new child to be
|
* in front of any existing child. This causes the new child to be
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue