Compact the vvp_code_s structure.

This commit is contained in:
steve 2001-03-11 23:06:49 +00:00
parent cbc3be0304
commit 970ba895c9
4 changed files with 46 additions and 22 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: codes.cc,v 1.1 2001/03/11 00:29:38 steve Exp $"
#ident "$Id: codes.cc,v 1.2 2001/03/11 23:06:49 steve Exp $"
#endif
# include "codes.h"
@ -95,7 +95,7 @@ void codespace_dump(FILE*fd)
if (cop->opcode == &of_ASSIGN) {
fprintf(fd, "%%assign 0x%u, %lu, %u\n",
cop->iptr, cop->number, cop->bit_idx);
cop->iptr, cop->bit_idx1, cop->bit_idx2);
} else if (cop->opcode == &of_DELAY) {
fprintf(fd, "%%delay %lu\n", cop->number);
@ -105,7 +105,7 @@ void codespace_dump(FILE*fd)
} else if (cop->opcode == &of_SET) {
fprintf(fd, "%%set 0x%lu, %u\n",
cop->iptr, cop->bit_idx);
cop->iptr, cop->bit_idx1);
} else {
fprintf(fd, "opcode %p\n", cop->opcode);
@ -116,6 +116,9 @@ void codespace_dump(FILE*fd)
/*
* $Log: codes.cc,v $
* Revision 1.2 2001/03/11 23:06:49 steve
* Compact the vvp_code_s structure.
*
* Revision 1.1 2001/03/11 00:29:38 steve
* Add the vvp engine to cvs.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: codes.h,v 1.1 2001/03/11 00:29:38 steve Exp $"
#ident "$Id: codes.h,v 1.2 2001/03/11 23:06:49 steve Exp $"
#endif
@ -47,12 +47,14 @@ extern bool of_NOOP(vthread_t thr, vvp_code_t code);
struct vvp_code_s {
vvp_code_fun opcode;
unsigned short bit_idx;
unsigned long number;
union {
unsigned number;
vvp_ipoint_t iptr;
vvp_cpoint_t cptr;
};
unsigned short bit_idx1;
unsigned short bit_idx2;
};
@ -81,6 +83,9 @@ extern void codespace_dump(FILE*fd);
/*
* $Log: codes.h,v $
* Revision 1.2 2001/03/11 23:06:49 steve
* Compact the vvp_code_s structure.
*
* Revision 1.1 2001/03/11 00:29:38 steve
* Add the vvp engine to cvs.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.cc,v 1.2 2001/03/11 22:42:11 steve Exp $"
#ident "$Id: compile.cc,v 1.3 2001/03/11 23:06:49 steve Exp $"
#endif
# include "compile.h"
@ -42,10 +42,11 @@
enum operand_e {
/* Place holder for unused operand */
OA_NONE,
/* The operand is a number, an immediate unsigned long integer */
/* The operand is a number, an immediate unsigned integer */
OA_NUMBER,
/* The operand is a thread bit index */
OA_BIT,
OA_BIT1,
OA_BIT2,
/* The operand is a pointer to code space */
OA_CODE_PTR,
/* The operand is a variable or net pointer */
@ -61,10 +62,10 @@ struct opcode_table_s {
};
const static struct opcode_table_s opcode_table[] = {
{ "%assign", of_ASSIGN, 3, {OA_FUNC_PTR, OA_NUMBER, OA_BIT} },
{ "%delay", of_DELAY, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
{ "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%set", of_SET, 2, {OA_FUNC_PTR, OA_BIT, OA_NONE} },
{ "%assign", of_ASSIGN, 3, {OA_FUNC_PTR, OA_BIT1, OA_BIT2} },
{ "%delay", of_DELAY, 1, {OA_NUMBER, OA_NONE, OA_NONE} },
{ "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%set", of_SET, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} },
{ 0, of_NOOP, 0, {OA_NONE, OA_NONE, OA_NONE} }
};
@ -229,13 +230,22 @@ void compile_code(char*label, char*mnem, comp_operands_t opa)
case OA_NONE:
break;
case OA_BIT:
case OA_BIT1:
if (opa->argv[idx].ltype != L_NUMB) {
yyerror("operand format");
break;
}
code->bit_idx = opa->argv[idx].numb;
code->bit_idx1 = opa->argv[idx].numb;
break;
case OA_BIT2:
if (opa->argv[idx].ltype != L_NUMB) {
yyerror("operand format");
break;
}
code->bit_idx2 = opa->argv[idx].numb;
break;
case OA_CODE_PTR:
@ -381,6 +391,9 @@ void compile_dump(FILE*fd)
/*
* $Log: compile.cc,v $
* Revision 1.3 2001/03/11 23:06:49 steve
* Compact the vvp_code_s structure.
*
* Revision 1.2 2001/03/11 22:42:11 steve
* Functor values and propagation.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vthread.cc,v 1.2 2001/03/11 22:42:11 steve Exp $"
#ident "$Id: vthread.cc,v 1.3 2001/03/11 23:06:49 steve Exp $"
#endif
# include "vthread.h"
@ -64,14 +64,14 @@ bool of_ASSIGN(vthread_t thr, vvp_code_t cp)
printf("thread %p: %%assign\n", thr);
unsigned char bit_val = 3;
if ((cp->bit_idx & ~0x3) == 0x0) {
bit_val = cp->bit_idx&3;
if ((cp->bit_idx2 & ~0x3) == 0x0) {
bit_val = cp->bit_idx2&3;
} else {
printf("XXXX bit_idx out of range?\n");
}
schedule_assign(cp->iptr, bit_val, cp->number);
schedule_assign(cp->iptr, bit_val, cp->bit_idx1);
return true;
}
@ -95,11 +95,11 @@ bool of_NOOP(vthread_t thr, vvp_code_t cp)
bool of_SET(vthread_t thr, vvp_code_t cp)
{
printf("thread %p: %%set %lu, %u\n", thr, cp->iptr, cp->bit_idx);
printf("thread %p: %%set %u, %u\n", thr, cp->iptr, cp->bit_idx1);
unsigned char bit_val = 3;
if ((cp->bit_idx & ~0x3) == 0x0) {
bit_val = cp->bit_idx&3;
if ((cp->bit_idx1 & ~0x3) == 0x0) {
bit_val = cp->bit_idx1&3;
} else {
printf("XXXX bit_idx out of range?\n");
@ -112,6 +112,9 @@ bool of_SET(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.3 2001/03/11 23:06:49 steve
* Compact the vvp_code_s structure.
*
* Revision 1.2 2001/03/11 22:42:11 steve
* Functor values and propagation.
*