From 3d5765949eb59cac19b118170e3a02d98eaf6ec3 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 5 Jun 2013 21:10:33 -0700 Subject: [PATCH] Some shorthand type marks in write_to_stream. --- vhdlpp/vtype_stream.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vhdlpp/vtype_stream.cc b/vhdlpp/vtype_stream.cc index 661626e6a..ed21e5a99 100644 --- a/vhdlpp/vtype_stream.cc +++ b/vhdlpp/vtype_stream.cc @@ -17,9 +17,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +# define __STDC_LIMIT_MACROS # include "vtype.h" # include "expression.h" # include +# include # include using namespace std; @@ -115,6 +117,15 @@ void VTypePrimitive::write_to_stream(ostream&fd) const void VTypeRange::write_to_stream(ostream&fd) const { + // Detect some special cases that can be written as ieee or + // standard types. + if (const VTypePrimitive*tmp = dynamic_cast (base_)) { + if (min_==0 && max_==INT64_MAX && tmp->type()==VTypePrimitive::INTEGER) { + fd << "natural"; + return; + } + } + base_->write_to_stream(fd); fd << " range " << min_ << " to " << max_; }