chisel - sbt 运行期间缺少构建文件

标签 chisel

我将“--backend”和“v”添加到我的 chiselMainTest 列表中,虽然我得到了 verilog 输出,但我也收到了构建错误:

In file included from ./vpi.cpp:1:
./vpi.h:4:10: fatal error: 'vpi_user.h' file not found
#include "vpi_user.h"
         ^
1 error generated.

sbt 运行的完整列表如下:

BigKiss:chisel mykland$ sbt run
[info] Set current project to chisel (in build file:/Users/mykland/work/chisel/)
[info] Compiling 1 Scala source to /Users/mykland/work/chisel/target/scala-2.10/classes...
[warn] there were 38 feature warning(s); re-run with -feature for details
[warn] one warning found
[info] Running mainStub 
[info] [0.056] // COMPILING < (class lut3to1_1)>(0)
[info] [0.078] giving names
[info] [0.088] executing custom transforms
[info] [0.089] adding clocks and resets
[info] [0.093] inferring widths
[info] [0.108] checking widths
[info] [0.110] lowering complex nodes to primitives
[info] [0.113] removing type nodes
[info] [0.117] compiling 84 nodes
[info] [0.117] computing memory ports
[info] [0.117] resolving nodes to the components
[info] [0.133] creating clock domains
[info] [0.134] pruning unconnected IOs
[info] [0.136] checking for combinational loops
[info] [0.139] NO COMBINATIONAL LOOP FOUND
[info] [0.149] COMPILING <lut3to1_1 (class lut3to1_1)> 0 CHILDREN (0,0)
In file included from ./vpi.cpp:1:
./vpi.h:4:10: fatal error: 'vpi_user.h' file not found
#include "vpi_user.h"
         ^
1 error generated.
[info] [0.666] g++ -c -o ./vpi.o -I$VCS_HOME/include -I./ -fPIC -std=c++11 ./vpi.cpp RET 1
[error] lut3to1_1.scala:58: failed to compile vpi.cpp in class mainStub$
Re-running Chisel in debug mode to obtain erroneous line numbers...
[info] [0.030] // COMPILING < (class lut3to1_1)>(0)
[info] [0.035] giving names
[info] [0.037] executing custom transforms
[info] [0.037] adding clocks and resets
[info] [0.038] inferring widths
[info] [0.045] checking widths
[info] [0.046] lowering complex nodes to primitives
[info] [0.047] removing type nodes
[info] [0.049] compiling 84 nodes
[info] [0.049] computing memory ports
[info] [0.049] resolving nodes to the components
[info] [0.055] creating clock domains
[info] [0.055] pruning unconnected IOs
[info] [0.056] checking for combinational loops
[info] [0.056] NO COMBINATIONAL LOOP FOUND
[info] [0.060] COMPILING <lut3to1_1 (class lut3to1_1)> 0 CHILDREN (0,0)
In file included from ./vpi.cpp:1:
./vpi.h:4:10: fatal error: 'vpi_user.h' file not found
#include "vpi_user.h"
         ^
1 error generated.
[info] [0.535] g++ -c -o ./vpi.o -I$VCS_HOME/include -I./ -fPIC -std=c++11 ./vpi.cpp RET 1
[error] lut3to1_1.scala:58: failed to compile vpi.cpp in class mainStub$
[error] (run-main-0) Chisel.ChiselException: failed to compile vpi.cpp
Chisel.ChiselException: failed to compile vpi.cpp
at mainStub$.main(lut3to1_1.scala:58)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 9 s, completed Oct 4, 2015 6:33:30 PM
BigKiss:chisel mykland$ 

我的源代码的完整列表如下:

import Chisel._

class lut3to1_1 extends Module
{
    val io = new Bundle
    {
        val config  = UInt(INPUT, 8)
        val a       = Bool(INPUT)
        val b       = Bool(INPUT)
        val c       = Bool(INPUT)
        val out     = Bool(OUTPUT)
    }
    io.out :=   (io.config(0) & !io.a & !io.b & !io.c) |
                (io.config(1) &  io.a & !io.b & !io.c) |
                (io.config(2) & !io.a &  io.b & !io.c) |
                (io.config(3) &  io.a &  io.b & !io.c) |
                (io.config(4) & !io.a & !io.b &  io.c) |
                (io.config(5) &  io.a & !io.b &  io.c) |
                (io.config(6) & !io.a &  io.b &  io.c) |
                (io.config(7) &  io.a &  io.b &  io.c)
}

class lut3to1_1_Tests(c: lut3to1_1) extends Tester(c)
{
    for ( config <- 0 to 255 )
    {
        poke( c.io.config, config )
        for ( bits <- 0 to 7 )
        {
            val bitA = bits & 1
            val bitB = (bits >> 1) & 1
            val bitC = (bits >> 2) & 1
            poke( c.io.a, bitA )
            poke( c.io.b, bitB )
            poke( c.io.c, bitC )
            step( 1 )
            val result0 = ~bitA & ~bitB & ~bitC & (config & 1)
            val result1 =  bitA & ~bitB & ~bitC & ((config >> 1) & 1)
            val result2 = ~bitA &  bitB & ~bitC & ((config >> 2) & 1)
            val result3 =  bitA &  bitB & ~bitC & ((config >> 3) & 1)
            val result4 = ~bitA & ~bitB &  bitC & ((config >> 4) & 1)
            val result5 =  bitA & ~bitB &  bitC & ((config >> 5) & 1)
            val result6 = ~bitA &  bitB &  bitC & ((config >> 6) & 1)
            val result7 =  bitA &  bitB &  bitC & ((config >> 7) & 1)
            val result =    result0 | result1 | result2 | result3 | 
                            result4 | result5 | result6 | result7
            expect( c.io.out, result )
        }
    }
}

object mainStub
{
    def main( args: Array[String] ): Unit =
    {
        chiselMainTest( Array[String]("--backend", "c", "--backend", "v",
                "--compile", "--test", "--genHarness"), () => Module( new lut3to1_1() ) )
        {
            c => new lut3to1_1_Tests( c )
        }
    }
}

最佳答案

缺少的头文件 (vpi_user.h) 与 Verilog 模拟器 VPI 支持相关,这是 Chisel 用于将测试仪连接到 Verilog 模拟器的机制。当前版本的 Chisel 仅支持 Synopsys VCS 作为 Verilog 仿真工具。我的 Chisel 分支(可用 here )对 Icarus Verilog (iverilog) 版本 10.0+、Verilator、Modelsim 和 Questasim 提供了实验性支持。不幸的是,我没有时间彻底测试这些更改并向主存储库发出拉取请求,但您可以尝试一下,看看它是否适合您。

关于chisel - sbt 运行期间缺少构建文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32940258/

相关文章:

chisel - 如何设置emitVerilog的生成目录?

chisel - 如何覆盖/扩展凿子信号命名

凿子3 : False Combinational Loop in Fixed Priority Arbiter

c++ - 从 RISC-V 裸机程序调用 printf 系统调用时使用 C++ 模拟器失败

scala - Chisel 既不为 verilog 也不为 C++ 合成

chisel - io += 端口 : value += is not a member of Chisel. bundle

chisel - 检索 RegInit 的重置值

chisel - 与经典硬件描述语言相比,Chisel 有哪些优势?

sbt - chisel 5.0.0-RC1 和 chiseltest

chisel - chisel3 中的 BlackBox 功能