prod2u_p4_normal_v3_top_tb.v 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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, x_dir, y_step, y_dir, z_step, z_dir;
  10. reg x_limit_ls = 1'b0;
  11. reg x_limit_hs = 1'b0;
  12. reg y_limit_ls = 1'b0;
  13. reg y_limit_hs = 1'b0;
  14. reg z_limit_ls = 1'b0;
  15. reg z_limit_hs = 1'b0;
  16. tri temp_scl;
  17. tri temp_sda;
  18. always #1 sys_clk = ~sys_clk;
  19. prod2u_p4_normal_v3_top dut (
  20. .sys_clk(sys_clk), .host_uart_rx(host_uart_rx), .host_uart_tx(host_uart_tx),
  21. .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
  22. .motor_en_n(motor_en_n),
  23. .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
  24. .z_step(z_step), .z_dir(z_dir),
  25. .x_limit_ls(x_limit_ls), .x_limit_hs(x_limit_hs),
  26. .y_limit_ls(y_limit_ls), .y_limit_hs(y_limit_hs),
  27. .z_limit_ls(z_limit_ls), .z_limit_hs(z_limit_hs),
  28. .temp_scl(temp_scl), .temp_sda(temp_sda)
  29. );
  30. initial begin
  31. repeat (1100) @(posedge sys_clk);
  32. if (host_uart_tx !== 1'b1) $fatal(1, "UART TX is not idle");
  33. if (ptc_pwm_out !== 8'd0) $fatal(1, "PTC outputs are not off");
  34. if (fan_pwm_out !== 4'hF) $fatal(1, "FAN outputs are not inactive");
  35. if (motor_en_n !== 1'b1) $fatal(1, "motor enable is not permanently high");
  36. $display("prod2u_p4_normal_v3_top_tb PASS");
  37. $finish;
  38. end
  39. endmodule