发布网友 发布时间:2022-05-23 09:52
共2个回答
热心网友 时间:2023-10-20 01:10
我m序列代码赋值下来是,发现wire和x中间没有空格,这可能是导致你没有输出的原因,个人建议你的代码这样写:追答mole prbs(clk,rst,reg_buf,m_out);
input clk,rst;
input [7:0]reg_buf;
output m_out;
reg [7:0]reg_buf_r;
always@(posedge clk or posedge rst)
if(!rst)
reg_buf_r[7:0] <= 8'b1000_0000;
else
reg_buf_r[7:0] <= {reg_buf[6:0],reg_buf[7]^reg_buf[3]^reg_buf[2]^reg_buf[1]};
assign m_out = reg_buf_r[7];
endmole
测试文件testbench:
`timescale 1ns/1ps// testbench.v
`include "prbs.v"
mole testbench;
wire m_out;
reg[7:0]reg_buf;
reg clk;
reg rst;
prbs prbs(.m_out(m_out),.rst(rst),.reg_buf(reg_buf).clk(clk));
initial
begin
rst = 1'b1; #10 rst = 1'b0;
clk = 1'b1; forever #50 clk = ~clk;
end
always #50 reg_buf <= {$random} % 256;
endmole
热心网友 时间:2023-10-20 01:11
您好,我是用C语言最终来自:求助得到的回答