Support set of IntVal to memory words.

This commit is contained in:
steve 2005-06-17 05:13:07 +00:00
parent 657ac8168e
commit 3b91db96cd
1 changed files with 19 additions and 27 deletions

View File

@ -1,16 +1,12 @@
/* /*
* Copyright (c) 2005 Stephen Williams (steve@icarus.com> * Copyright (c) 1999-2005 Stephen Williams (steve@icarus.com>
* Copyright (c) 1999-2000 Picture Elements, Inc.
* Stephen Williams (steve@picturel.com)
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu> * Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software * General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) * Foundation; either version 2 of the License, or (at your option)
* any later version. In order to redistribute the software in * any later version.
* binary form, you will need a Picture Elements Binary Software
* License.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -20,20 +16,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
* ---
* You should also have received a copy of the Picture Elements
* Binary Software License offer along with the source. This offer
* allows you to obtain the right to redistribute the software in
* binary (compiled) form. If you have not received it, contact
* Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704.
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_memory.cc,v 1.26 2005/06/13 00:54:04 steve Exp $" #ident "$Id: vpi_memory.cc,v 1.27 2005/06/17 05:13:07 steve Exp $"
#endif #endif
# include "vpi_priv.h" # include "vpi_priv.h"
# include "memory.h" # include "memory.h"
# include "statistics.h" # include "statistics.h"
# include <iostream>
# include <stdlib.h> # include <stdlib.h>
# include <string.h> # include <string.h>
# include <assert.h> # include <assert.h>
@ -276,20 +267,16 @@ static vpiHandle memory_word_put(vpiHandle ref, p_vpi_value val)
put_val.set_bit(idx, bit); put_val.set_bit(idx, bit);
} }
break; break;
#if 0
case vpiIntVal: case vpiIntVal: {
for (unsigned widx = 0; widx < width; widx += 32) { int cur = val->value.integer;
int cur = val->value.integer; for (unsigned idx = 0; idx < width; idx += 1) {
for (unsigned idx = widx vvp_bit4_t bit = (cur&1)? BIT4_1 : BIT4_0;
; idx < width && idx < widx+32 put_val.set_bit(idx, bit);
; idx += 1) { cur >>= 1;
unsigned char val = (cur&1)? 1 : 0; }
memory_set(rfp->mem->mem, bidx+idx, val); break;
cur >>= 1; }
}
}
break;
#endif
#if 0 #if 0
/* If the caller tries to set a HexStrVal, convert it to /* If the caller tries to set a HexStrVal, convert it to
bits and write the bits into the word. */ bits and write the bits into the word. */
@ -354,6 +341,8 @@ static vpiHandle memory_word_put(vpiHandle ref, p_vpi_value val)
} }
#endif #endif
default: default:
cerr << "internal error: memory_word put_value format="
<< val->format << endl;
assert(0); assert(0);
} }
@ -568,6 +557,9 @@ vpiHandle vpip_make_memory(vvp_memory_t mem, const char*name)
/* /*
* $Log: vpi_memory.cc,v $ * $Log: vpi_memory.cc,v $
* Revision 1.27 2005/06/17 05:13:07 steve
* Support set of IntVal to memory words.
*
* Revision 1.26 2005/06/13 00:54:04 steve * Revision 1.26 2005/06/13 00:54:04 steve
* More unified vec4 to hex string functions. * More unified vec4 to hex string functions.
* *