Fix for br968.

vthr_vec_get_value() assumed the source vector was unsigned.
This commit is contained in:
Martin Whitaker 2015-01-10 18:03:31 +00:00
parent c8184c31ef
commit 1f9703f1bc
1 changed files with 4 additions and 1 deletions

View File

@ -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 <stephan@nevis.columbia.edu>
*
* 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;