RegFieldDesc: Emit enumerations if they exist
This commit is contained in:
parent
86c10b3cef
commit
d13dc8ac2a
@ -26,7 +26,7 @@ case class RegFieldDesc (
|
|||||||
groupDesc: Option[String] = None,
|
groupDesc: Option[String] = None,
|
||||||
access: RegFieldAccessType = RegFieldAccessType.RW,
|
access: RegFieldAccessType = RegFieldAccessType.RW,
|
||||||
reset: Option[BigInt] = None,
|
reset: Option[BigInt] = None,
|
||||||
enumerations: Map[String, BigInt] = Map()
|
enumerations: Map[BigInt, (String, String)] = Map()
|
||||||
){
|
){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,11 +93,17 @@ case class TLRegisterNode(
|
|||||||
("bitOffset" -> currentBitOffset) ~
|
("bitOffset" -> currentBitOffset) ~
|
||||||
("bitWidth" -> f.width) ~
|
("bitWidth" -> f.width) ~
|
||||||
("name" -> f.desc.map(_.name)) ~
|
("name" -> f.desc.map(_.name)) ~
|
||||||
("description" -> f.desc.map{ d=> if (d.desc == "") None else Some(d.desc)}) ~
|
("description" -> f.desc.map{d => if (d.desc == "") None else Some(d.desc)}) ~
|
||||||
("resetValue" -> f.desc.map{_.reset}) ~
|
("resetValue" -> f.desc.map{_.reset}) ~
|
||||||
("group" -> f.desc.map{_.group}) ~
|
("group" -> f.desc.map{_.group}) ~
|
||||||
("groupDesc" -> f.desc.map{_.groupDesc}) ~
|
("groupDesc" -> f.desc.map{_.groupDesc}) ~
|
||||||
("accessType" -> f.desc.map {d => d.access.toString})
|
("accessType" -> f.desc.map {d => d.access.toString}) ~
|
||||||
|
("enumerations" -> f.desc.map {d =>
|
||||||
|
Option(d.enumerations.map { case (key, (name, desc)) =>
|
||||||
|
(("value" -> key) ~
|
||||||
|
("name" -> name) ~
|
||||||
|
("description" -> desc))
|
||||||
|
}).filter(_.nonEmpty)})
|
||||||
))
|
))
|
||||||
currentBitOffset = currentBitOffset + f.width
|
currentBitOffset = currentBitOffset + f.width
|
||||||
tmp
|
tmp
|
||||||
|
Loading…
Reference in New Issue
Block a user