root.sv 891 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // synopsys translate_off
  2. `timescale 1 ps / 1 ps
  3. // synopsys translate_on
  4. module root(
  5. input clk,
  6. input [1:0] keys,
  7. input [3:0] switches,
  8. output [7:0] leds
  9. );
  10. wire reset;
  11. wire mclk; // Master clock for main logic
  12. wire pll_lock;
  13. assign reset = ~(keys[0] & pll_lock);
  14. pll pll0(
  15. .areset(~keys[0]),
  16. .inclk0(clk),
  17. .c0(mclk),
  18. .locked(pll_lock)
  19. );
  20. endmodule : root
  21. module root_tb ();
  22. reg CLK50;
  23. reg [1:0] KEYS;
  24. wire [7:0] LEDS;
  25. reg [3:0] SWITCHS;
  26. root de0nano_0 (CLK50, KEYS, SWITCHS, LEDS);
  27. initial forever #10ps CLK50 = !CLK50;
  28. initial begin
  29. CLK50 = 0;
  30. KEYS = 2'b00; // Keys are pull up, starting with both being pressed
  31. SWITCHS = 4'b0000;
  32. #60ps;
  33. KEYS = 2'b11; // Release keys
  34. #7000ps;
  35. $finish();
  36. end
  37. endmodule : root_tb