Advertisement
potterhead2003

ADLD_T1_Q3

Jul 23rd, 2021 (edited)
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date:    12:37:12 07/23/2021
  7. // Design Name:
  8. // Module Name:    mc
  9. // Project Name:
  10. // Target Devices:
  11. // Tool versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module mc(input clk, output reg c1, output reg c2
  22.     );
  23.      
  24.      reg x1,x2,y1,y2;
  25.      
  26.      always@(posedge clk) begin
  27.      
  28.      x1 = x1 + 1;
  29.      x2 = x2 + 1;
  30.      y1 = y1 + 1;
  31.      y2 = y2 + 1;
  32.      
  33.      if (x1 == 6) begin
  34.      c1 = 1'b1;
  35.      x1 = 1;
  36.      end
  37.      
  38.      if (x2 == 6) begin
  39.      c1 = 0;
  40.      x2 = 1;
  41.      end
  42.      
  43.      if (y1 == 6) begin
  44.      c2 = 1'b1;
  45.      y1 = 1;
  46.      end
  47.      
  48.      if (y2 == 7) begin
  49.      c2 = 0;
  50.      y2 = 1;
  51.      end
  52.      
  53.      end
  54.      
  55.      initial begin
  56.      x1 = 1;
  57.      x2 = 3;
  58.      y1 = 1;
  59.      y2 = 5;
  60.      c1 = 1'b1;
  61.      c2 = 1'b1;
  62.      end
  63.  
  64.  
  65. endmodule
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement