Skip to content

Commit

Permalink
Merge pull request #28 from zlh20040308/fix-rvdecoderdb
Browse files Browse the repository at this point in the history
fix fields with format attr1=attr2 not recognized
  • Loading branch information
sequencer authored Oct 10, 2024
2 parents f4e7844 + deb409d commit 0879de4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rvdecoderdb/src/parser/SameValue.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.chipsalliance.rvdecoderdb.parser
import org.chipsalliance.rvdecoderdb.parser.ArgLUT

object SameValue {
def unapply(str: String): Option[ArgLUT] = str match {
case s"${attr1}=${attr2}" => ArgLUT.all.get(attr1)
case _ => None
}
}

class SameValue(val attr1: String, val attr2: String) extends Token {
override def toString: String = s"$attr1=$attr2"
}
2 changes: 2 additions & 0 deletions rvdecoderdb/src/parser/parse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ object parse {
custom,
content
.split("\n")
.map(_.trim)
.filter(!_.startsWith("#"))
.filter(_.nonEmpty)
.map(
Expand All @@ -27,6 +28,7 @@ object parse {
case "$import" => Import
case "$pseudo_op" => PseudoOp
case RefInst(i) => i
case SameValue(s) => s
case FixedRangeValue(f) => f
case BitValue(b) => b
case ArgLUT(a) => a
Expand Down

0 comments on commit 0879de4

Please sign in to comment.