Bug in VHDL portmap. Too strict checking in Kite & Etesian ::setViewer().

* Bug: In CRL Core, in VectorPortMap::VhdlPortMap(), if the connection
    was made to *non-contiguous* bits of an otherwise *contiguous* vector,
    it was using a span instead of the separate bits. Now check that
    bits are contiguous (delta: +1/-1) and the delta do not change of
    sign.
* Change: In Etesian & Kite, the Python interface function ::setViewer()
    was checking that the argument was indeed a CellViewer, but in text
    mode it is None. Now, silently ignore the argument if it cannot be
    converted into CellViewer.
This commit is contained in:
Jean-Paul Chaput 2015-06-08 12:01:32 +02:00
parent 51043df640
commit 701487247d
3 changed files with 31 additions and 17 deletions

View File

@ -155,12 +155,14 @@ namespace Vhdl {
{ {
if (getSignal()->isContiguous()) { if (getSignal()->isContiguous()) {
vector<string> mappedNames; vector<string> mappedNames;
int begin = -1; int begin = -1;
int end = -1; int end = -1;
const Bit* bit = NULL; int delta = 0;
const Bit* bitp = NULL; int deltap = 0;
string name = "UNCONNECTED"; const Bit* bit = NULL;
string namep = "UNCONNECTED"; const Bit* bitp = NULL;
string name = "UNCONNECTED";
string namep = "UNCONNECTED";
auto imapping = _mapping.rbegin(); auto imapping = _mapping.rbegin();
auto imappingp = _mapping.rbegin(); auto imappingp = _mapping.rbegin();
@ -176,15 +178,19 @@ namespace Vhdl {
and bitp->getSignal()->isVector() and bitp->getSignal()->isVector()
and bitp->getSignal()->isContiguous() and bitp->getSignal()->isContiguous()
and (name == namep)) { and (name == namep)) {
if (begin < 0) begin = bitp->getIndex(); delta = (int)bit->getIndex() - (int)bitp->getIndex();
if (end < 0) end = bit ->getIndex();
int delta = (int)bit->getIndex() - (int)bitp->getIndex(); if (begin < 0) begin = bitp->getIndex();
if ( not ((delta > 0) xor (begin < end)) ) { if (end < 0) end = bitp->getIndex();
if (deltap == 0) deltap = delta;
if ( (delta == deltap) and ((delta == -1) or (delta == +1)) ) {
end = bit->getIndex(); end = bit->getIndex();
deltap = delta;
continue; continue;
} }
} }
delta = 0;
if (begin != end) { if (begin != end) {
string vdir = (begin < end) ? "to" : "downto"; string vdir = (begin < end) ? "to" : "downto";

View File

@ -49,6 +49,7 @@ namespace Etesian {
using Isobar::PyCell; using Isobar::PyCell;
using Isobar::PyCell_Link; using Isobar::PyCell_Link;
using Isobar::PyCellViewer; using Isobar::PyCellViewer;
using Isobar::PyTypeCellViewer;
using CRL::PyToolEngine; using CRL::PyToolEngine;
@ -112,11 +113,14 @@ extern "C" {
HTRY HTRY
METHOD_HEAD( "EtesianEngine.setViewer()" ) METHOD_HEAD( "EtesianEngine.setViewer()" )
PyCellViewer* pyViewer; PyObject* pyViewer = NULL;
if (not ParseOneArg("EtesianEngine.setViewer()",args,":cellView",(PyObject**)&pyViewer)) { if (not PyArg_ParseTuple(args,"O:EtesianEngine.setViewer()",&pyViewer)) {
PyErr_SetString( ConstructorError, "Bad parameters given to EtesianEngine.setViewer()." );
return NULL; return NULL;
} }
etesian->setViewer( PYCELLVIEWER_O(pyViewer) ); if (IsPyCellViewer(pyViewer)) {
etesian->setViewer( PYCELLVIEWER_O(pyViewer) );
}
HCATCH HCATCH
Py_RETURN_NONE; Py_RETURN_NONE;

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2010-2015, All Rights Reserved // Copyright (c) UPMC 2010-2015, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | C O R I O L I S | // | C O R I O L I S |
@ -49,6 +49,7 @@ namespace Kite {
using Isobar::PyCell; using Isobar::PyCell;
using Isobar::PyCell_Link; using Isobar::PyCell_Link;
using Isobar::PyCellViewer; using Isobar::PyCellViewer;
using Isobar::PyTypeCellViewer;
using CRL::PyToolEngine; using CRL::PyToolEngine;
@ -131,11 +132,14 @@ extern "C" {
HTRY HTRY
METHOD_HEAD( "KiteEngine.setViewer()" ) METHOD_HEAD( "KiteEngine.setViewer()" )
PyCellViewer* pyViewer; PyObject* pyViewer = NULL;
if (not ParseOneArg("KiteEngine.setViewer()",args,":cellView",(PyObject**)&pyViewer)) { if (not PyArg_ParseTuple(args,"O:EtesianEngine.setViewer()",&pyViewer)) {
PyErr_SetString( ConstructorError, "Bad parameters given to EtesianEngine.setViewer()." );
return NULL; return NULL;
} }
kite->setViewer( PYCELLVIEWER_O(pyViewer) ); if (IsPyCellViewer(pyViewer)) {
kite->setViewer( PYCELLVIEWER_O(pyViewer) );
}
HCATCH HCATCH
Py_RETURN_NONE; Py_RETURN_NONE;