prod2u_p4_normal_v3_top_tb.v 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. `timescale 1ns/1ps
  2. module prod2u_p4_normal_v3_top_tb;
  3. reg sys_clk = 1'b0;
  4. reg host_uart_rx = 1'b1;
  5. wire host_uart_tx;
  6. wire [7:0] ptc_pwm_out;
  7. wire [3:0] fan_pwm_out;
  8. wire motor_en_n;
  9. wire x_step;
  10. wire x_dir;
  11. wire y_step;
  12. wire y_dir;
  13. reg x_limit_raw = 1'b0;
  14. reg y_limit_raw = 1'b0;
  15. tri temp_scl;
  16. tri temp_sda;
  17. always #1 sys_clk = ~sys_clk;
  18. prod2u_p4_normal_v3_top dut (
  19. .sys_clk(sys_clk), .host_uart_rx(host_uart_rx), .host_uart_tx(host_uart_tx),
  20. .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
  21. .motor_en_n(motor_en_n), .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
  22. .x_limit_raw(x_limit_raw), .y_limit_raw(y_limit_raw),
  23. .temp_scl(temp_scl), .temp_sda(temp_sda)
  24. );
  25. initial begin
  26. repeat (1100) @(posedge sys_clk);
  27. if (host_uart_tx !== 1'b1) $fatal(1, "UART TX is not idle");
  28. if (ptc_pwm_out !== 8'd0) $fatal(1, "PTC outputs are not off");
  29. if (fan_pwm_out !== 4'hF) $fatal(1, "FAN outputs are not inactive");
  30. if (motor_en_n !== 1'b0) $fatal(1, "motor enable is not constant low");
  31. $display("prod2u_p4_normal_v3_top_tb PASS");
  32. $finish;
  33. end
  34. endmodule