From 3f49dfcd9787fb184ee0b5562e15cf0fbc65a33e Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 2 Apr 2020 12:40:59 +0100 Subject: [PATCH] Fix translation of module path connection type in vlog95 target. The target API needed to be changed to pass the connection type through to the target code generator. --- design_dump.cc | 6 +++++- elaborate.cc | 2 +- ivl_target.h | 8 +++++++- netlist.cc | 10 ++++++++-- netlist.h | 7 +++++-- t-dll-api.cc | 8 +++++++- t-dll.cc | 3 ++- t-dll.h | 3 ++- tgt-vlog95/scope.c | 8 ++++++-- 9 files changed, 43 insertions(+), 12 deletions(-) diff --git a/design_dump.cc b/design_dump.cc index 3491f274a..82551cdc6 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2019 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2020 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 @@ -350,6 +350,10 @@ void NetDelaySrc::dump(ostream&o, unsigned ind) const if (has_condit()) o << " if"; else o << " ifnone"; } + if (parallel_) + o << " parallel"; + else + o << " full"; o << " src " << "(" << transition_delays_[IVL_PE_01] << "," << transition_delays_[IVL_PE_10] diff --git a/elaborate.cc b/elaborate.cc index e149693cf..d54a1a80d 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -5628,7 +5628,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const NetDelaySrc*path = new NetDelaySrc(scope, scope->local_symbol(), src.size(), condit_sig, - conditional); + conditional, !full_flag_); path->set_line(*this); // The presence of the data_source_expression indicates diff --git a/ivl_target.h b/ivl_target.h index f0ee992e9..e122364e0 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -1,7 +1,7 @@ #ifndef IVL_ivl_target_H #define IVL_ivl_target_H /* - * Copyright (c) 2000-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2020 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 @@ -524,6 +524,10 @@ extern ivl_island_t ivl_branch_island(ivl_branch_t obj); * ivl_path_is_condit * Is this a conditional structure? Needed for ifnone. * + * ivl_path_is_parallel + * This returns true if the path is a parallel connection and + * false if the path is a full connection. + * * ivl_path_source_posedge * ivl_path_source_negedge * These functions return true if the source is edge sensitive. @@ -534,6 +538,8 @@ extern uint64_t ivl_path_delay(ivl_delaypath_t obj, ivl_path_edge_t pt); extern ivl_nexus_t ivl_path_condit(ivl_delaypath_t obj); extern int ivl_path_is_condit(ivl_delaypath_t obj); +extern int ivl_path_is_parallel(ivl_delaypath_t obj); + extern int ivl_path_source_posedge(ivl_delaypath_t obj); extern int ivl_path_source_negedge(ivl_delaypath_t obj); diff --git a/netlist.cc b/netlist.cc index 328e1a42b..13ed0cc57 100644 --- a/netlist.cc +++ b/netlist.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2020 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 @@ -309,11 +309,12 @@ unsigned NetBus::find_link(const Link&that) const } NetDelaySrc::NetDelaySrc(NetScope*s, perm_string n, unsigned npins, - bool condit_src, bool conditional) + bool condit_src, bool conditional, bool parallel) : NetObj(s, n, npins + (condit_src?1:0)) { condit_flag_ = false; conditional_ = conditional; + parallel_ = parallel; posedge_ = false; negedge_ = false; for (unsigned idx = 0 ; idx < npins ; idx += 1) { @@ -472,6 +473,11 @@ const Link& NetDelaySrc::condit_pin() const return pin(pin_count()-1); } +bool NetDelaySrc::is_parallel() const +{ + return parallel_; +} + PortType::Enum PortType::merged( Enum lhs, Enum rhs ) { if( lhs == NOT_A_PORT || rhs == NOT_A_PORT ) diff --git a/netlist.h b/netlist.h index 441aaeb9f..1ec6abe8f 100644 --- a/netlist.h +++ b/netlist.h @@ -1,7 +1,7 @@ #ifndef IVL_netlist_H #define IVL_netlist_H /* - * Copyright (c) 1998-2019 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2020 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -554,7 +554,7 @@ class NetDelaySrc : public NetObj { public: explicit NetDelaySrc(NetScope*s, perm_string n, unsigned nsrc, - bool condit_src, bool conditional); + bool condit_src, bool conditional, bool parallel); ~NetDelaySrc(); // These functions set the delays from the values in the @@ -590,12 +590,15 @@ class NetDelaySrc : public NetObj { Link&condit_pin(); const Link&condit_pin() const; + bool is_parallel() const; + void dump(ostream&, unsigned ind) const; private: uint64_t transition_delays_[12]; bool condit_flag_; bool conditional_; + bool parallel_; bool posedge_; bool negedge_; diff --git a/t-dll-api.cc b/t-dll-api.cc index 9c69214da..c0a8a9006 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2020 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch) * @@ -1929,6 +1929,12 @@ extern "C" int ivl_path_is_condit(ivl_delaypath_t obj) return obj->conditional ? 1 : 0; } +extern "C" int ivl_path_is_parallel(ivl_delaypath_t obj) +{ + assert(obj); + return obj->parallel ? 1 : 0; +} + extern uint64_t ivl_path_delay(ivl_delaypath_t obj, ivl_path_edge_t edg) { assert(obj); diff --git a/t-dll.cc b/t-dll.cc index 1b937b2b7..cf80f2128 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2020 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -2793,6 +2793,7 @@ bool dll_target::signal_paths(const NetNet*net) obj->path[ptr].src = nex->t_cookie(); obj->path[ptr].condit = path_condit; obj->path[ptr].conditional = src->is_condit(); + obj->path[ptr].parallel = src->is_parallel(); obj->path[ptr].posedge = src->is_posedge(); obj->path[ptr].negedge = src->is_negedge(); for (unsigned pe = 0 ; pe < 12 ; pe += 1) { diff --git a/t-dll.h b/t-dll.h index 98d041e00..aa675bc66 100644 --- a/t-dll.h +++ b/t-dll.h @@ -1,7 +1,7 @@ #ifndef IVL_t_dll_H #define IVL_t_dll_H /* - * Copyright (c) 2000-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2020 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 @@ -206,6 +206,7 @@ struct ivl_delaypath_s { ivl_nexus_t src; ivl_nexus_t condit; bool conditional; + bool parallel; bool posedge; bool negedge; uint64_t delay[12]; diff --git a/tgt-vlog95/scope.c b/tgt-vlog95/scope.c index c005d770a..81492652c 100644 --- a/tgt-vlog95/scope.c +++ b/tgt-vlog95/scope.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2019 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2010-2020 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -798,7 +798,11 @@ static void emit_specify_paths(ivl_scope_t scope, ivl_signal_t sig) has_edge = 1; } emit_nexus_as_ca(scope, source, 0, 0); - fprintf(vlog_out, " =>"); + if (ivl_path_is_parallel(dpath)) { + fprintf(vlog_out, " =>"); + } else { + fprintf(vlog_out, " *>"); + } /* The compiler does not keep the source expression for an edge * sensitive path so add a constant to get the syntax right. */ if (has_edge) {