reg [9:0]x2,y2; reg x_dir2,y_dir2; always @(posedge clk_data or negedge rst_n) begin if(!rst_n) x_dir2 <=1; else begin if (x2==50) x_dir2 <=1; else if (x2==589) x_dir2 <= 0; else x_dir2 <= x_dir2; end end
always @(posedge clk_data or negedge rst_n) begin if(!rst_n) y_dir2 <=1; else begin if (y2==50) y_dir2 <=1; else if (y2==429) y_dir2 <=0; else y_dir2 <= y_dir2; end end
always @(posedge clk_data or negedge rst_n) begin if (!rst_n)x2<=320; else if(x_dir2 ) x2 <=x2+1; else x2<=x2-1;end
always @(posedge clk_data or negedge rst_n ) begin if (!rst_n)y2<=240; else if(y_dir2 ) y2 <=y2+1; else y2<=y2-1;end
/////////////////////ball_3////////////////////////////// reg [9:0]x3,y3; reg x_dir3,y_dir3; always @(posedge clk_data or negedge rst_n) begin if(!rst_n) x_dir3 <=1; else begin if (x3==50) x_dir3 <=1; else if (x3==589) x_dir3 <= 0; else x_dir3 <= x_dir3; end end
always @(posedge clk_data or negedge rst_n) begin if(!rst_n) y_dir3 <=1; else begin if (y3==50) y_dir3 <=1; else if (y3==429) y_dir3 <=0; else y_dir3 <= y_dir3; end end
always @(posedge clk_data or negedge rst_n) begin if (!rst_n) x3<=400; else if(x_dir3 ) x3 <=x3+1; else x3<=x3-1;end
always @(posedge clk_data or negedge rst_n ) begin if (!rst_n)y3<=120; else if(y_dir3 ) y3 <=y3+1; else y3<=y3-1;end
reg [9:0]x4,y4; reg x_dir4,y_dir4; always @(posedge clk_data or negedge rst_n) begin if(!rst_n) x_dir4 <=1; else begin if (x4==50) x_dir4 <=1; else if (x4==589) x_dir4 <= 0; else x_dir4 <= x_dir4; end end
always @(posedge clk_data or negedge rst_n) begin if(!rst_n) y_dir4 <=1; else begin if (y4==50) y_dir4 <=1; else if (y4==429) y_dir4 <=0; else y_dir4 <= y_dir4; end end
always @(posedge clk_data or negedge rst_n) begin if (!rst_n) x4<=555; else if(x_dir4 ) x4 <=x4+1; else x4<=x4-1;end
always @(posedge clk_data or negedge rst_n ) begin if (!rst_n)y4<=532; else if(y_dir4 ) y4 <=y4+1; else y4<=y4-1;end
reg [9:0]x5,y5; reg x_dir5,y_dir5; always @(posedge clk_data or negedge rst_n) begin if(!rst_n) x_dir5 <=1; else begin if (x5==50) x_dir5 <=1; else if (x5==589) x_dir5 <= 0; else x_dir5 <= x_dir5; end end
always @(posedge clk_data or negedge rst_n) begin if(!rst_n) y_dir5 <=1; else begin if (y5==50) y_dir5 <=1; else if (y5==429) y_dir5 <=0; else y_dir5 <= y_dir5; end end
always @(posedge clk_data or negedge rst_n) begin if (!rst_n) x5<=132; else if(x_dir5 ) x5 <=x5+1; else x5<=x5-1;end
always @(posedge clk_data or negedge rst_n ) begin if (!rst_n)y5<=100; else if(y_dir5 ) y5 <=y5+1; else y5<=y5-1;end
reg [9:0]x6,y6; reg x_dir6,y_dir6; always @(posedge clk_data or negedge rst_n) begin if(!rst_n) x_dir6 <=1; else begin if (x6==50) x_dir6 <=1; else if (x6==589) x_dir6 <= 0; else x_dir6 <= x_dir6; end end
always @(posedge clk_data or negedge rst_n) begin if(!rst_n) y_dir6 <=1; else begin if (y6==50) y_dir6 <=1; else if (y6==429) y_dir6 <=0; else y_dir6 <= y_dir6; end end
always @(posedge clk_data or negedge rst_n) begin if (!rst_n) x6<=232; else if(x_dir6 ) x6 <=x6+1; else x6<=x6-1;end
always @(posedge clk_data or negedge rst_n ) begin if (!rst_n)y6<=200; else if(y_dir6 ) y6 <=y6+1; else y6<=y6-1;end
reg [9:0]x7,y7; reg x_dir7,y_dir7; always @(posedge clk_data or negedge rst_n) begin if(!rst_n) x_dir7 <=1; else begin if (x7==50) x_dir7 <=1; else if (x7==589) x_dir7 <= 0; else x_dir7 <= x_dir7; end end
always @(posedge clk_data or negedge rst_n) begin if(!rst_n) y_dir7 <=1; else begin if (y7==50) y_dir7 <=1; else if (y7==429) y_dir7 <=0; else y_dir7 <= y_dir7; end end
always @(posedge clk_data or negedge rst_n) begin if (!rst_n) x7<=232; else if(x_dir7 ) x7 <=x7+1; else x7<=x7-1;end
always @(posedge clk_data or negedge rst_n ) begin if (!rst_n)y7<=100; else if(y_dir7 ) y7 <=y7+1; else y7<=y7-1;end
////////////////////////////////////////////////////// reg dir_dir; integer jj; always @(posedge clk_cir or negedge rst_n ) begin if (!rst_n) begin jj<=0;dir_dir<=0; end else if(dir_dir==0) begin if(jj==200) dir_dir<=1; else jj<=jj+1;end else if(dir_dir==1) begin if(jj==0 ) dir_dir<=0; else jj<=jj-1;end else ; end
文章评论(0条评论)
登录后参与讨论