|
3 | 3 | package chisel3.util.experimental.decode
|
4 | 4 |
|
5 | 5 | import chisel3.util.BitPat
|
| 6 | +import scala.util.hashing.MurmurHash3 |
6 | 7 | import scala.collection.mutable
|
7 | 8 |
|
8 |
| -sealed class TruthTable private (val table: Seq[(BitPat, BitPat)], val default: BitPat, val sort: Boolean) { |
| 9 | +sealed class TruthTable private (val table: Seq[(BitPat, BitPat)], val default: BitPat, _sort: Boolean) { |
9 | 10 | def inputWidth = table.head._1.getWidth
|
10 | 11 |
|
11 | 12 | def outputWidth = table.head._2.getWidth
|
12 | 13 |
|
| 14 | + @deprecated("This field is unused and will be removed.", "Chisel 3.5") |
| 15 | + def sort: Boolean = _sort |
| 16 | + |
13 | 17 | override def toString: String = {
|
14 | 18 | def writeRow(map: (BitPat, BitPat)): String =
|
15 | 19 | s"${map._1.rawString}->${map._2.rawString}"
|
16 | 20 |
|
17 | 21 | (table.map(writeRow) ++ Seq(s"${" " * (inputWidth + 2)}${default.rawString}")).mkString("\n")
|
18 | 22 | }
|
19 | 23 |
|
20 |
| - def copy(table: Seq[(BitPat, BitPat)] = this.table, default: BitPat = this.default, sort: Boolean = this.sort) = |
21 |
| - TruthTable(table, default, sort) |
| 24 | + def copy(table: Seq[(BitPat, BitPat)] = this.table, default: BitPat = this.default, sort: Boolean = _sort) = |
| 25 | + TruthTable(table, default) |
22 | 26 |
|
23 | 27 | override def equals(y: Any): Boolean = {
|
24 | 28 | y match {
|
25 |
| - case y: TruthTable => toString == y.toString |
| 29 | + case that: TruthTable => this.table == that.table && this.default == that.default |
26 | 30 | case _ => false
|
27 | 31 | }
|
28 | 32 | }
|
| 33 | + |
| 34 | + override lazy val hashCode: Int = MurmurHash3.productHash((table, default)) |
29 | 35 | }
|
30 | 36 |
|
31 | 37 | object TruthTable {
|
|
0 commit comments