From d1c9dd554bfd09813a27fec3ab3b3f9fe40f376a Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 5 Jan 2014 20:53:58 +0000 Subject: [PATCH] Fix for github issue #6. When creating a constant zero for implementing a unary minus operation using a binary subtraction operator, the constant needs to be to exactly the expression width. --- netmisc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netmisc.cc b/netmisc.cc index 351e32f24..4c2f58fa2 100644 --- a/netmisc.cc +++ b/netmisc.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2014 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 @@ -48,7 +48,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 = cast_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);