summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/pla.scala
diff options
context:
space:
mode:
authorJack2022-01-12 04:27:19 +0000
committerJack2022-01-12 04:27:19 +0000
commit29df513e348cc809876893f650af8180f0190496 (patch)
tree06daaea954b4e5af7113f06e4bdbb78b33515cb3 /src/main/scala/chisel3/util/pla.scala
parent5242ce90659decb9058ee75db56e5c188029fbf9 (diff)
parent747d16311bdf185d2e98e452b14cb5d8ccca004c (diff)
Merge branch 'master' into 3.5-release
Diffstat (limited to 'src/main/scala/chisel3/util/pla.scala')
-rw-r--r--src/main/scala/chisel3/util/pla.scala35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/main/scala/chisel3/util/pla.scala b/src/main/scala/chisel3/util/pla.scala
index c57ca962..d4707d26 100644
--- a/src/main/scala/chisel3/util/pla.scala
+++ b/src/main/scala/chisel3/util/pla.scala
@@ -68,7 +68,8 @@ object pla {
val inverterMask = invert.value & invert.mask
if (inverterMask.bitCount != 0)
- require(invert.getWidth == numberOfOutputs,
+ require(
+ invert.getWidth == numberOfOutputs,
"non-zero inverter mask must have the same width as the output part of specified PLA table"
)
@@ -99,28 +100,28 @@ object pla {
// the OR matrix
val orMatrixOutputs: UInt = Cat(
- Seq
- .tabulate(numberOfOutputs) { i =>
- val andMatrixLines = table
- // OR matrix composed by input terms which makes this output bit a `1`
- .filter {
- case (_, or) => or.mask.testBit(i) && or.value.testBit(i)
- }.map {
- case (inputTerm, _) =>
- andMatrixOutputs(inputTerm.toString)
- }
- if (andMatrixLines.isEmpty) false.B
- else Cat(andMatrixLines).orR()
- }
- .reverse
- )
+ Seq
+ .tabulate(numberOfOutputs) { i =>
+ val andMatrixLines = table
+ // OR matrix composed by input terms which makes this output bit a `1`
+ .filter {
+ case (_, or) => or.mask.testBit(i) && or.value.testBit(i)
+ }.map {
+ case (inputTerm, _) =>
+ andMatrixOutputs(inputTerm.toString)
+ }
+ if (andMatrixLines.isEmpty) false.B
+ else Cat(andMatrixLines).orR()
+ }
+ .reverse
+ )
// the INV matrix, useful for decoders
val invMatrixOutputs: UInt = Cat(
Seq
.tabulate(numberOfOutputs) { i =>
if (inverterMask.testBit(i)) ~orMatrixOutputs(i)
- else orMatrixOutputs(i)
+ else orMatrixOutputs(i)
}
.reverse
)