SHARE
TWEET

Untitled

a guest Jun 29th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module \$lut (A, Y);
  2.  
  3. parameter WIDTH = 0;
  4. parameter LUT = 0;
  5.  
  6. input [WIDTH-1:0] A;
  7. output Y;
  8.  
  9. generate
  10.     if (WIDTH == 1) begin
  11.         MISTRAL_LUT3 #(.LUT({8{LUT[0]}})) _TECHMAP_REPLACE_(
  12.             .A(1'b1), .B(1'b1), .C(A[0]), .Q(Y)
  13.         );
  14.     end else
  15.     if (WIDTH == 2) begin
  16.         MISTRAL_LUT3 #(.LUT({4{LUT[1:0]}})) _TECHMAP_REPLACE_(
  17.             .A(1'b1), .B(A[1]), .C(A[0]), .Q(Y)
  18.         );
  19.     end else
  20.     if (WIDTH == 3) begin
  21.         MISTRAL_LUT3 #(.LUT({2{LUT[3:0]}})) _TECHMAP_REPLACE_(
  22.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(Y)
  23.         );
  24.     end else
  25.     if (WIDTH == 4) begin
  26.         MISTRAL_LUT4 #(.LUT(LUT)) _TECHMAP_REPLACE_(
  27.             .A(A[3]), .B(A[2]), .C(A[1]), .D(A[0]), .Q(Y)
  28.         );
  29.     end else
  30.     if (WIDTH == 5) begin
  31.         wire lut3_0_out, lut3_1_out;
  32.         wire lut4_0_out, lut4_1_out;
  33.  
  34.         MISTRAL_LUT3 #(.LUT(LUT[7:0])) lut3_0(
  35.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(lut3_0_out)
  36.         );
  37.         MISTRAL_LUT3 #(.LUT(LUT[15:8])) lut3_1(
  38.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(lut3_1_out)
  39.         );
  40.         MISTRAL_LUT4 #(.LUT(LUT[31:16])) lut4_1(
  41.             .A(A[3]), .B(A[2]), .C(A[1]), .D(A[0]), .Q(lut4_0_out)
  42.         );
  43.  
  44.         MISTRAL_MUX2 lut33_mux(
  45.             .A(lut3_0_out), .B(lut3_1_out), .S(A[3]), .Q(lut4_1_out)
  46.         );
  47.         MISTRAL_MUX2 lut44_mux(
  48.             .A(lut4_0_out), .B(lut4_1_out), .S(A[4]), .Q(Y)
  49.         );
  50.     end else
  51.     if (WIDTH == 6) begin
  52.         wire lut3_0_out;
  53.         wire lut3_1_out;
  54.         wire lut3_2_out;
  55.         wire lut3_3_out;
  56.         wire lut4_0_out;
  57.         wire lut4_1_out;
  58.         wire lut4_2_out;
  59.         wire lut4_3_out;
  60.         wire lut5_0_out;
  61.         wire lut5_1_out;
  62.  
  63.         MISTRAL_LUT3 #(.LUT(LUT[7:0])) lut3_0(
  64.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(lut3_0_out)
  65.         );
  66.         MISTRAL_LUT3 #(.LUT(LUT[15:8])) lut3_1(
  67.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(lut3_1_out)
  68.         );
  69.         MISTRAL_LUT4 #(.LUT(LUT[31:16])) lut4_1(
  70.             .A(A[3]), .B(A[2]), .C(A[1]), .D(A[0]), .Q(lut4_0_out)
  71.         );
  72.  
  73.         MISTRAL_MUX2 lut33_mux0(
  74.             .A(lut3_0_out), .B(lut3_1_out), .S(A[3]), .Q(lut4_1_out)
  75.         );
  76.         MISTRAL_MUX2 lut44_mux0(
  77.             .A(lut4_0_out), .B(lut4_1_out), .S(A[4]), .Q(lut5_0_out)
  78.         );
  79.  
  80.         MISTRAL_LUT3 #(.LUT(LUT[39:32])) lut3_2(
  81.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(lut3_2_out)
  82.         );
  83.         MISTRAL_LUT3 #(.LUT(LUT[47:40])) lut3_3(
  84.             .A(A[2]), .B(A[1]), .C(A[0]), .Q(lut3_3_out)
  85.         );
  86.         MISTRAL_LUT4 #(.LUT(LUT[63:48])) lut4_3(
  87.             .A(A[3]), .B(A[2]), .C(A[1]), .D(A[0]), .Q(lut4_2_out)
  88.         );
  89.  
  90.         MISTRAL_MUX2 lut33_mux1(
  91.             .A(lut3_2_out), .B(lut3_3_out), .S(A[3]), .Q(lut4_3_out)
  92.         );
  93.         MISTRAL_MUX2 lut44_mux1(
  94.             .A(lut4_0_out), .B(lut4_1_out), .S(A[4]), .Q(lut5_1_out)
  95.         );
  96.  
  97.         MISTRAL_MUX2 lut55_mux(
  98.             .A(lut5_0_out), .B(lut5_1_out), .S(A[5]), .Q(Y)
  99.         );
  100.     end else begin
  101.         wire _TECHMAP_FAIL_ = 1'b1;
  102.     end
  103. endgenerate
  104. endmodule
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top