From 1839a3a770a71c928b92bf876e04728d2649e425 Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 1 Aug 2019 14:28:21 +0100 Subject: Major Property improvements for common and iCE40 Signed-off-by: David Shah --- json/jsonwrite.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'json/jsonwrite.cc') diff --git a/json/jsonwrite.cc b/json/jsonwrite.cc index 0b7a5b25..30bee107 100644 --- a/json/jsonwrite.cc +++ b/json/jsonwrite.cc @@ -45,6 +45,15 @@ std::string get_string(std::string str) std::string get_name(IdString name, Context *ctx) { return get_string(name.c_str(ctx)); } +void write_parameter_value(std::ostream &f, const Property &value) +{ + if (value.size() == 32 && value.is_fully_def()) { + f << stringf("%d", value.as_int64()); + } else { + f << get_string(value.as_string()); + } +} + void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map ¶meters, bool for_module = false) { @@ -52,10 +61,7 @@ void write_parameters(std::ostream &f, Context *ctx, const std::unordered_mapattrs.find(ctx->id("module")); if (val != ctx->attrs.end()) - f << stringf(" %s: {\n", get_string(val->second.str).c_str()); + f << stringf(" %s: {\n", get_string(val->second.as_string()).c_str()); else f << stringf(" %s: {\n", get_string("top").c_str()); f << stringf(" \"settings\": {"); -- cgit v1.2.3