Skip to content

Commit

Permalink
Merge branch 'main' into btor2integration
Browse files Browse the repository at this point in the history
  • Loading branch information
dobios authored May 7, 2024
2 parents c31176f + 6cd4ce7 commit 728862c
Show file tree
Hide file tree
Showing 10 changed files with 284 additions and 363 deletions.
1 change: 1 addition & 0 deletions circtpanamabinding/includeFunctions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mlirGetDialectHandle__firrtl__
mlirGetDialectHandle__chirrtl__
mlirGetDialectHandle__sv__
mlirGetDialectHandle__seq__
mlirGetDialectHandle__emit__
mlirDialectHandleLoadDialect
#mlirStringRefCreate inline function cannot be generated
mlirStringRefCreateFromCString
Expand Down
1 change: 1 addition & 0 deletions circtpanamabinding/jextract-headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <circt-c/Dialect/HW.h>
#include <circt-c/Dialect/SV.h>
#include <circt-c/Dialect/Seq.h>
#include <circt-c/Dialect/Emit.h>
#include <circt-c/Dialect/OM.h>
#include <circt-c/Firtool/Firtool.h>
#include <circt-c/ExportFIRRTL.h>
Expand Down
1 change: 1 addition & 0 deletions circtpanamabinding/linkLibraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CIRCTCAPICHIRRTL
CIRCTCAPIHW
CIRCTCAPISV
CIRCTCAPISeq
CIRCTCAPIEmit
CIRCTCAPIOM
CIRCTCAPIFirtool
CIRCTCAPIExportFIRRTL
Expand Down
2 changes: 1 addition & 1 deletion lit/tests/Property/DocExample.sc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ args.head match {
val om = converter.om()
val evaluator = om.evaluator()

val top = evaluator.instantiate("Top_Class", Seq(om.newBasePathEmpty))
val top = evaluator.instantiate("Top_Class", Seq(om.newBasePathEmpty)).get

// CHECK: .descriptions => { [ obj{.description => { mlirString{"Machine cycle counter."} }, .identifier => { mlirString{"mcycle"} }, .width => { omInteger{64} }}, obj{.description => { mlirString{"Machine instructions-retired counter."} }, .identifier => { mlirString{"minstret"} }, .width => { omInteger{64} }} ] }
top.foreachField((name, value) => println(s".$name => { ${value.toString} }"))
Expand Down
2 changes: 1 addition & 1 deletion lit/tests/Property/Good.sc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ args.head match {

val om = converter.om()
val evaluator = om.evaluator()
val obj = evaluator.instantiate("PropertyTest_Class", Seq(om.newBasePathEmpty))
val obj = evaluator.instantiate("PropertyTest_Class", Seq(om.newBasePathEmpty)).get

// CHECK-LABEL: OMReferenceTarget:~PropertyTest|PropertyTest>i
println(obj.field("p").asInstanceOf[PanamaCIRCTOMEvaluatorValuePath].toString)
Expand Down
3 changes: 2 additions & 1 deletion panamalib/src/PanamaCIRCT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class PanamaCIRCT {
CAPI.mlirGetDialectHandle__firrtl__(arena),
CAPI.mlirGetDialectHandle__chirrtl__(arena),
CAPI.mlirGetDialectHandle__sv__(arena),
CAPI.mlirGetDialectHandle__seq__(arena)
CAPI.mlirGetDialectHandle__seq__(arena),
CAPI.mlirGetDialectHandle__emit__(arena)
).foreach(CAPI.mlirDialectHandleLoadDialect(arena, _, mlirCtx))

mlirCtx
Expand Down
9 changes: 6 additions & 3 deletions panamaom/src/PanamaCIRCTOM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ class PanamaCIRCTOMEvaluator private[chisel3] (circt: PanamaCIRCT, mlirModule: M
def instantiate(
className: String,
actualParams: Seq[PanamaCIRCTOMEvaluatorValue]
): PanamaCIRCTOMEvaluatorValueObject = {
): Option[PanamaCIRCTOMEvaluatorValueObject] = {
val params = actualParams.map(_.asInstanceOf[PanamaCIRCTOMEvaluatorValue].value)

val value = circt.omEvaluatorInstantiate(evaluator, className, params)
assert(!circt.omEvaluatorObjectIsNull(value))
new PanamaCIRCTOMEvaluatorValueObject(circt, value)
if (!circt.omEvaluatorObjectIsNull(value)) {
Some(new PanamaCIRCTOMEvaluatorValueObject(circt, value))
} else {
None
}
}
}

Expand Down
Loading

0 comments on commit 728862c

Please sign in to comment.