V0.9: Fix display of net array words when data type is signed.

When VVP compiles a .array statement for a net array, it does not
know the data type, so initialises the array signed_flag to false.
We need to set the signed_flag to the correct value once we know
the data type, to allow the VPI routines to correctly format the
data.
This commit is contained in:
Martin Whitaker 2013-01-12 13:06:55 +00:00 committed by Cary R
parent 15fee99abb
commit 0a06cf5d28
1 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2013 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -1011,6 +1011,8 @@ void array_attach_word(vvp_array_t array, unsigned long addr, vpiHandle word)
sig->is_netarray = 1;
sig->within.parent = &array->base;
sig->id.index = vpip_make_dec_const(addr + array->first_addr.value);
// Now we know the data type, update the array signed_flag.
array->signed_flag = sig->signed_flag;
return;
}
@ -1023,6 +1025,8 @@ void array_attach_word(vvp_array_t array, unsigned long addr, vpiHandle word)
sig->is_netarray = 1;
sig->within.parent = &array->base;
sig->id.index = vpip_make_dec_const(addr + array->first_addr.value);
// Now we know the data type, update the array signed_flag.
array->signed_flag = true;
return;
}
}
@ -1080,6 +1084,9 @@ void compile_real_array(char*label, char*name, int last, int first,
void compile_net_array(char*label, char*name, int last, int first)
{
// At this point we don't know the array data type, so we
// initialise signed_flag to false. This will be corrected
// (if necessary) when we attach words to the array.
vpiHandle obj = vpip_make_array(label, name, first, last, false);
struct __vpiArray*arr = ARRAY_HANDLE(obj);