For a LPM constant pass the sign information and one other fix

For a LPM constant we need to pass the sign information so that the vlog95
code generator can create the correct constant. Also when using the
sub_net_from() routine the numeric constant should have the same sign as
the signal so that it can also be displayed correctly.
This commit is contained in:
Cary R 2013-02-15 11:49:10 -08:00
parent 890589191c
commit 8808cd9514
2 changed files with 3 additions and 2 deletions

View File

@ -49,6 +49,7 @@ NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig)
} else {
verinum zero ((int64_t)val);
zero = pad_to_width(zero, sig->vector_width());
zero.has_sign(sig->get_signed());
NetConst*zero_obj = new NetConst(scope, scope->local_symbol(), zero);
zero_obj->set_line(*sig);
des->add_node(zero_obj);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-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
@ -2166,7 +2166,7 @@ bool dll_target::net_const(const NetConst*net)
assert(net->pin_count() == 1);
obj->width_ = net->width();
obj->signed_ = 0;
obj->signed_ = net->value().has_sign();
if (obj->width_ <= sizeof(obj->b.bit_)) {
bits = obj->b.bit_;