Advertisement
Guest User

movimiento

a guest
Aug 10th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. always_ff (@posedge clock )
  2.      begin
  3.      
  4.     if (dir_up=1'b1 && dir_down=1'b0 && dir_left=1'b0 && dir_right=1'b0)
  5.              pos_x_next<=pos_x +3'b1 ;
  6.          
  7.         else pos_x_next<=pos_x;
  8.    
  9.    
  10.     if (dir_up = 1'b0 and dir_down=1'b1 and dir_left=1'b0 and dir_right=1'b0)
  11.              pos_x_next<=pos_x -3'b1;
  12.         else pos_x_next<=pos_x;
  13.    
  14.     if    (dir_up=1'b0 && dir_down=1'b0 && dir_left=1'b1 && dir_right=1'b0)
  15.                 pos_y_next<=pos_y -3'b1 ;
  16.            
  17.         else    pos_x_next<=pos_x;
  18.    
  19.     if     (dir_up=1'b0 && dir_down=1'b0 && dir_left=1'b0 && dir_right=1'b1)
  20.              pos_y_next<=pos_y +3'b1 ;
  21.     else     pos_y_next<=pos_y;
  22.    
  23.    
  24.      
  25.          
  26.          end
  27. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement