Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug in handling and() PrimOp with sign extension #145

Open
chick opened this issue Jan 14, 2019 · 0 comments
Open

Bug in handling and() PrimOp with sign extension #145

chick opened this issue Jan 14, 2019 · 0 comments
Assignees
Labels

Comments

@chick
Copy link
Contributor

chick commented Jan 14, 2019

From stackoverflow question it seems like sign extension not working consistently between interpreter vs verilator or treadle.

Code

import chisel3.iotesters.{ChiselFlatSpec, Driver, PeekPokeTester}
import chisel3._

class TestTesterUnit(c: Test) extends PeekPokeTester(c) {
  val value = 31
  poke(c.io.a, value)
  poke(c.io.b, 1)
  step(1)
  expect(c.io.out, value)
}

class TestTester extends ChiselFlatSpec {
  for (backendName <- backends) {
    "Test" should s"should sign-extended AND operation (with $backendName)" in {
      Driver(() => new Test, backendName) {
        c => new TestTesterUnit(c)
      } should be (true)
    }
  }
}

class Test extends Module {
  val io = IO(new Bundle {
    val a = Input(SInt(32.W))
    val b = Input(SInt(1.W))
    val out = Output(SInt(32.W))
  })

  io.out := io.a & io.b
}
@chick chick added the bug label Jan 14, 2019
@chick chick self-assigned this Jan 14, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant