Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company: BITSILICA PRIVATE LIMITED
  4. //
  5. // Design Name: POLAE_ENCODER
  6. // Module Name: POLAR_ENCODER
  7. // Project Name: POLAR ENCODER-DECODER
  8. // Target Devices: Zynq UltraScale+ ZCU111 Evaluation Platform (xczu28dr-ffvg1517-2-e)
  9. // Tool Versions: VIVADO 2020.1
  10. // Description: RTL code for integration of all sub blocks of polar encoder
  11. //////////////////////////////////////////////////////////////////////////////////
  12. module POLAR_ENCODER
  13. #(
  14. parameter PUCCH=0, // Uplink Channel enable
  15. parameter PBCH=1, // Broadcast Channel enable
  16. parameter A=32, // Message width A if no segmentation needed, A'=A/2 if segmentation is needed.
  17. parameter P=24,
  18. parameter G=864, // Length of output
  19. parameter C=1, // Value of C=2 if segmentation need to be done otherwise C=1
  20. parameter E=G/C, // Value of E based on G and C
  21. parameter K=A+P, // Length of information+CRC width
  22. parameter n_min=5,
  23. parameter n_max=9,
  24. parameter n_1= ((E<=((9/8)*(2**(($clog2(E))-1))))&&((K/E)<(9/16)))? ($clog2(E)-1) : $clog2(E),
  25. parameter n_2= $clog2(8*K),
  26. parameter min_n1_n2= (n_1 >= n_2)? n_2 : n_1,
  27. parameter min_n1_n2_nmax = (min_n1_n2 >= n_max) ? n_max : min_n1_n2 ,
  28. parameter n=(min_n1_n2_nmax >= n_min)? min_n1_n2_nmax : n_min,
  29. parameter N=2**n,
  30. parameter ITLV=1, // Interleave flag for CRC interleaving process
  31. parameter KMAX=164 // Maximum value of K for CRC interleaving
  32. )
  33. (
  34. input clock_i, // input clock signal
  35. input reset_ni, // input reset
  36. input wire [A-1:0] msg_i, // input message bits
  37. output reg [G-1:0] msg_o // output bits
  38. );
  39. wire [K-1:0] msg_1; // output of CRC attachment
  40. wire [K-1:0] msg_2; // output of CRC scrambling
  41. wire [K-1:0] msg_x; // output of CRC interleaving
  42. wire [N-1:0] msg_3; // output of frozen insertion
  43. wire [N-1:0] msg_4; // output of encoder core
  44. wire [N-1:0] msg_5; // output of sub block interleaving
  45. wire [G-1:0] msg_6; // output of bit selection
  46. if(PBCH) begin
  47. encoder_crc_attachment_rtl #(
  48. .PUCCH( PUCCH ), // Uplink Channel enable
  49. .PBCH( PBCH ), // Broadcast Channel enable
  50. .A(A), // Message width A if no segmentation needed, A'=A/2 if segmentation is needed.
  51. .N(N)
  52. ) ENCODER_PBCH_CRC_ATTACHMENT (
  53. .clock_i(clock_i), // System clock
  54. .reset_ni(reset_ni), // System reset,active low synchronous
  55. .msg_i( msg_i), // Input message bits
  56. .msg_o( msg_1) // total message = message input + CRC bits
  57. );
  58. encoder_crc_interleaving_rtl#(
  59. .K(K),
  60. .ITLV(ITLV),
  61. .KMAX(KMAX)
  62. ) ENCODER_PBCH_CRC_INTERLEAVING (
  63. .clock_i(clock_i), // system clock
  64. .reset_ni(reset_ni), // active low, synchronous reset
  65. .msg_i( msg_1), // input message to be interleaved
  66. .msg_o( msg_2) // output crc interleaved message
  67. );
  68. encoder_frozen_bit_insertion_rtl1 #(
  69. .N(N), // length of information+CRC+Frozen bits
  70. .K(K) // length of information+CRC bits
  71. ) ENCODER_PBCH_FROZEN_INSERTION (
  72. .clock_i(clock_i), // system clock
  73. .reset_ni(reset_ni), // active low synchronous reset
  74. .msg_i( msg_2), // input information+CRC bits
  75. .msg_o(msg_3) // information+CRC+frozen bits
  76. );
  77. encoder_core_rtl #(
  78. .N(N) // length of input and output messages for encoder_core_rtl
  79. ) ENCODER_PBCH_CORE (
  80. .clock_i(clock_i), // system clock
  81. .reset_ni(reset_ni), // active low, synchronous reset
  82. .msg_i( msg_3), // input message to be encoded
  83. .msg_o(msg_4) // output encoded codeword
  84. );
  85. encoder_sub_block_interleaving_rtl #(
  86. .N( N) // input and output sequence length
  87. ) ENCODER_PBCH_SUB_BLOCK_INTERLEAVING (
  88. .clock_i(clock_i),
  89. .reset_ni(reset_ni),
  90. .msg_i(msg_4), // input message for sub block interleaver
  91. .msg_o(msg_5) // output message after sub block interleaving
  92. );
  93. encoder_bit_selection_rtl #(
  94. .K(K),
  95. .G(G),
  96. .C(C),
  97. .E(E),
  98. .N(N)
  99. ) ENCODER_PBCH_BIT_SELECTION (
  100. .clock_i(clock_i), // system clock
  101. .reset_ni(reset_ni), // active low, synchronous reset
  102. .msg_i(msg_5), // input message for bit selection
  103. .msg_o(msg_6) // output message after bit selection
  104. );
  105. end
  106. always@(posedge clock_i) // registering output with respect to clock
  107. if(!reset_ni)
  108. msg_o <=0;
  109. else
  110. begin
  111. msg_o <=msg_6;
  112. end
  113. endmodule