From 1f9703f1bc89048fbe61a2386e064e34bcaedd24 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 10 Jan 2015 18:03:31 +0000 Subject: [PATCH] Fix for br968. vthr_vec_get_value() assumed the source vector was unsigned. --- vvp/vpi_vthr_vector.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index 71db5692c..f31ab5361 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2015 Stephen Williams (steve@icarus.com) * Copyright (c) 2001 Stephan Boettcher * * This source code is free software; you can redistribute it @@ -297,6 +297,9 @@ static void vthr_vec_get_value(vpiHandle ref, s_vpi_value*vp) break; } } + long sign_bit = (1 << wid) >> 1; + if (rfp->signed_flag && (ival & sign_bit)) + ival |= (~0) << wid; vp->value.integer = ival; } break;