StartAfterGainSel.v 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer: Churbanov S.
  5. //
  6. // Create Date: 15:24:31 08/20/2019
  7. // Design Name:
  8. // Module Name:
  9. // Project Name:
  10. // Target Devices:
  11. // Tool versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.02 - File Modified
  18. // Additional Comments: 16.09.2019 file modified in assotiate with task.
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module StartAfterGainSel
  22. #(
  23. parameter ChNum = 4
  24. )
  25. (
  26. input Rst_i,
  27. input [ChNum-1:0] MeasStart_i,
  28. input [ChNum-1:0] GainCtrl_i,
  29. output MeasStart_o
  30. );
  31. //================================================================================
  32. // LOCALPARAMS
  33. //================================================================================
  34. // REG/WIRE
  35. reg measStart;
  36. //================================================================================
  37. // ASSIGNMENTS
  38. assign MeasStart_o = measStart;
  39. //================================================================================
  40. // CODING
  41. always @(*) begin
  42. if (!Rst_i) begin
  43. case(GainCtrl_i)
  44. 4'd0: begin
  45. measStart = &MeasStart_i;
  46. end
  47. 4'd1: begin
  48. measStart = MeasStart_i[0];
  49. end
  50. 4'd2: begin
  51. measStart = MeasStart_i[1];
  52. end
  53. 4'd3: begin
  54. measStart = MeasStart_i[0]&MeasStart_i[1];
  55. end
  56. 4'd4: begin
  57. measStart = &MeasStart_i[2];
  58. end
  59. 4'd5: begin
  60. measStart = MeasStart_i[0]&MeasStart_i[2];
  61. end
  62. 4'd6: begin
  63. measStart = MeasStart_i[1]&MeasStart_i[2];
  64. end
  65. 4'd7: begin
  66. measStart = MeasStart_i[0]&MeasStart_i[1]&MeasStart_i[2];
  67. end
  68. 4'd8: begin
  69. measStart = MeasStart_i[3];
  70. end
  71. 4'd9: begin
  72. measStart = MeasStart_i[0]&MeasStart_i[3];
  73. end
  74. 4'd10: begin
  75. measStart = MeasStart_i[1]&MeasStart_i[3];
  76. end
  77. 4'd11: begin
  78. measStart = MeasStart_i[0]&MeasStart_i[1]&MeasStart_i[3];
  79. end
  80. 4'd12: begin
  81. measStart = MeasStart_i[2]&MeasStart_i[3];
  82. end
  83. 4'd13: begin
  84. measStart = MeasStart_i[0]&MeasStart_i[2]&MeasStart_i[3];
  85. end
  86. 4'd14: begin
  87. measStart = MeasStart_i[1]&MeasStart_i[2]&MeasStart_i[3];
  88. end
  89. 4'd15: begin
  90. measStart = &MeasStart_i;
  91. end
  92. endcase
  93. end
  94. end
  95. endmodule