Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

VCS backend fails on blocks with no IOs (standalone) #153

Open
stevenmburns opened this issue Jun 8, 2017 · 4 comments
Open

VCS backend fails on blocks with no IOs (standalone) #153

stevenmburns opened this issue Jun 8, 2017 · 4 comments

Comments

@stevenmburns
Copy link

The code below fails to compile in VCS but works with Verilator and firrtl-interpreter.

package bug

import org.scalatest.{ Matchers, FlatSpec}

import chisel3._
import chisel3.iotesters._

class VCSBug extends Module {
  val io = IO(new Bundle)
}

class Tester(c:VCSBug) extends PeekPokeTester(c) {
  step(1)
}

class VCSTest extends FlatSpec with Matchers {
  behavior of "VCSBug"
  it should "work" in {
    chisel3.iotesters.Driver( () => new VCSBug, "vcs") { c =>
      new Tester( c)
    } should be ( true)
  }
}

class VerilatorTest extends FlatSpec with Matchers {
  behavior of "VCSBug"
  it should "work" in {
    chisel3.iotesters.Driver( () => new VCSBug, "verilator") { c =>
      new Tester( c)
    } should be ( true)
  }
}

class FirrtlTest extends FlatSpec with Matchers {
  behavior of "VCSBug"
  it should "work" in {
    chisel3.iotesters.Driver( () => new VCSBug, "firrtl") { c =>
      new Tester( c)
    } should be ( true)
  }
}

The trailing comma after the reset binding in the harness is the issue:

module test;
  reg clock = 1;
  reg reset = 1;
  always #`CLOCK_PERIOD clock = ~clock;
  reg vcdon = 0;
  reg [1023:0] vcdfile = 0;
  reg [1023:0] vpdfile = 0;

  /*** DUT instantiation ***/
  VCSBug VCSBug(
    .clock(clock),
    .reset(reset),
  );

@aswaterman
Copy link
Member

aswaterman commented Jun 8, 2017

Is this actually legal according to the Verilog spec--i.e., is VCS wrong, or is Verilator too lax?

@stevenmburns
Copy link
Author

image

I don't see any trailing commas allowed in the Verilog 2001 module instantiation spec, unless the thing called "expression" is allowed to be empty. But if it was, then there would be three parameters to module and they are only two where to module is defined.

Fixing this should be easy---it is not as if verilator is going to fail if we remove the extra comma.

@aswaterman
Copy link
Member

Yeah, of course. I asked because I was going to file a ticket if it was a VCS bug.

@stevobailey
Copy link

stevobailey commented Nov 22, 2017

I think it's because verilator and FIRRTL tests don't generate a Verilog test harness. Only VCS does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants