From 06f6a7277096699419d4f9b31b3bbdc8c66e2e97 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 10 May 2016 21:59:21 +0100 Subject: [PATCH] Fix for GitHub issue #103 - vvp assertion failure on part select propagation. The implementation of vvp_fun_part_pv::recv_vec4_pv was incorrect, and propagated the incoming widths rather than the stored widths. (cherry picked from commit 0c66116f51ac6c6cf7aa42b37ac13f6116cee085) --- vvp/part.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vvp/part.cc b/vvp/part.cc index d96f04405..a999f5a97 100644 --- a/vvp/part.cc +++ b/vvp/part.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2004-2016 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 @@ -213,8 +213,14 @@ void vvp_fun_part_pv::recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&bit, vvp_context_t ctx) { assert(port.port() == 0); + assert(bit.size() == wid); + assert(base + wid <= vwid); + assert(vwid == wid_); - port.ptr()->send_vec4_pv(bit, base, wid, vwid, ctx); + vvp_vector4_t tmp(wid_, BIT4_Z); + tmp.set_vec(base, bit); + + port.ptr()->send_vec4_pv(tmp, base_, wid_, vwid_, ctx); } void vvp_fun_part_pv::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit)