ModOutMux.v 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date: 10:02:35 04/20/2020
  7. // Design Name:
  8. // Module Name: mult_module
  9. // Project Name:
  10. // Target Devices:
  11. // Tool versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module ModOutMux
  22. #(
  23. parameter CmdDataRegWith = 24,
  24. parameter PGenNum = 4
  25. )
  26. (
  27. input Rst_i,
  28. input Clk_i,
  29. input [CmdDataRegWith-1:0] PMeasCtrl_i,
  30. input [PGenNum-1:0] Pulses_i,
  31. input Trig0_i,
  32. input Trig1_i,
  33. output Mod_o
  34. );
  35. //================================================================================
  36. // LOCALPARAM
  37. //================================================================================
  38. // REG/WIRE
  39. reg modOut;
  40. wire pulseMeasEn = PMeasCtrl_i[0];
  41. wire intExtSel = PMeasCtrl_i[4];
  42. wire extPortSel = PMeasCtrl_i[5];
  43. wire [PGenNum-1:0] pGenSel = PMeasCtrl_i[11:8];
  44. //================================================================================
  45. // ASSIGNMENTS
  46. assign Mod_o = modOut;
  47. //================================================================================
  48. // CODING
  49. always @(*) begin
  50. if (!Rst_i) begin
  51. if (pulseMeasEn) begin
  52. if (intExtSel) begin
  53. if (extPortSel) begin
  54. modOut <= Trig1_i;
  55. end else begin
  56. modOut <= Trig0_i;
  57. end
  58. end else begin
  59. modOut <= Pulses_i[pGenSel];
  60. end
  61. end else begin
  62. modOut <= 1'b0;
  63. end
  64. end else begin
  65. modOut <= 1'b0;
  66. end
  67. end
  68. endmodule