我想对以下问题提出任何想法:我想将名为dut的块的输入端口连接到字节接口,该块的宽度为787:0位。我正在做如下:
val io = this.IO(new VerilatorHarnessIO(input_byte_count, output_byte_count*2))
val dut = Module(new DUT(dut_conf))
// inputs
val input_bytes = Cat(io.input_bytes)
val input_width = input_byte_count * 8
dut.io.inputs := input_bytes(input_width-1, input_width - dut_conf.inputBits)
我希望保留连接顺序,即:
字节_0 [7:0]->输入[7:0]
字节_1 [7:0]->输入[15:8]
但是我得到的是:
字节_0 [7:0]->输入[787:780]
字节_1 [7:0]->输入[779:772]
如果端口匹配,调试起来会容易得多。
有没有办法以正确的顺序进行此连接?谢谢
reverse
在Cat
执行所需操作之前使用该方法。
考虑以下凿子:
import chisel3._
import chisel3.stage.{ChiselStage, ChiselGeneratorAnnotation}
import chisel3.util.Cat
class Foo extends RawModule {
val in = IO(Input(Vec(4, UInt(8.W))))
val out = IO(Output(UInt(32.W)))
out := Cat(in.reverse)
}
(new ChiselStage)
.execute(Array.empty, Seq(ChiselGeneratorAnnotation(() => new Foo)))
这将产生以下Verilog,其字节顺序为您要寻找的:
module Foo(
input [7:0] in_0,
input [7:0] in_1,
input [7:0] in_2,
input [7:0] in_3,
output [31:0] out
);
wire [15:0] _T; // @[Cat.scala 29:58]
wire [15:0] _T_1; // @[Cat.scala 29:58]
assign _T = {in_1,in_0}; // @[Cat.scala 29:58]
assign _T_1 = {in_3,in_2}; // @[Cat.scala 29:58]
assign out = {_T_1,_T}; // @[<pastie> 25:7]
endmodule
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句