/dvbt/trunk/debug/lib_rtl_rs/gmac_cell_lib.v

http://github.com/zaqwes8811/decoder-reed-solomon · Verilog · 193 lines · 37 code · 6 blank · 150 comment · 2 complexity · ce8e2fb89eea75aaf2a3021366f6f997 MD5 · raw file

  1. /*
  2. File : rtl_gmult.v // ????????
  3. Author : Lugansky Igor
  4. Date : 4/03/11
  5. Version : 0.1
  6. Abstract : ??????????-????????-??????????
  7. ? ???€? ?????(2^WIGHT)
  8. Modification History:
  9. Date By Version Change Description
  10. gmac_rtl(
  11. .clk(), .clk_ena_mac(), .aclr_mac(),
  12. .clk_ena_oreg(),
  13. .sinp(), .minp(),
  14. .gmacout()
  15. );
  16. */
  17. /**
  18. –??????? ??????€???€ ?????????, ?? ???????? ?? ?????? ????????? ???????,
  19. ??????? ???????????€ ???????? ?????????€ ?????.
  20. */
  21. `include "vc_top.v"
  22. module gmac_new2_rtl(
  23. clk, rst, clk_ena, signal_2,
  24. alpha2I,
  25. siomI, // ?????????????? ????
  26. acc_r
  27. );
  28. //parameter WIDTH = 8; // ?????? ???
  29. input clk, rst, clk_ena;
  30. // control
  31. input signal_2; // ???? ?? ?????? ?????????????
  32. // data
  33. input [`WIDTH-1:0] alpha2I;
  34. input [`WIDTH-1:0] siomI; // sigma or omega i
  35. output[`WIDTH-1:0] acc_r;
  36. // local ////
  37. wire [`WIDTH-1:0] outgmult2; // ????? ??????? ?????????€
  38. reg [`WIDTH-1:0] outmux2; // ????? ??????? ??????????????
  39. reg [`WIDTH-1:0] acc_r_tmp; // ????????????? ???????
  40. wire [`WIDTH-1:0] acc_r_tmp_tmp; // ????????????? ???????
  41. // connecting //////
  42. // ?????????? ???????????????????????
  43. generate if(`WIDTH == 8) begin
  44. gmult8_rtl label_1(
  45. .a (acc_r), // ????? ?????????€
  46. .b (alpha2I), // ??€?? ?? ?????
  47. .c (outgmult2));
  48. end
  49. endgenerate
  50. // ???????-??????????
  51. a_dff #(.WIDTH(`WIDTH)) label_2(
  52. .clk(clk), .aclr(rst), .ena(clk_ena),
  53. .data(acc_r_tmp),
  54. .q(acc_r));
  55. // mux2bus->1bus
  56. mux2bus #(.WIDTH(`WIDTH)) label_3(
  57. .sel(signal_2),
  58. .A0(outgmult2),
  59. .A1('b0), // ????? ????
  60. .Z(acc_r_tmp_tmp));
  61. // logic ///
  62. always @(acc_r_tmp_tmp or siomI) // xor ?? ?????(????????)
  63. begin
  64. acc_r_tmp = acc_r_tmp_tmp^siomI;
  65. end
  66. endmodule
  67. /*
  68. /////////////////
  69. module gmac_new_rtl(
  70. clk, rst,
  71. // control
  72. signal_1, // ???? ?? ?????????????
  73. signal_2,
  74. // data
  75. alphaI,
  76. alpha2I,
  77. siomI, // sigma or omega i
  78. resultI
  79. );
  80. parameter WIDTH = 8 // ?????? ???
  81. input clk, rst,
  82. // control
  83. input signal_1, // ???? ?? ?????????????
  84. input signal_2,
  85. // data
  86. input [WIDTH-1:0] alphaI;
  87. input [WIDTH-1:0] alpha2I;
  88. input [WIDTH-1:0] siomI; // sigma or omega i
  89. output reg [WIDTH-1:0] resultI;
  90. // local /////
  91. wire [WIDTH-1:0] outgmult1; // ????? ??????? ?????????€
  92. wire [WIDTH-1:0] outgmult2; // ???????
  93. reg [WIDTH-1:0] outmux1; // ????? ??????? ??????????????
  94. reg [WIDTH-1:0] acc_r; // ????????????? ???????
  95. reg [WIDTH-1:0] acc_r_tmp; // ????????????? ???????
  96. // ?????????? ??????????
  97. generate if(WIDTH == 8) begin
  98. gmult8_rtl label_1(
  99. .a (siomI), // ??€?? ?? ?????
  100. .b (outmux1),
  101. .c (outgmult1));
  102. gmult8_rtl label_2(
  103. .a (acc_r), // ????? ?????????€
  104. .b (alpha2I), // ??€?? ?? ?????
  105. .c (outgmult2));
  106. end
  107. endgenerate
  108. // logic //////
  109. // mux1
  110. always @(signal_1 or alphaI)
  111. begin
  112. if(signal_1 == 1) outmux1 = 1; else
  113. outmux1 = alphaI;
  114. end
  115. // mux2
  116. always @(signal_2 or outgmult1 or outgmult2)
  117. begin
  118. if(signal_2 == 1)
  119. acc_r_tmp <= outgmult1;
  120. else
  121. acc_r_tmp <= outgmult2;
  122. end
  123. // acc_r
  124. always @(posedge clk or posedge rst)
  125. begin
  126. if(rst == 1)
  127. acc_r <= 'd0;
  128. else
  129. acc_r <= acc_r_tmp; // ??????????? ????? ??????????????
  130. end
  131. always @(posedge clk)// or posedge rst)
  132. begin // ???? ?????? ???????????(??? ?????????€ ? ??????)
  133. resultI <= acc_r;
  134. end
  135. endmodule
  136. /////// old //////////
  137. module gmac_rtl(
  138. clk, clk_ena_mac, aclr_mac,
  139. clk_ena_oreg,
  140. sinp, minp,
  141. gmacout
  142. );
  143. input clk;
  144. input clk_ena_mac; // ?????????? ?????? ????????-?????????€
  145. input aclr_mac; // ????? ?????????€(?? ??????????), ? ?????? ???
  146. input clk_ena_oreg; // ?????????? ???????????€
  147. // data
  148. input [`WIGHT-1:0] sinp; // ?????? ?????? ?? ????????
  149. input [`WIGHT-1:0] minp; // ?????? ?????? ?? ??????????
  150. output reg [`WIGHT-1:0] gmacout; // ????? ?????????€
  151. // variable
  152. reg [`WIGHT-1:0] acc_r; // ???????€???
  153. wire [`WIGHT-1:0] out_gmult; //
  154. // connect gmult
  155. generate if(`WIGHT == 8)
  156. gmult8_rtl label_1(
  157. .a (acc_r),
  158. .b (minp),
  159. .c (out_gmult));
  160. endgenerate
  161. // logic //////////////
  162. // ???????? ?? ??????? ? ??????????? ?????
  163. always @(posedge clk or posedge aclr_mac)
  164. begin : akk
  165. if(aclr_mac) begin
  166. acc_r <= 'b0; // ????????? ???????€????
  167. end
  168. else
  169. if(clk_ena_mac) begin
  170. acc_r <= out_gmult^sinp;
  171. end
  172. end
  173. always @(posedge clk) // ???????? ??????? ??????????? ?????????
  174. if(clk_ena_oreg) begin : store
  175. gmacout <= acc_r;
  176. end
  177. endmodule*/