always @(posedge clk)
begin
if(start == 0)
begin
col_out0<=6'd0;
row_out0<=6'd0;
end
else begin
if(count == 6'd39)
begin
count<=6'd0;
end
else
begin
count<=count+1;
//循环列扫描
case(count)
6'b000001 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0000_0001;sta<=6'd1; end
6'b000010 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0000_0010;sta<=6'd2; end
6'b000011 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0000_0100;sta<=6'd3; end
6'b000100 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0000_1000;sta<=6'd4; end
6'b000101 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0001_0000;sta<=6'd5; end
6'b000110 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0010_0000;sta<=6'd6; end
6'b000111 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_0100_0000;sta<=6'd7; end
6'b001000 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0000_1000_0000;sta<=6'd8; end
6'b001001 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0001_0000_0000;sta<=6'd9; end
6'b001010 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0010_0000_0000;sta<=6'd10; end
6'b001011 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_0100_0000_0000;sta<=6'd11; end
6'b001100 : begin row<=40'b0000_0000_0000_0000_0000_0000_0000_1000_0000_0000;sta<=6'd12; end
6'b001101 : begin row<=40'b0000_0000_0000_0000_0000_0000_0001_0000_0000_0000;sta<=6'd13; end
6'b001110 : begin row<=40'b0000_0000_0000_0000_0000_0000_0010_0000_0000_0000;sta<=6'd14; end
6'b001111 : begin row<=40'b0000_0000_0000_0000_0000_0000_0100_0000_0000_0000;sta<=6'd15; end
6'b010000 : begin row<=40'b0000_0000_0000_0000_0000_0000_1000_0000_0000_0000;sta<=6'd16; end
6'b010001 : begin row<=40'b0000_0000_0000_0000_0000_0001_0000_0000_0000_0000;sta<=6'd17; end
6'b010010 : begin row<=40'b0000_0000_0000_0000_0000_0010_0000_0000_0000_0000;sta<=6'd18; end
6'b010011 : begin row<=40'b0000_0000_0000_0000_0000_0100_0000_0000_0000_0000;sta<=6'd19; end
6'b010100 : begin row<=40'b0000_0000_0000_0000_0000_1000_0000_0000_0000_0000;sta<=6'd20; end
6'b010101 : begin row<=40'b0000_0000_0000_0000_0001_0000_0000_0000_0000_0000;sta<=6'd21; end
6'b010110 : begin row<=40'b0000_0000_0000_0000_0010_0000_0000_0000_0000_0000;sta<=6'd22; end
6'b010111 : begin row<=40'b0000_0000_0000_0000_0100_0000_0000_0000_0000_0000;sta<=6'd23; end
6'b011000 : begin row<=40'b0000_0000_0000_0000_1000_0000_0000_0000_0000_0000;sta<=6'd24; end
6'b011001 : begin row<=40'b0000_0000_0000_0001_0000_0000_0000_0000_0000_0000;sta<=6'd25; end
6'b011010 : begin row<=40'b0000_0000_0000_0010_0000_0000_0000_0000_0000_0000;sta<=6'd26; end
6'b011011 : begin row<=40'b0000_0000_0000_0100_0000_0000_0000_0000_0000_0000;sta<=6'd27; end
6'b011100 : begin row<=40'b0000_0000_0000_1000_0000_0000_0000_0000_0000_0000;sta<=6'd28; end
6'b011101 : begin row<=40'b0000_0000_0001_0000_0000_0000_0000_0000_0000_0000;sta<=6'd29; end
6'b011110 : begin row<=40'b0000_0000_0010_0000_0000_0000_0000_0000_0000_0000;sta<=6'd30; end
6'b011111 : begin row<=40'b0000_0000_0100_0000_0000_0000_0000_0000_0000_0000;sta<=6'd31; end
6'b100000 : begin row<=40'b0000_0000_1000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd32; end
6'b100001 : begin row<=40'b0000_0001_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd33; end
6'b100010 : begin row<=40'b0000_0010_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd34; end
6'b100011 : begin row<=40'b0000_0100_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd35; end
6'b100100 : begin row<=40'b0000_1000_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd36; end
6'b100101 : begin row<=40'b0001_0000_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd37; end
6'b100110 : begin row<=40'b0010_0000_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd38; end
6'b100111 : begin row<=40'b0100_0000_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd39; end
6'b101000 : begin row<=40'b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000;sta<=6'd40; end
endcase
//行扫描译码
case(sta)
6'd1:begin
case(col)
这是我写的40x40的光敏电阻识别识别点光源的部分程序,下面是testbench,但仿真出现error: can't read "vsimPriv(.main_pane.wave.interior.cs.body.pw.wf:grid)": no such element in array # Error in macro ./gmdz40x40_run_msim_rtl_verilog.do line 42 # can't read "vsimPriv(.main_pane.wave.interior.cs.body.pw.wf:grid)": no such element in array # while executing # "add wave *"这样的错误