module partsel_test001(input [2:0] idx, input [31:0] data, output [3:0] slice_up, slice_down); wire [5:0] offset = idx << 2; assign slice_up = data[offset +: 4]; assign slice_down = data[offset + 3 -: 4]; endmodule module partsel_test002 ( input clk, rst, input [7:0] a, input [0:7] b, input [1:0] s, output [7:0] x1, x2, x3, output [0:7] x4, x5, x6, output [7:0] y1, y2, y3, output [0:7] y4, y5, y6, output [7:0] z1, z2, z3, output [0:7] z4, z5, z6, output [7:0] w1, w2, w3, output [0:7] w4, w5, w6, output [7:0] p1, p2, p3, p4, p5, p6, output [0:7] q1, q2, q3, q4, q5, q6, output reg [7:0] r1, output reg [0:7] r2 ); assign x1 = a, x2 = a + b, x3 = b; assign x4 = a, x5 = a + b, x6 = b; assign y1 = a[4 +: 3], y2 = a[4 +: 3] + b[4 +: 3], y3 = b[4 +: 3]; assign y4 = a[4 +: 3], y5 = a[4 +: 3] + b[4 +: 3], y6 = b[4 +: 3]; assign z1 = a[4 -: 3], z2 = a[4 -: 3] + b[4 -: 3], z3 = b[4 -: 3]; assign z4 = a[4 -: 3], z5 = a[4 -: 3] + b[4 -: 3], z6 = b[4 -: 3]; assign w1 = a[6:3], w2 = a[6:3] + b[3:6], w3 = b[3:6]; assign w4 = a[6:3], w5 = a[6:3] + b[3:6], w6 = b[3:6]; assign p1 = a[s], p2 = b[s], p3 = a[s+2 +: 2], p4 = b[s+2 +: 2], p5 = a[s+2 -: 2], p6 = b[s+2 -: 2]; assign q1 = a[s], q2 = b[s], q3 = a[s+2 +: 2], q4 = b[s+2 +: 2], q5 = a[s+2 -: 2], q6 = b[s+2 -: 2]; always @(posedge clk) begin if (rst) begin { r1, r2 } = 16'h1337 ^ {a, b}; end else begin case (s) 0: begin r1[3:0] <= r2[0:3] ^ x1; r2[4:7] <= r1[7:4] ^ x4; end 1: begin r1[2 +: 3] <= r2[5 -: 3] + x1; r2[3 +: 3] <= r1[6 -: 3] + x4; end 2: begin r1[6 -: 3] <= r2[3 +: 3] - x1; r2[7 -: 3] <= r1[4 +: 3] - x4; end 3: begin r1 <= r2; r2 <= r1; end endcase end end endmodule ibs/common/gate2lut.v?id=5f88c218b58cabc20f001c4bf77733670305864e'>diffstats
path: root/techlibs/common/gate2lut.v
blob: 15cea3d8d5b0d00f0aca2a5a827a4f3168f8941d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
(* techmap_celltype = "$_NOT_" *)
module _90_lut_not (A, Y);
    input A;
    output Y;

    wire [`LUT_WIDTH-1:0] AA;
    assign AA = {A};

    \$lut #(
        .WIDTH(`LUT_WIDTH),
        .LUT(4'b01)
    ) lut (
        .A(AA),
        .Y(Y)
    );
endmodule

(* techmap_celltype = "$_OR_" *)
module _90_lut_or (A, B, Y);
    input A, B;
    output Y;

    wire [`LUT_WIDTH-1:0] AA;
    assign AA = {B, A};

    \$lut #(
        .WIDTH(`LUT_WIDTH),
        .LUT(4'b1110)
    ) lut (
        .A(AA),
        .Y(Y)
    );
endmodule

(* techmap_celltype = "$_AND_" *)
module _90_lut_and (A, B, Y);
    input A, B;
    output Y;

    wire [`LUT_WIDTH-1:0] AA;
    assign AA = {B, A};

    \$lut #(
        .WIDTH(`LUT_WIDTH),
        .LUT(4'b1000)
    ) lut (
        .A(AA),
        .Y(Y)
    );
endmodule

(* techmap_celltype = "$_XOR_" *)
module _90_lut_xor (A, B, Y);
    input A, B;
    output Y;

    wire [`LUT_WIDTH-1:0] AA;
    assign AA = {B, A};

    \$lut #(
        .WIDTH(`LUT_WIDTH),
        .LUT(4'b0110)
    ) lut (
        .A(AA),
        .Y(Y)
    );
endmodule

(* techmap_celltype = "$_MUX_" *)
module _90_lut_mux (A, B, S, Y);
    input A, B, S;
    output Y;

    wire [`LUT_WIDTH-1:0] AA;
    assign AA = {S, B, A};

    \$lut #(
        .WIDTH(`LUT_WIDTH),
        //     A 1010 1010
        //     B 1100 1100
        //     S 1111 0000
        .LUT(8'b 1100_1010)
    ) lut (
        .A(AA),
        .Y(Y)
    );
endmodule