> configure(npc)
ysyx_22040000 李心杨 Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux 13:51:33 up 1 day 22:38, 2 users, load average: 3.60, 1.55, 1.34
This commit is contained in:
parent
d4ab3e5752
commit
b4bef0fb64
12 changed files with 448 additions and 16 deletions
|
@ -1,3 +1,5 @@
|
|||
package npc
|
||||
|
||||
import chisel3._
|
||||
import chiseltest._
|
||||
import org.scalatest.freespec.AnyFreeSpec
|
||||
|
@ -47,21 +49,31 @@ class ALUGeneratorSpec extends AnyFreeSpec with ChiselScalatestTester {
|
|||
c.io.out.expect(8.U)
|
||||
}
|
||||
}
|
||||
"sub should work" in {
|
||||
test(new ALUGenerator(32)) { c =>
|
||||
c.io.op.poke(1.U)
|
||||
c.io.a.poke(5.U)
|
||||
c.io.b.poke(3.U)
|
||||
c.io.out.expect(2.U)
|
||||
"sub should work" - {
|
||||
"with positive result" in {
|
||||
test(new ALUGenerator(32)) { c =>
|
||||
c.io.op.poke(1.U)
|
||||
c.io.a.poke(5.U)
|
||||
c.io.b.poke(3.U)
|
||||
c.io.out.expect(2)
|
||||
}
|
||||
}
|
||||
"with negative result" in {
|
||||
test(new ALUGenerator(32)) { c =>
|
||||
c.io.op.poke(1.U)
|
||||
c.io.a.poke(3.U)
|
||||
c.io.b.poke(5.U)
|
||||
c.io.out.expect(BigInt("FFFFFFFF", 16) - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
"not should work" in {
|
||||
test(new ALUGenerator(32)) { c =>
|
||||
c.io.op.poke(2.U)
|
||||
c.io.a.poke(5.U)
|
||||
c.io.b.poke(3.U)
|
||||
c.io.out.expect((-6).U)
|
||||
}
|
||||
// test(new ALUGenerator(32)) { c =>
|
||||
// c.io.op.poke(2.U)
|
||||
// c.io.a.poke(5.U)
|
||||
// c.io.b.poke(3.U)
|
||||
// c.io.out.expect(((1 << 32) - 1 - 5).U)
|
||||
// }
|
||||
}
|
||||
"and should work" in {
|
||||
test(new ALUGenerator(32)) { c =>
|
||||
|
@ -101,7 +113,7 @@ class ALUGeneratorSpec extends AnyFreeSpec with ChiselScalatestTester {
|
|||
|
||||
c.io.a.poke(16.U)
|
||||
c.io.b.poke(16.U)
|
||||
c.io.out.expect(1.U)
|
||||
c.io.out.expect(0.U)
|
||||
}
|
||||
}
|
||||
"equal should work" in {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue