使用quarters ll 13.0调用modelsim仿真报错,不知道是哪里错了。
下面是代码:
module ADC0809sampling(clk,ale,start,oe,eoc,adds,data_in,data_out,rst);
input clk;
input rst; input eoc; input [7:0]data_in; output ale;
output start;
output oe; output [2:0]adds;
output [7:0]data_out;
reg ale,start,oe;
wire [2:0]adds; reg [7:0]data_out;
reg [7:0]data_temp; reg [7:0]state;
parameter st0=7'b0000000, st1=7'b0000001, st2=7'b0000010,
st3=7'b0000100, st4=7'b0001000, st5=7'b0010000, st6=7'b0100000, st7=7'b1000000; always @(posedge clk or negedge rst) begin if(!rst) begin data_temp<=0; state<=st0; end
else case(state) st0: begin ale<=1'b0; start<=1'b0;
oe<=1'b0; state<=st1; end st1: begin ale<=1'b1; start<=1'b0; oe<=1'b0; state<=st2; end
st2: begin ale<=1'b0; start<=1'b1; oe<=1'b0; state<=st3; end
st3: begin ale<=1'b0; start<=1'b0; oe<=1'b0; state<=st4; end st4: begin
if(eoc==1'b1) state<=st5; else state=st4; end st5: begin ale<=1'b0;
start<=1'b0; oe<=1'b0; state<=st6; end st6:
begin ale<=1'b0; start<=1'b0; oe<=1'b1; data_temp<=data_in; state<=st7; end
st7: begin ale<=1'b0; start<=1'b0; oe<=1'b0; state<=st0; end
endcase end assign adds=3'b001; always @(negedge oe) data_out<=data_temp;
endmodule
testbench如下: `timescale 1ns/1ps
module ADC0809sampling_tb;
reg clk; reg eoc; reg [7:0]data_in; reg rst;
wire [2:0]adds; wire oe; wire start; wire [7:0]data_out; wire ale;
ADC0809sampling T0(.clk(clk), .ale(ale), .start(start), .oe(oe), .eoc(eoc), .adds(adds), .data_in(data_in), .data_out(data_out), .rst(rst)); initial begin clk=0; rst=0; #100; rst=1; end always #20 clk=~clk; initial begin data_in=8'b00000000; eoc=1; end always@(negedge start) begin eoc=0; data_in<=data_in+1'b1; #200 eoc=1; end endmodule
编译和仿真结果图片在下面,是程序错了还是啥问题呀,研究了两三天了,好难!
1
|