1
0

Merge pull request #1059 from freechipsproject/add-supports-atomics-property

Add atomics support to DTS JSON file.
This commit is contained in:
Richard Xia 2017-10-18 16:30:24 -07:00 committed by GitHub
commit 3b36dda9e1
4 changed files with 11 additions and 8 deletions

View File

@ -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) => 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)) } AddressRange.fromSets(key.address).map { r => (r, key.permissions, seq.map(_._1)) }
}.sortBy(_._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( println(fmt.format(
range.base, range.base,
range.base+range.size, range.base+range.size,
@ -173,8 +173,9 @@ abstract class BaseCoreplexModule[+L <: BaseCoreplex](_outer: L) extends BareCor
if (w) 'W' else ' ', if (w) 'W' else ' ',
if (x) 'X' else ' ', if (x) 'X' else ' ',
if (c) 'C' else ' ', if (c) 'C' else ' ',
if (a) 'A' else ' ',
names.mkString(", "))) 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("") println("")
ElaborationArtefacts.add("memmap.json", s"""{"mapping":[${json.mkString(",")}]}""") ElaborationArtefacts.add("memmap.json", s"""{"mapping":[${json.mkString(",")}]}""")

View File

@ -26,12 +26,12 @@ object JSON
} }
private def helper(res: ResourceValue)(implicit path: Map[String, String]): Seq[String] = res match { 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) => AddressRange.fromSets(address).map { case AddressRange(base, size) =>
s"""{"base":${base},"size":${size},"r":${r},"w":${w},"x":${x},"c":${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)) => case ResourceMapping(address, offset, ResourcePermissions(r, w, x, c, a)) =>
AddressRange.fromSets(address).map { case AddressRange(base, size) => 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 ResourceInt(value) => Seq(value.toString)
case ResourceString(value) => Seq("\"" + value + "\"") case ResourceString(value) => Seq("\"" + value + "\"")
case ResourceReference(value) => Seq("\"&" + path(value) + "\"") case ResourceReference(value) => Seq("\"&" + path(value) + "\"")

View File

@ -12,8 +12,9 @@ sealed trait ResourceValue
* @param w writable. * @param w writable.
* @param x executable. * @param x executable.
* @param c cacheable. * @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. /** An address space description.
* @param address the address space. * @param address the address space.

View File

@ -64,7 +64,8 @@ case class TLManagerParameters(
r = supportsAcquireB || supportsGet, r = supportsAcquireB || supportsGet,
w = supportsAcquireT || supportsPutFull, w = supportsAcquireT || supportsPutFull,
x = executable, x = executable,
c = regionType >= RegionType.UNCACHED)) c = regionType >= RegionType.UNCACHED,
a = supportsArithmetic && supportsLogical))
} }
} }