altera FPGA 初始化一片ROM并仿真输出,帮我看看程序有什么问题?仿真结果各种错 15
下面是程序,不知道写的对不对,刚开始学这个,不吝赐教**************************************************moduletes...
下面是程序,不知道写的对不对,刚开始学这个,不吝赐教
**************************************************
module test5(
count,
clk,
rst,
data_out
);
input clk, rst;
output data_out;
output count;
reg [2:0] count;
wire [7:0] data_out;
ip_rom IP_ROM(
.address(count),
.clock(clk),
.q(data_out)
);
always @ (posedge clk or posedge rst)
begin
if(rst)
begin
count <= 0;
end
else
begin
count <= count + 1;
end
end
endmodule
***************************************上面是主程序
`timescale 1 ns/ 1 ps
module test5_vlg_tst();
// constants
// general purpose registers
reg eachvec;
// test vector input registers
reg clk;
reg rst;
// wires
wire [2:0] count;
wire [7:0] data_out;
// assign statements (if any)
test5 i1 (
// port map - connection between master ports and signals/registers
.clk(clk),
.count(count),
.data_out(data_out),
.rst(rst)
);
initial
begin
rst = 1;
#10 rst = 0;
clk = 1;
end
always
begin
#100 clk = ~clk;
end
endmodule
******************************testbench 展开
**************************************************
module test5(
count,
clk,
rst,
data_out
);
input clk, rst;
output data_out;
output count;
reg [2:0] count;
wire [7:0] data_out;
ip_rom IP_ROM(
.address(count),
.clock(clk),
.q(data_out)
);
always @ (posedge clk or posedge rst)
begin
if(rst)
begin
count <= 0;
end
else
begin
count <= count + 1;
end
end
endmodule
***************************************上面是主程序
`timescale 1 ns/ 1 ps
module test5_vlg_tst();
// constants
// general purpose registers
reg eachvec;
// test vector input registers
reg clk;
reg rst;
// wires
wire [2:0] count;
wire [7:0] data_out;
// assign statements (if any)
test5 i1 (
// port map - connection between master ports and signals/registers
.clk(clk),
.count(count),
.data_out(data_out),
.rst(rst)
);
initial
begin
rst = 1;
#10 rst = 0;
clk = 1;
end
always
begin
#100 clk = ~clk;
end
endmodule
******************************testbench 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询