bypass.sv 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. module bypass (
  2. input clock_in,
  3. input rtc_32khz,
  4. input board_id,
  5. input spi_clk,
  6. output spi_miso,
  7. input spi_mosi,
  8. input spi_cs_esp_n,
  9. output esp_int,
  10. output spi_cs_flash_n, // Really just a GPIO on ESP32
  11. output flash_cs_n,
  12. output flash_sck,
  13. inout [1:0] flash_io,
  14. output abc_host_v1,
  15. output abc_host_v12,
  16. output abc_d_oe,
  17. output abc_int800_x,
  18. output abc_int80_x,
  19. output abc_nmi_x,
  20. output abc_rdy_x,
  21. output abc_resin_x,
  22. output abc_xm_x,
  23. output led_0,
  24. output led_1_v1,
  25. output led_1_v2,
  26. output led_2
  27. );
  28. wire v1 = board_id; // High = v1
  29. wire v2 = ~board_id; // Low = v2
  30. wire [2:0] led;
  31. assign led_0 = led[0];
  32. assign led_1_v1 = v1 ? led[1] : 1'bz;
  33. assign led_1_v2 = v2 ? led[1] : 1'bz;
  34. assign led_2 = led[2];
  35. assign flash_sck = spi_clk;
  36. assign flash_io[0] = spi_mosi;
  37. assign flash_io[1] = 1'bz;
  38. assign spi_miso = flash_io[1];
  39. assign flash_cs_n = spi_cs_esp_n;
  40. assign esp_int = 1'b0; // Signal FPGA ready
  41. assign spi_cs_flash_n = board_id;
  42. assign abc_host_v1 = v1 ? 1'b0 : 1'bz;
  43. assign abc_host_v12 = 1'b0;
  44. assign abc_d_oe = 1'b0;
  45. assign abc_int800_x = v1 ? 1'b0 : 1'bz;
  46. assign abc_int80_x = v1 ? 1'b0 : 1'bz;
  47. assign abc_nmi_x = v1 ? 1'b0 : 1'bz;
  48. assign abc_rdy_x = v1 ? 1'b0 : 1'bz;
  49. assign abc_resin_x = v1 ? 1'b0 : 1'bz;
  50. assign abc_xm_x = v1 ? 1'b0 : 1'bz;
  51. assign abc_int800_x = v1 ? 1'b0 : 1'bz;
  52. reg [12:0] blink;
  53. always @(negedge rtc_32khz)
  54. blink <= blink + 1'b1;
  55. assign led = {3{blink[12]}};
  56. endmodule // bypass