Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- always_ff (@posedge clock )
- begin
- if (dir_up=1'b1 && dir_down=1'b0 && dir_left=1'b0 && dir_right=1'b0)
- pos_x_next<=pos_x +3'b1 ;
- else pos_x_next<=pos_x;
- if (dir_up = 1'b0 and dir_down=1'b1 and dir_left=1'b0 and dir_right=1'b0)
- pos_x_next<=pos_x -3'b1;
- else pos_x_next<=pos_x;
- if (dir_up=1'b0 && dir_down=1'b0 && dir_left=1'b1 && dir_right=1'b0)
- pos_y_next<=pos_y -3'b1 ;
- else pos_x_next<=pos_x;
- if (dir_up=1'b0 && dir_down=1'b0 && dir_left=1'b0 && dir_right=1'b1)
- pos_y_next<=pos_y +3'b1 ;
- else pos_y_next<=pos_y;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement