From 0a06cf5d2808ebddbfb4cd95a669a47d6ef423ba Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 12 Jan 2013 13:06:55 +0000 Subject: [PATCH] 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. --- vvp/array.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vvp/array.cc b/vvp/array.cc index ee7a382bb..e77da31c0 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -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);