From 5a951799aab6f02232ccbef94065a8c277e651ae Mon Sep 17 00:00:00 2001 From: Richard Xia Date: Wed, 18 Oct 2017 15:16:01 -0700 Subject: [PATCH] Add atomics support to DTS JSON file. --- src/main/scala/coreplex/BaseCoreplex.scala | 5 +++-- src/main/scala/diplomacy/JSON.scala | 8 ++++---- src/main/scala/diplomacy/Resources.scala | 3 ++- src/main/scala/tilelink/Parameters.scala | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/scala/coreplex/BaseCoreplex.scala b/src/main/scala/coreplex/BaseCoreplex.scala index e5696988..f5e1c845 100644 --- a/src/main/scala/coreplex/BaseCoreplex.scala +++ b/src/main/scala/coreplex/BaseCoreplex.scala @@ -165,7 +165,7 @@ abstract class BaseCoreplexModule[+L <: BaseCoreplex](_outer: L) extends BareCor private val ranges = collect(Nil, outer.bindingTree).groupBy(_._2).toList.flatMap { case (key, seq) => AddressRange.fromSets(key.address).map { r => (r, key.permissions, seq.map(_._1)) } }.sortBy(_._1) - private val json = ranges.map { case (range, ResourcePermissions(r, w, x, c), names) => + private val json = ranges.map { case (range, ResourcePermissions(r, w, x, c, a), names) => println(fmt.format( range.base, range.base+range.size, @@ -173,8 +173,9 @@ abstract class BaseCoreplexModule[+L <: BaseCoreplex](_outer: L) extends BareCor if (w) 'W' else ' ', if (x) 'X' else ' ', if (c) 'C' else ' ', + if (a) 'A' else ' ', names.mkString(", "))) - s"""{"base":[${range.base}],"size":[${range.size}],"r":[$r],"w":[$w],"x":[$x],"c":[$c],"names":[${names.map('"'+_+'"').mkString(",")}]}""" + s"""{"base":[${range.base}],"size":[${range.size}],"r":[$r],"w":[$w],"x":[$x],"c":[$c],"a":[$a],"names":[${names.map('"'+_+'"').mkString(",")}]}""" } println("") ElaborationArtefacts.add("memmap.json", s"""{"mapping":[${json.mkString(",")}]}""") diff --git a/src/main/scala/diplomacy/JSON.scala b/src/main/scala/diplomacy/JSON.scala index c8d2c42b..7effecce 100644 --- a/src/main/scala/diplomacy/JSON.scala +++ b/src/main/scala/diplomacy/JSON.scala @@ -26,12 +26,12 @@ object JSON } private def helper(res: ResourceValue)(implicit path: Map[String, String]): Seq[String] = res match { - case ResourceAddress(address, ResourcePermissions(r, w, x, c)) => + case ResourceAddress(address, ResourcePermissions(r, w, x, c, a)) => AddressRange.fromSets(address).map { case AddressRange(base, size) => - s"""{"base":${base},"size":${size},"r":${r},"w":${w},"x":${x},"c":${c}}"""} - case ResourceMapping(address, offset, ResourcePermissions(r, w, x, c)) => + s"""{"base":${base},"size":${size},"r":${r},"w":${w},"x":${x},"c":${c},"a":${a}}"""} + case ResourceMapping(address, offset, ResourcePermissions(r, w, x, c, a)) => AddressRange.fromSets(address).map { case AddressRange(base, size) => - s"""{"base":${base},"size":${size},"offset":${offset},"r":${r},"w":${w},"x":${x},"c":${c}}"""} + s"""{"base":${base},"size":${size},"offset":${offset},"r":${r},"w":${w},"x":${x},"c":${c},"a":${a}}"""} case ResourceInt(value) => Seq(value.toString) case ResourceString(value) => Seq("\"" + value + "\"") case ResourceReference(value) => Seq("\"&" + path(value) + "\"") diff --git a/src/main/scala/diplomacy/Resources.scala b/src/main/scala/diplomacy/Resources.scala index 4a76f87b..268ef676 100644 --- a/src/main/scala/diplomacy/Resources.scala +++ b/src/main/scala/diplomacy/Resources.scala @@ -12,8 +12,9 @@ sealed trait ResourceValue * @param w writable. * @param x executable. * @param c cacheable. + * @param a supports all atomic operations. */ -case class ResourcePermissions(r: Boolean, w: Boolean, x: Boolean, c: Boolean) // Not part of DTS +case class ResourcePermissions(r: Boolean, w: Boolean, x: Boolean, c: Boolean, a: Boolean) // Not part of DTS /** An address space description. * @param address the address space. diff --git a/src/main/scala/tilelink/Parameters.scala b/src/main/scala/tilelink/Parameters.scala index 671d93b5..ace1a459 100644 --- a/src/main/scala/tilelink/Parameters.scala +++ b/src/main/scala/tilelink/Parameters.scala @@ -64,7 +64,8 @@ case class TLManagerParameters( r = supportsAcquireB || supportsGet, w = supportsAcquireT || supportsPutFull, x = executable, - c = regionType >= RegionType.UNCACHED)) + c = regionType >= RegionType.UNCACHED, + a = supportsArithmetic && supportsLogical)) } }