Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将4位移位寄存器输出连接到Verilog中另一个模块的4位输入_Verilog_Vlsi - Fatal编程技术网

将4位移位寄存器输出连接到Verilog中另一个模块的4位输入

将4位移位寄存器输出连接到Verilog中另一个模块的4位输入,verilog,vlsi,Verilog,Vlsi,对于我们学校的项目,我尝试使用线性反馈移位寄存器在硬件上生成伪随机数(七段)。我已经编写了LFSR和七段模块,但是在连接这两个模块时遇到了问题。该项目进行了综合,但HDL图未显示LFSR和七段模块之间的任何连接。下面是代码 //main module module expo(input clock, reset, output a,b,c,d,e,f,g ); wire [3:0]connect, clk, a,b,c,d,e,f,g; LFSR

对于我们学校的项目,我尝试使用线性反馈移位寄存器在硬件上生成伪随机数(七段)。我已经编写了LFSR和七段模块,但是在连接这两个模块时遇到了问题。该项目进行了综合,但HDL图未显示LFSR和七段模块之间的任何连接。下面是代码

//main module
module expo(input clock, reset,
            output a,b,c,d,e,f,g
            );
wire [3:0]connect, clk, a,b,c,d,e,f,g;

LFSR_4_bit lfsr(
    .clock(clock),
    .LFSR(connect)
);

seven_seg seven(
     .in(connect),
     .reset(reset),
     .a(a),
     .b(b),
     .c(c),
     .d(d),
     .e(e),
     .f(f),
     .g(g)
);

endmodule

 //LFSR module
 module LFSR_4_bit(
            input clock,
            output reg[3:0]LFSR = 15  
);

    wire feedback = LFSR[4];

    always @(posedge clock)
       begin
      LFSR[0] <= feedback;
      LFSR[1] <= LFSR[0];
      LFSR[2] <= LFSR[1];
      LFSR[3] <= LFSR[2] ^ feedback;
      LFSR[4] <= LFSR[3];
      end

  endmodule

  //input and output for seven seg module

module sevenseg(
    input reset,
    input[3:0] in,  //the 4 inputs for each display
    output a, b, c, d, e, f, g, //the individual LED output for the seven segment along                           with the digital point
    output [3:0] an   // the 4 bit enable signal
    );
//主模块
模块expo(输入时钟、复位、,
输出a、b、c、d、e、f、g
);
电线[3:0]连接,时钟,a,b,c,d,e,f,g;
LFSR_4位LFSR(
.时钟(时钟),
.LFSR(连接)
);
七号赛格七号(
.在(连接)中,
.重置(重置),
.a(a),
.b(b),
.c(c),
.d(d),
.e(e),
.f(f),
.g(g)
);
端模
//LFSR模块
模块LFSR_4_位(
输入时钟,
输出寄存器[3:0]LFSR=15
);
线反馈=LFSR[4];
始终@(posedge时钟)
开始
LFSR[0]1)您实例化了
seven_seg
,但该模块名为
module sevenseg
,这是一个编译错误

2)您的LFSR有4位0到3,使用了第五位
LFSR[4]
,这也是一个编译错误

由于编译错误,我不确定您是否能够查看当前合成的结果,因为它应该失败。很可能您正在查看连接之前的旧结果

其他我想改变的事情:
a)当您定义
wire[3:0]connect、clk、a、b、c、d、e、f、g它们都是4位

但是,由于时钟(非时钟)和
a、b、c、d、e、f、g
已在端口列表中定义,因此它们已被声明。那条线可以是
wire[3:0]connect

b)当初始化触发器的值而不使用复位时,最好使用初始开始:这对FPGA有效,而不适用于应使用复位信号的ASIC

initial begin
  LFSR = 4'd15;
end

我认为初始语句通常用于实现测试台,不可合成,重置信号会使LFSR在每次转动时生成相同的数字序列on@dasholfsr被期望在开启时给出相同的序列,这就是为什么它们是伪随机的。初始语句是可合成的,用于设置FPGA的默认值。