1 module partsel_test001(input [2:0] idx, input [31:0] data, output [3:0] slice_up, slice_down);
2 wire [5:0] offset = idx << 2;
3 assign slice_up = data[offset +: 4];
4 assign slice_down = data[offset + 3 -: 4];
7 module partsel_test002 (
12 output [7:0] x1, x2, x3,
13 output [0:7] x4, x5, x6,
14 output [7:0] y1, y2, y3,
15 output [0:7] y4, y5, y6,
16 output [7:0] z1, z2, z3,
17 output [0:7] z4, z5, z6,
18 output [7:0] w1, w2, w3,
19 output [0:7] w4, w5, w6,
20 output [7:0] p1, p2, p3, p4, p5, p6,
21 output [0:7] q1, q2, q3, q4, q5, q6,
26 assign x1 = a, x2 = a + b, x3 = b;
27 assign x4 = a, x5 = a + b, x6 = b;
28 assign y1 = a[4 +: 3], y2 = a[4 +: 3] + b[4 +: 3], y3 = b[4 +: 3];
29 assign y4 = a[4 +: 3], y5 = a[4 +: 3] + b[4 +: 3], y6 = b[4 +: 3];
30 assign z1 = a[4 -: 3], z2 = a[4 -: 3] + b[4 -: 3], z3 = b[4 -: 3];
31 assign z4 = a[4 -: 3], z5 = a[4 -: 3] + b[4 -: 3], z6 = b[4 -: 3];
32 assign w1 = a[6:3], w2 = a[6:3] + b[3:6], w3 = b[3:6];
33 assign w4 = a[6:3], w5 = a[6:3] + b[3:6], w6 = b[3:6];
34 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];
35 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];
37 always @(posedge clk) begin
39 { r1, r2 } = 16'h1337 ^ {a, b};
43 r1[3:0] <= r2[0:3] ^ x1;
44 r2[4:7] <= r1[7:4] ^ x4;
47 r1[2 +: 3] <= r2[5 -: 3] + x1;
48 r2[3 +: 3] <= r1[6 -: 3] + x4;
51 r1[6 -: 3] <= r2[3 +: 3] - x1;
52 r2[7 -: 3] <= r1[4 +: 3] - x4;