project_adapter.v 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. `timescale 1ns/1ps
  2. module project_adapter #(
  3. parameter integer PTC_COUNT = 8,
  4. parameter integer FAN_COUNT = 4,
  5. parameter integer CHAMBER_PTC_COUNT = 4,
  6. parameter integer SET_ALL_PAYLOAD_LENGTH = 11,
  7. parameter integer FAN_OFFSET = 0,
  8. parameter integer CHAMBER_PTC_OFFSET = 4,
  9. parameter integer Z_DOOR_OFFSET = 8,
  10. parameter integer EXHAUST_X_OFFSET = 9,
  11. parameter integer EXHAUST_Y_OFFSET = 10,
  12. parameter integer OPEN_DIR = 0,
  13. parameter integer CLOSE_DIR = 1,
  14. parameter integer AXIS_COUNT = 3
  15. ) (
  16. input wire clk,
  17. input wire rst_n,
  18. input wire frame_valid,
  19. output wire frame_ready,
  20. output wire frame_accept_enable,
  21. input wire [7:0] frame_type,
  22. input wire [7:0] frame_length,
  23. output wire [7:0] payload_read_addr,
  24. input wire [7:0] payload_read_data,
  25. output wire target_wr_en,
  26. output wire [3:0] target_wr_addr,
  27. output wire [7:0] target_wr_data,
  28. output wire valid_set_all_commit,
  29. output wire motor_start,
  30. output wire [AXIS_COUNT-1:0] motor_active_mask,
  31. output wire [AXIS_COUNT-1:0] motor_dir_mask,
  32. input wire motor_busy,
  33. input wire watchdog_abort,
  34. output wire temperature_start,
  35. input wire temperature_done,
  36. output wire tx_start,
  37. input wire tx_done,
  38. output wire busy
  39. );
  40. wire [1:0] z_door_cmd;
  41. wire [1:0] exhaust_x_cmd;
  42. wire [1:0] exhaust_y_cmd;
  43. wire door_action_valid;
  44. command_controller #(
  45. .PTC_COUNT(PTC_COUNT),
  46. .FAN_COUNT(FAN_COUNT),
  47. .CHAMBER_PTC_COUNT(CHAMBER_PTC_COUNT),
  48. .SET_ALL_PAYLOAD_LENGTH(SET_ALL_PAYLOAD_LENGTH),
  49. .FAN_OFFSET(FAN_OFFSET),
  50. .CHAMBER_PTC_OFFSET(CHAMBER_PTC_OFFSET),
  51. .Z_DOOR_OFFSET(Z_DOOR_OFFSET),
  52. .EXHAUST_X_OFFSET(EXHAUST_X_OFFSET),
  53. .EXHAUST_Y_OFFSET(EXHAUST_Y_OFFSET)
  54. ) controller (
  55. .clk(clk), .rst_n(rst_n),
  56. .frame_valid(frame_valid), .frame_ready(frame_ready),
  57. .frame_accept_enable(frame_accept_enable),
  58. .frame_type(frame_type), .frame_length(frame_length),
  59. .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
  60. .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr),
  61. .target_wr_data(target_wr_data),
  62. .valid_set_all_commit(valid_set_all_commit),
  63. .z_door_cmd(z_door_cmd),
  64. .exhaust_x_cmd(exhaust_x_cmd),
  65. .exhaust_y_cmd(exhaust_y_cmd),
  66. .door_action_valid(door_action_valid),
  67. .temperature_start(temperature_start), .temperature_done(temperature_done),
  68. .tx_start(tx_start), .tx_done(tx_done), .busy(busy)
  69. );
  70. door_action_dispatcher #(
  71. .OPEN_DIR(OPEN_DIR),
  72. .CLOSE_DIR(CLOSE_DIR),
  73. .AXIS_COUNT(AXIS_COUNT)
  74. ) u_door_dispatch (
  75. .clk(clk), .rst_n(rst_n),
  76. .door_action_valid(door_action_valid),
  77. .z_door_cmd(z_door_cmd),
  78. .exhaust_x_cmd(exhaust_x_cmd),
  79. .exhaust_y_cmd(exhaust_y_cmd),
  80. .watchdog_abort(watchdog_abort),
  81. .motor_start(motor_start),
  82. .motor_active_mask(motor_active_mask),
  83. .motor_dir_mask(motor_dir_mask),
  84. .motor_busy(motor_busy)
  85. );
  86. endmodule