From f8459f247878bde6ac24d78ed34b5db1f9900114 Mon Sep 17 00:00:00 2001 From: FallenSigh Date: Thu, 25 Jun 2026 20:40:08 +0800 Subject: [PATCH] Hardware CRC32 engine in matmul IP: 4-byte/cycle combinational, register at 0x010 --- .../check.jsonl | 1 + .../implement.jsonl | 1 + .../prd.md | 96 ++ .../task.json | 26 + rtl/ip/matmul/matmul_axi_slave.v | 185 ++- sdk/axi_ram.mif | 1162 +++++++---------- sdk/software/examples/asm/user-sample.c | 69 +- sdk/user-sample.bin | Bin 41644 -> 40764 bytes 8 files changed, 787 insertions(+), 753 deletions(-) create mode 100644 .trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/check.jsonl create mode 100644 .trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/implement.jsonl create mode 100644 .trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/prd.md create mode 100644 .trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/task.json diff --git a/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/check.jsonl b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/check.jsonl new file mode 100644 index 0000000..cec870f --- /dev/null +++ b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/check.jsonl @@ -0,0 +1 @@ +{"file": ".trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/prd.md", "reason": "PRD with acceptance criteria for verification"} diff --git a/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/implement.jsonl b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/implement.jsonl new file mode 100644 index 0000000..9290c29 --- /dev/null +++ b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/implement.jsonl @@ -0,0 +1 @@ +{"file": ".trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/prd.md", "reason": "PRD with CRC32 design and requirements"} diff --git a/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/prd.md b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/prd.md new file mode 100644 index 0000000..1b0fd15 --- /dev/null +++ b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/prd.md @@ -0,0 +1,96 @@ +# Hardware CRC32 Engine in Matmul IP + +## Goal + +Replace software CRC32 (80.8% of total time, ~396ms for 5000 groups) with a hardware CRC32 engine embedded in the matmul IP. The CRC32 streams through during DMA reads of C result data, near-zero overhead. + +**Expected**: total time drops from 490ms → ~94ms, score from 51.66 → ~69. + +## Requirements + +1. **CRC32 table**: 256×32 LUTRAM, IEEE 802.3 polynomial 0xEDB88320, identical to software table +2. **Engine**: 4-byte/cycle combinational CRC32, triggered only when AXI R_CH reads C memory (B0_C/B1_C) +3. **Register** at offset `0x010`: + - Read: returns `crc_reg ^ 0xFFFFFFFF` (final CRC32) + - Write any value: resets CRC to `0xFFFFFFFF` +4. **Software**: remove `crc32_table[]`, `compute_crc32()`, and `CRC32 printf` call + - Replace with `REG_RD(MATMUL_CRC)` after all groups complete +5. **No regressions**: existing AXI read/write, compute engine, DMA, interrupts unchanged +6. **Lint clean**, Vivado synthesis passes at 33MHz + +## Acceptance Criteria + +- [ ] **CRC match**: hardware CRC32 matches software CRC32 for 10-group and 5000-group tests +- [ ] **Correct output**: `MATMUL_CRC32=d53cd879` (5000 groups, unchanged since matmul compute is identical) +- [ ] **Timing improvement**: CRC32 component drops from ~396ms to <1ms +- [ ] **No timing violations** in Vivado (WNS passes) +- [ ] **No DSP** used (DSP utilization = 0) +- [ ] **Lint clean** + +## Definition of Done + +- [ ] `matmul_axi_slave.v`: CRC engine added, register at 0x010 +- [ ] `user-sample.c`: software CRC removed, hardware CRC read +- [ ] Simulation verifies CRC match (10 groups) +- [ ] Lint + compile pass +- [ ] Synced to regional-submit + +## Technical Approach + +### Hardware + +**CRC32 engine** in `matmul_axi_slave.v`: + +- LUTRAM table: 256 entries × 32 bits, initialized via `initial` block +- 4-byte combinational datapath: `t0→c0→t1→c1→t2→c2→t3→crc_next` +- Triggered when AXI read address hits B0_C or B1_C ranges +- Registered on `posedge clk` when `s_axi_rvalid && s_axi_rready` +- Reset on write to 0x010 (CRC register) + +```verilog +// Simplified combinational chain: +t0 = TABLE[(crc_reg[7:0] ^ rdata[7:0])]; +c0 = t0 ^ {8'h00, crc_reg[31:8]}; +t1 = TABLE[(c0[7:0] ^ rdata[15:8])]; +c1 = t1 ^ {8'h00, c0[31:8]}; +t2 = TABLE[(c1[7:0] ^ rdata[23:16])]; +c2 = t2 ^ {8'h00, c1[31:8]}; +t3 = TABLE[(c2[7:0] ^ rdata[31:24])]; +crc_next = t3 ^ {8'h00, c2[31:8]}; +``` + +**Register map**: +- `0x010`: CRC_VAL (RO returns final CRC; WO resets CRC to 0xFFFFFFFF) + +### Software + +```c +// Before main loop: reset CRC +REG_WR(MATMUL_CRC_CTRL, 1); // 0xbf500010 + +// After all DMA + compute: +crc = REG_RD(MATMUL_CRC_CTRL); +printf("MATMUL_CRC32=%08lx\n", (unsigned long)crc); +``` + +Delete: `crc32_table[256]`, `compute_crc32()`, `t_crc32` timing variables. + +## Out of Scope + +- Pipelined CRC (combinational at 33MHz is sufficient; pipeline only if timing fails) +- CRC32 for FFT data +- Other polynomial CRC variants + +## Technical Notes + +### Files to modify +- `rtl/ip/matmul/matmul_axi_slave.v` — add CRC engine + register +- `sdk/software/examples/asm/user-sample.c` — remove software CRC, add hardware CRC read + +### Timing expectations +- CRC datapath: 4 LUTRAM reads + 4 XORs in combinational chain +- At 33MHz (30ns cycle), critical path ~15-20ns on LS FPGA → should meet timing +- If Vivado reports WNS violation, fall back to 2-stage pipeline (2 bytes per stage) + +### CRC32 byte order verification +The software processes: byte0 (LSB), byte1, byte2, byte3 (MSB). The hardware must match this order. diff --git a/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/task.json b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/task.json new file mode 100644 index 0000000..71015be --- /dev/null +++ b/.trellis/tasks/06-25-hardware-crc32-engine-in-matmul-ip/task.json @@ -0,0 +1,26 @@ +{ + "id": "hardware-crc32-engine-in-matmul-ip", + "name": "hardware-crc32-engine-in-matmul-ip", + "title": "Hardware CRC32 engine in matmul IP", + "description": "", + "status": "in_progress", + "dev_type": null, + "scope": null, + "package": null, + "priority": "P2", + "creator": "fallensigh", + "assignee": "fallensigh", + "createdAt": "2026-06-25", + "completedAt": null, + "branch": null, + "base_branch": "no-fft", + "worktree_path": null, + "commit": null, + "pr_url": null, + "subtasks": [], + "children": [], + "parent": null, + "relatedFiles": [], + "notes": "", + "meta": {} +} \ No newline at end of file diff --git a/rtl/ip/matmul/matmul_axi_slave.v b/rtl/ip/matmul/matmul_axi_slave.v index 081477b..6b27649 100644 --- a/rtl/ip/matmul/matmul_axi_slave.v +++ b/rtl/ip/matmul/matmul_axi_slave.v @@ -154,6 +154,173 @@ module matmul_axi_slave ( end endfunction + // ========================================== + // CRC32 Engine (IEEE 802.3, polynomial 0xEDB88320) + // ========================================== + localparam ADDR_CRC = 12'h010; + + reg [31:0] crc32_table [0:255]; + reg [31:0] crc_reg; + + // Stream CRC: triggered when AXI reads C results + reg [31:0] crc_stream_data; + reg crc_stream_valid; + + wire [31:0] crc_t0, crc_c0, crc_t1, crc_c1, crc_t2, crc_c2, crc_t3, crc_next; + assign crc_t0 = crc32_table[(crc_reg[7:0] ^ crc_stream_data[7:0])]; + assign crc_c0 = crc_t0 ^ {8'h00, crc_reg[31:8]}; + assign crc_t1 = crc32_table[(crc_c0[7:0] ^ crc_stream_data[15:8])]; + assign crc_c1 = crc_t1 ^ {8'h00, crc_c0[31:8]}; + assign crc_t2 = crc32_table[(crc_c1[7:0] ^ crc_stream_data[23:16])]; + assign crc_c2 = crc_t2 ^ {8'h00, crc_c1[31:8]}; + assign crc_t3 = crc32_table[(crc_c2[7:0] ^ crc_stream_data[31:24])]; + assign crc_next = crc_t3 ^ {8'h00, crc_c2[31:8]}; + + // CRC32 Table Initialization (IEEE 802.3 reflected) + initial begin + crc32_table[0 ] = 32'h00000000; crc32_table[1 ] = 32'h77073096; + crc32_table[2 ] = 32'hEE0E612C; crc32_table[3 ] = 32'h990951BA; + crc32_table[4 ] = 32'h076DC419; crc32_table[5 ] = 32'h706AF48F; + crc32_table[6 ] = 32'hE963A535; crc32_table[7 ] = 32'h9E6495A3; + crc32_table[8 ] = 32'h0EDB8832; crc32_table[9 ] = 32'h79DCB8A4; + crc32_table[10 ] = 32'hE0D5E91E; crc32_table[11 ] = 32'h97D2D988; + crc32_table[12 ] = 32'h09B64C2B; crc32_table[13 ] = 32'h7EB17CBD; + crc32_table[14 ] = 32'hE7B82D07; crc32_table[15 ] = 32'h90BF1D91; + crc32_table[16 ] = 32'h1DB71064; crc32_table[17 ] = 32'h6AB020F2; + crc32_table[18 ] = 32'hF3B97148; crc32_table[19 ] = 32'h84BE41DE; + crc32_table[20 ] = 32'h1ADAD47D; crc32_table[21 ] = 32'h6DDDE4EB; + crc32_table[22 ] = 32'hF4D4B551; crc32_table[23 ] = 32'h83D385C7; + crc32_table[24 ] = 32'h136C9856; crc32_table[25 ] = 32'h646BA8C0; + crc32_table[26 ] = 32'hFD62F97A; crc32_table[27 ] = 32'h8A65C9EC; + crc32_table[28 ] = 32'h14015C4F; crc32_table[29 ] = 32'h63066CD9; + crc32_table[30 ] = 32'hFA0F3D63; crc32_table[31 ] = 32'h8D080DF5; + crc32_table[32 ] = 32'h3B6E20C8; crc32_table[33 ] = 32'h4C69105E; + crc32_table[34 ] = 32'hD56041E4; crc32_table[35 ] = 32'hA2677172; + crc32_table[36 ] = 32'h3C03E4D1; crc32_table[37 ] = 32'h4B04D447; + crc32_table[38 ] = 32'hD20D85FD; crc32_table[39 ] = 32'hA50AB56B; + crc32_table[40 ] = 32'h35B5A8FA; crc32_table[41 ] = 32'h42B2986C; + crc32_table[42 ] = 32'hDBBBC9D6; crc32_table[43 ] = 32'hACBCF940; + crc32_table[44 ] = 32'h32D86CE3; crc32_table[45 ] = 32'h45DF5C75; + crc32_table[46 ] = 32'hDCD60DCF; crc32_table[47 ] = 32'hABD13D59; + crc32_table[48 ] = 32'h26D930AC; crc32_table[49 ] = 32'h51DE003A; + crc32_table[50 ] = 32'hC8D75180; crc32_table[51 ] = 32'hBFD06116; + crc32_table[52 ] = 32'h21B4F4B5; crc32_table[53 ] = 32'h56B3C423; + crc32_table[54 ] = 32'hCFBA9599; crc32_table[55 ] = 32'hB8BDA50F; + crc32_table[56 ] = 32'h2802B89E; crc32_table[57 ] = 32'h5F058808; + crc32_table[58 ] = 32'hC60CD9B2; crc32_table[59 ] = 32'hB10BE924; + crc32_table[60 ] = 32'h2F6F7C87; crc32_table[61 ] = 32'h58684C11; + crc32_table[62 ] = 32'hC1611DAB; crc32_table[63 ] = 32'hB6662D3D; + crc32_table[64 ] = 32'h76DC4190; crc32_table[65 ] = 32'h01DB7106; + crc32_table[66 ] = 32'h98D220BC; crc32_table[67 ] = 32'hEFD5102A; + crc32_table[68 ] = 32'h71B18589; crc32_table[69 ] = 32'h06B6B51F; + crc32_table[70 ] = 32'h9FBFE4A5; crc32_table[71 ] = 32'hE8B8D433; + crc32_table[72 ] = 32'h7807C9A2; crc32_table[73 ] = 32'h0F00F934; + crc32_table[74 ] = 32'h9609A88E; crc32_table[75 ] = 32'hE10E9818; + crc32_table[76 ] = 32'h7F6A0DBB; crc32_table[77 ] = 32'h086D3D2D; + crc32_table[78 ] = 32'h91646C97; crc32_table[79 ] = 32'hE6635C01; + crc32_table[80 ] = 32'h6B6B51F4; crc32_table[81 ] = 32'h1C6C6162; + crc32_table[82 ] = 32'h856530D8; crc32_table[83 ] = 32'hF262004E; + crc32_table[84 ] = 32'h6C0695ED; crc32_table[85 ] = 32'h1B01A57B; + crc32_table[86 ] = 32'h8208F4C1; crc32_table[87 ] = 32'hF50FC457; + crc32_table[88 ] = 32'h65B0D9C6; crc32_table[89 ] = 32'h12B7E950; + crc32_table[90 ] = 32'h8BBEB8EA; crc32_table[91 ] = 32'hFCB9887C; + crc32_table[92 ] = 32'h62DD1DDF; crc32_table[93 ] = 32'h15DA2D49; + crc32_table[94 ] = 32'h8CD37CF3; crc32_table[95 ] = 32'hFBD44C65; + crc32_table[96 ] = 32'h4DB26158; crc32_table[97 ] = 32'h3AB551CE; + crc32_table[98 ] = 32'hA3BC0074; crc32_table[99 ] = 32'hD4BB30E2; + crc32_table[100] = 32'h4ADFA541; crc32_table[101] = 32'h3DD895D7; + crc32_table[102] = 32'hA4D1C46D; crc32_table[103] = 32'hD3D6F4FB; + crc32_table[104] = 32'h4369E96A; crc32_table[105] = 32'h346ED9FC; + crc32_table[106] = 32'hAD678846; crc32_table[107] = 32'hDA60B8D0; + crc32_table[108] = 32'h44042D73; crc32_table[109] = 32'h33031DE5; + crc32_table[110] = 32'hAA0A4C5F; crc32_table[111] = 32'hDD0D7CC9; + crc32_table[112] = 32'h5005713C; crc32_table[113] = 32'h270241AA; + crc32_table[114] = 32'hBE0B1010; crc32_table[115] = 32'hC90C2086; + crc32_table[116] = 32'h5768B525; crc32_table[117] = 32'h206F85B3; + crc32_table[118] = 32'hB966D409; crc32_table[119] = 32'hCE61E49F; + crc32_table[120] = 32'h5EDEF90E; crc32_table[121] = 32'h29D9C998; + crc32_table[122] = 32'hB0D09822; crc32_table[123] = 32'hC7D7A8B4; + crc32_table[124] = 32'h59B33D17; crc32_table[125] = 32'h2EB40D81; + crc32_table[126] = 32'hB7BD5C3B; crc32_table[127] = 32'hC0BA6CAD; + crc32_table[128] = 32'hEDB88320; crc32_table[129] = 32'h9ABFB3B6; + crc32_table[130] = 32'h03B6E20C; crc32_table[131] = 32'h74B1D29A; + crc32_table[132] = 32'hEAD54739; crc32_table[133] = 32'h9DD277AF; + crc32_table[134] = 32'h04DB2615; crc32_table[135] = 32'h73DC1683; + crc32_table[136] = 32'hE3630B12; crc32_table[137] = 32'h94643B84; + crc32_table[138] = 32'h0D6D6A3E; crc32_table[139] = 32'h7A6A5AA8; + crc32_table[140] = 32'hE40ECF0B; crc32_table[141] = 32'h9309FF9D; + crc32_table[142] = 32'h0A00AE27; crc32_table[143] = 32'h7D079EB1; + crc32_table[144] = 32'hF00F9344; crc32_table[145] = 32'h8708A3D2; + crc32_table[146] = 32'h1E01F268; crc32_table[147] = 32'h6906C2FE; + crc32_table[148] = 32'hF762575D; crc32_table[149] = 32'h806567CB; + crc32_table[150] = 32'h196C3671; crc32_table[151] = 32'h6E6B06E7; + crc32_table[152] = 32'hFED41B76; crc32_table[153] = 32'h89D32BE0; + crc32_table[154] = 32'h10DA7A5A; crc32_table[155] = 32'h67DD4ACC; + crc32_table[156] = 32'hF9B9DF6F; crc32_table[157] = 32'h8EBEEFF9; + crc32_table[158] = 32'h17B7BE43; crc32_table[159] = 32'h60B08ED5; + crc32_table[160] = 32'hD6D6A3E8; crc32_table[161] = 32'hA1D1937E; + crc32_table[162] = 32'h38D8C2C4; crc32_table[163] = 32'h4FDFF252; + crc32_table[164] = 32'hD1BB67F1; crc32_table[165] = 32'hA6BC5767; + crc32_table[166] = 32'h3FB506DD; crc32_table[167] = 32'h48B2364B; + crc32_table[168] = 32'hD80D2BDA; crc32_table[169] = 32'hAF0A1B4C; + crc32_table[170] = 32'h36034AF6; crc32_table[171] = 32'h41047A60; + crc32_table[172] = 32'hDF60EFC3; crc32_table[173] = 32'hA867DF55; + crc32_table[174] = 32'h316E8EEF; crc32_table[175] = 32'h4669BE79; + crc32_table[176] = 32'hCB61B38C; crc32_table[177] = 32'hBC66831A; + crc32_table[178] = 32'h256FD2A0; crc32_table[179] = 32'h5268E236; + crc32_table[180] = 32'hCC0C7795; crc32_table[181] = 32'hBB0B4703; + crc32_table[182] = 32'h220216B9; crc32_table[183] = 32'h5505262F; + crc32_table[184] = 32'hC5BA3BBE; crc32_table[185] = 32'hB2BD0B28; + crc32_table[186] = 32'h2BB45A92; crc32_table[187] = 32'h5CB36A04; + crc32_table[188] = 32'hC2D7FFA7; crc32_table[189] = 32'hB5D0CF31; + crc32_table[190] = 32'h2CD99E8B; crc32_table[191] = 32'h5BDEAE1D; + crc32_table[192] = 32'h9B64C2B0; crc32_table[193] = 32'hEC63F226; + crc32_table[194] = 32'h756AA39C; crc32_table[195] = 32'h026D930A; + crc32_table[196] = 32'h9C0906A9; crc32_table[197] = 32'hEB0E363F; + crc32_table[198] = 32'h72076785; crc32_table[199] = 32'h05005713; + crc32_table[200] = 32'h95BF4A82; crc32_table[201] = 32'hE2B87A14; + crc32_table[202] = 32'h7BB12BAE; crc32_table[203] = 32'h0CB61B38; + crc32_table[204] = 32'h92D28E9B; crc32_table[205] = 32'hE5D5BE0D; + crc32_table[206] = 32'h7CDCEFB7; crc32_table[207] = 32'h0BDBDF21; + crc32_table[208] = 32'h86D3D2D4; crc32_table[209] = 32'hF1D4E242; + crc32_table[210] = 32'h68DDB3F8; crc32_table[211] = 32'h1FDA836E; + crc32_table[212] = 32'h81BE16CD; crc32_table[213] = 32'hF6B9265B; + crc32_table[214] = 32'h6FB077E1; crc32_table[215] = 32'h18B74777; + crc32_table[216] = 32'h88085AE6; crc32_table[217] = 32'hFF0F6A70; + crc32_table[218] = 32'h66063BCA; crc32_table[219] = 32'h11010B5C; + crc32_table[220] = 32'h8F659EFF; crc32_table[221] = 32'hF862AE69; + crc32_table[222] = 32'h616BFFD3; crc32_table[223] = 32'h166CCF45; + crc32_table[224] = 32'hA00AE278; crc32_table[225] = 32'hD70DD2EE; + crc32_table[226] = 32'h4E048354; crc32_table[227] = 32'h3903B3C2; + crc32_table[228] = 32'hA7672661; crc32_table[229] = 32'hD06016F7; + crc32_table[230] = 32'h4969474D; crc32_table[231] = 32'h3E6E77DB; + crc32_table[232] = 32'hAED16A4A; crc32_table[233] = 32'hD9D65ADC; + crc32_table[234] = 32'h40DF0B66; crc32_table[235] = 32'h37D83BF0; + crc32_table[236] = 32'hA9BCAE53; crc32_table[237] = 32'hDEBB9EC5; + crc32_table[238] = 32'h47B2CF7F; crc32_table[239] = 32'h30B5FFE9; + crc32_table[240] = 32'hBDBDF21C; crc32_table[241] = 32'hCABAC28A; + crc32_table[242] = 32'h53B39330; crc32_table[243] = 32'h24B4A3A6; + crc32_table[244] = 32'hBAD03605; crc32_table[245] = 32'hCDD70693; + crc32_table[246] = 32'h54DE5729; crc32_table[247] = 32'h23D967BF; + crc32_table[248] = 32'hB3667A2E; crc32_table[249] = 32'hC4614AB8; + crc32_table[250] = 32'h5D681B02; crc32_table[251] = 32'h2A6F2B94; + crc32_table[252] = 32'hB40BBE37; crc32_table[253] = 32'hC30C8EA1; + crc32_table[254] = 32'h5A05DF1B; crc32_table[255] = 32'h2D02EF8D; + end + + // CRC register update: stream when reading C data, reset on write + always @(posedge clk) begin + if (!resetn) begin + crc_reg <= 32'hFFFFFFFF; + crc_stream_valid <= 1'b0; + end else begin + if (crc_stream_valid) + crc_reg <= crc_next; + else + crc_stream_valid <= 1'b0; + end + end + // ========================================== // AXI Write 通道逻辑 (支持 INCR Burst) // ========================================== @@ -220,8 +387,11 @@ module matmul_axi_slave ( if (s_axi_wdata[1]) req_1 <= 1'b1; // 启动 Bank 1 end else if (w_offset == ADDR_STATUS) begin - if (s_axi_wdata[1]) done <= 1'b0; // 写 1 清零 Done (兼容旧版TB) - if (s_axi_wdata[2]) error <= 1'b0; // 写 1 清零 Error + if (s_axi_wdata[1]) done <= 1'b0; + if (s_axi_wdata[2]) error <= 1'b0; + end + else if (w_offset == ADDR_CRC) begin + crc_reg <= 32'hFFFFFFFF; // 写任意值复位 CRC end else if (w_offset >= ADDR_B0_A && w_offset < ADDR_B0_B) b0_a[(w_offset - ADDR_B0_A) >> 2] <= apply_wstrb(b0_a[(w_offset - ADDR_B0_A) >> 2], s_axi_wdata, s_axi_wstrb); @@ -308,6 +478,11 @@ module matmul_axi_slave ( end R_DATA: begin if (s_axi_rvalid && s_axi_rready) begin + // CRC32 stream: feed read data when in C result range + if (crc_read_en) begin + crc_stream_data <= s_axi_rdata; + crc_stream_valid <= 1'b1; + end if (r_cnt == r_len) begin s_axi_rvalid <= 1'b0; s_axi_rlast <= 1'b0; @@ -328,12 +503,18 @@ module matmul_axi_slave ( // 修复:将 wire 声明提取到 always 块外部 wire [11:0] current_r_offset = (r_state == R_DATA) ? r_offset : s_axi_araddr[11:0]; + // CRC stream trigger: valid when reading C result data + wire crc_read_en = (r_offset >= ADDR_B0_C && r_offset < (ADDR_B0_C + 12'h0C0)) || + (r_offset >= ADDR_B1_C && r_offset < (ADDR_B1_C + 12'h0C0)); + // 组合逻辑准备 Read 数据 always @(*) begin s_axi_rdata = 32'b0; if (r_state == R_DATA || (r_state == R_IDLE && s_axi_arvalid)) begin if (current_r_offset == ADDR_CTRL) s_axi_rdata = {30'b0, req_1, req_0}; + else if (current_r_offset == ADDR_CRC) + s_axi_rdata = crc_reg ^ 32'hFFFFFFFF; else if (current_r_offset == ADDR_STATUS) s_axi_rdata = {29'b0, error, done, busy}; else if (current_r_offset >= ADDR_B0_A && current_r_offset < ADDR_B0_B) diff --git a/sdk/axi_ram.mif b/sdk/axi_ram.mif index 4f1da13..b47e847 100644 --- a/sdk/axi_ram.mif +++ b/sdk/axi_ram.mif @@ -52,29 +52,29 @@ 00000011100000000110000000001101 00000100000000000000000110101100 00011100000000000000000100101100 -00000010100101001111000110001100 +00000010100101011111000110001100 00011100000000000001000000001101 00000010101111001001000110101101 00011100000000000001000000101110 -00000010101011101111000111001110 +00000010101000000011000111001110 01101100000000000001100110101110 00101000100000000000000110001111 00101001100000000000000110101111 00000010100000000001000110001100 00000010100000000001000110101101 01101011111111111111000110101110 -00011100000000000001000000101100 -00000010101011100111000110001100 +00011100000000000001000000001100 +00000010100111111011000110001100 00011100000000000001000000101101 -00000010101110101001000110101101 +00000010101010111101000110101101 01101100000000000001000110001101 00101001100000000000000110000000 00000010100000000001000110001100 01101011111111111111100110001101 00000011100000000110010000001100 00000100000001100000000000101100 -00011100000000000001000000101100 -00000010101001100001000110001100 +00011100000000000001000000001100 +00000010100101111000000110001100 00101000100000000000000110001101 00000011100000000001110000001110 00101001000000000000100110101110 @@ -144,168 +144,168 @@ 00000000000000000000000000000000 00010100001111101010000000001100 00000010101111101000000001100011 -00000010100000000000100000001101 00000011100001000000000110010001 00000011100011000000000110010000 00000011100001100000000110001111 00000010100000000000010000001110 +00000010100000000000100000001101 00000011100011100000000110001100 00011100000000000001000000000100 00000010101101101000000010000100 -00101001100000010100000001111000 00101001100000001000000001101111 00101001100000001001000001101100 00101001100000001010000001101110 00101001100000001011000001101101 00101001100000010111000001100001 -00101001100000010110000001110110 -00101001100000010101000001110111 -00101001100000010011000001111001 -00101001100000010010000001111010 -00101001100000010001000001111011 00101001100000010000000001111100 -00101001100000001111000001111101 -00101001100000001110000001111110 00101001100000001101000001111111 00101001100000000110000001110001 00101001100000000111000001110000 -01010100000001010110010000000000 +00101001100000010110000001110110 +00101001100000010101000001110111 +00101001100000010100000001111000 +00101001100000010011000001111001 +00101001100000010010000001111010 +00101001100000010001000001111011 +00101001100000001111000001111101 +00101001100000001110000001111110 +01010100000001011010010000000000 00010101011111101010000000001100 -00000011100000000001000110001100 -00000010100000000001100000001101 -00101001100000000000000110001101 +00000011100000000001000110001101 +00000010100000000001100000001110 +00000011100000000100000110001100 +00101001100000000000000110101110 +00101001100000000000000110000000 +01010100000001010100100000000000 00101000100000000110000001100110 +00000000000101010000000010011100 00000010100000000010100000001000 00000010100000100000000000000111 00010100001110001000000000000101 00000000000101010000000000000100 -00011100000000000001000000111000 -00000010101100110011001100011000 -01010100000001000110010000000000 -00101000100000000000001100001100 +00011100000000000001000000111111 +00000010101001000011001111111111 +01010100000001000101010000000000 +00101000100000000000001111101100 01011011111111111111110110000000 00101000100000001010000001101101 -00010100001110001000000000011010 -00101001100000000000001100000000 00010101011111101010000000001100 -00000011100101000000001101011011 -00000010100000000000010000010110 -00000011100000100000001101011010 -00011100000000000001000000110111 -00000010101100101000001011110111 -00011100000000000001000000111110 -00000010101100100100001111011110 -00000010100000000000010000011101 -00010101011111101010000000011100 +00101001100000000000001111100000 00101001100000000000000110001101 -00000011010000000000011011011001 -00000000010000001000101100111001 +01010100000001010000100000000000 +00000000000100010111000010001100 +00010100001110001000000000011000 +00101001100000000010000001101100 +01010100000001001111100000000000 +00000011100101000000001100011001 +00000010100000000000010000011101 +00011100000000000001000000111110 +00000010101000110100001111011110 +00011100000000000001000000110110 +00000010101000110000001011010110 +00000010100000000000010000011011 +00010101011111101010000000011010 +00101001100000000011000001100100 +00000011100000100000001100011000 +00000011010000000000011110110111 +00000000010000001000101011110111 00000010100000001100000001101100 -00000000000100000110010110001100 +00000000000100000101110110001100 00101000101111111010000110000110 -00000010101111111111111011011111 +00000010101111111111111110101101 00000010100000000010100000001000 00000010100000100000000000000111 -00000000000101010000001101000101 +00000000000101010000001100000101 00000000000101010000000000000100 -00000011010000000000011111111111 -01010100000000111111010000000000 -00101000100000000000001011101100 -01011011111111111111110110000000 -00101001100000000000001011100000 -01011000000000000001001011011101 +00000011010000000000010110111100 +01010100000000111101000000000000 00101000100000000000001111001100 01011011111111111111110110000000 00101001100000000000001111000000 -00000000010000001000101111111111 +01011000000000000001001110111011 +00101000100000000000001011001100 +01011011111111111111110110000000 +00101001100000000000001011000000 +00000000010000001000101110001101 00000010100000001100000001101100 -00000000000100000111110110011111 -00101000101111111100001111100101 +00000000000100000011010110001101 +00101000101111111100000110100101 00000010100000000101000000001000 00000010100000110000000000000111 -00000000000101010000001101100110 +00000000000101010000001100100110 00000010100000000000010000000100 -01010100000000111011010000000000 -00101000100000000000001100001100 +01010100000000111001000000000000 +00101000100000000000001111101100 01011011111111111111110110000000 00000010100000001100000001101100 -00000000000100000110010110011001 -00101000101111111110001100101101 -00101001100000000000001100000000 -00000010100000000000011011010110 +00000000000100000101110110010111 +00101000101111111110001011101101 +00101001100000000000001111100000 +00000010100000000000011110111101 00000010100000000010100000001100 -00101001100000000000001110001101 -00000010100000100000001101011010 -00000010100000110000001101111011 -01011111111111110110011011001100 -00101000100000000000001011101100 -01011011111111111111110110000000 -00101001100000000000001011100000 -00000011010000000000000000000000 +00101001100000000000001101001101 +00000010100000100000001100011000 +00000010100000110000001100111001 +01011111111111110110011110101100 +01010100000001000010110000000000 +00101000100000000011000001101100 +00000000000100010011000010011101 +01010100000001000010000000000000 +00000000000101010000000010010111 00101000100000000000001111001100 01011011111111111111110110000000 +00101001100000000000001111000000 +00101000100000000000001011001100 +01011011111111111111110110000000 00101000100000001001000001100101 00010100001110001000000000000110 00000010100000000101000000001000 00000010100000110000000000000111 00000011101011110000000011000110 00000010100000000000010000000100 -00101001100000000000001111000000 -01010100000000110100110000000000 -00101000100000000000001111001100 -01011011111111111111110110000000 -00010101011110001000000000010001 -00000011100101000000001000101111 -00101001100000000000001111000000 -00000010101111111111110000000101 -00011100000000000001000000010000 -00000010101100001001001000010000 -00000011101100100000001000110001 +00101001100000000000001011000000 +01010100000000110001100000000000 00000011010000000000000000000000 -00101000100000000000000111101100 -00000000010001001010000010110010 -00000010100000000001000111101111 -00000000000101011011000010100101 -00101001100000000011000001100101 -00101010000000000011000001100101 -00000000010001001010000110001110 -00000000010001001100000110001101 -00000000010000001000100010100101 -00000000000100000001011000000101 -00101000100000000000000010100101 -00000000010001001110000110001100 -00000000000101011100100010100101 -00000000000101011011100010101110 -00101001100000000011000001101110 -00101010000000000011000001101110 -00000000010001001010000010110010 -00000000010000001000100111001110 -00000000000100000011101000001110 -00101000100000000000000111000101 -00000000000101011100100010100101 -00000000000101011011010010101101 -00101001100000000011000001101101 -00101010000000000011000001101101 -00000000010001001010000010101110 -00000000010000001000100110101101 -00000000000100000011011000001101 -00101000100000000000000110100101 -00000000000101011011100010100101 -00000000000101011001010110001100 -00000011010000111111110110001100 -00000000010000001000100110001100 -00000000000100000011001000001100 -00000000010001001010000010101101 +00101000100000000000001011001100 +01011011111111111111110110000000 +00101001100000000000001011000000 +01010100000000111101010000000000 +00010101011111101010000000001100 +00000011100000000100000110001100 00101000100000000000000110000101 -00000000000101011011010010100101 -01011111111111110111000111110001 -00000000000101000001010000000101 +00000000000100010101110010010111 00011100000000000001000000000100 -00000010101011010110000010000100 -01010100000000110101000000000000 +00000010101011110000000010000100 +01010100000000111111100000000000 +00101000100000000010000001111000 00011100000000000001000000000100 -00000010101011011000000010000100 -01010100000000110100010000000000 +00000010101011110001000010000100 +00000000000101010000001100000101 +01010100000000111110010000000000 +00000000000101010000001110100101 +00011100000000000001000000000100 +00000010101011110001000010000100 +01010100000000111101010000000000 +00000010100000000010100000000101 +00000000001000010001011110101100 +01011100000000000000100010100000 +00000000001010100000000000000111 +00011100000000000001000000000100 +00000010101011101110000010000100 +00000000000101010000000110000101 +01010100000000111011010000000000 +00000000000101010000001011100101 +00011100000000000001000000000100 +00000010101011101110000010000100 +01010100000000111010010000000000 +00000000000100000111011100000101 +00000000000100000101110010100101 +00011100000000000001000000000100 +00000010101011101110000010000100 +01010100000000111001000000000000 +00011100000000000001000000000100 +00000010101011101111000010000100 +01010100000000111000010000000000 00101000100000010111000001100001 00101000100000010110000001110110 00101000100000010101000001110111 @@ -478,8 +478,8 @@ 00000011010000000000000000000000 00000011010000000000000000000000 00000011010000000000000000000000 -00011100000000000001000000101110 -00000010101000001001000111001110 +00011100000000000001000000001110 +00000010100100011101000111001110 00000010100000000000010000001111 00010101011111101010000000001100 00000010100000000000100000001101 @@ -495,7 +495,7 @@ 00000011010000000000100110001100 01011000000000000001110110000000 00011100000000000001000000001110 -00000010100111111000000111001110 +00000010100100001100000111001110 00000010100000000000010000001111 00000010100000000000100000001100 00101001100000000000000111001111 @@ -506,7 +506,7 @@ 00000011010000000000100110101101 01011000000000000001110110100000 00011100000000000001000000001110 -00000010100111101100000111001110 +00000010100100000000000111001110 00000010100000000000010000001111 00000010100000000000100000001101 00101001100000000000000111001111 @@ -514,9 +514,25 @@ 01001100000000000000000000100000 00000011010000000000000000000000 00000011010000000000000000000000 +00000000000000000110000000001101 +00011100000000000001000000001110 +00000010101110111101000111001110 +00101000100000000000000111010000 +00010100000000000001111010001100 +00000010100011111010000000001111 +00000011100010010000000110001100 +00000000001000010011001000001110 +01011100000000000000100110000000 +00000000001010100000000000000111 +00000000001000010011100111100100 +01011100000000000000100111000000 +00000000001010100000000000000111 +00000000000111000011010010000100 +01001100000000000000000000100000 +00000011010000000000000000000000 00000010101111110000000001100011 00011100000000000001000000001100 -00101000100100010111000110001100 +00101000100000011011000110001100 00101001100000001001000001100101 00101001100000001010000001100110 00000000000101010000000010000101 @@ -554,7 +570,7 @@ 00101001100000001110000001101100 01010100001111110101100000000000 00011100000000000001000000001100 -00101000100011110110000110001100 +00101000101111111010000110001100 00101000100000000000000110001100 00101001100000000110000001100100 00101001010000011101000001100000 @@ -622,8 +638,8 @@ 00000010101111111000000110101110 01101000000100011010101000101110 00000000010000001000100111001110 -00011100000000000001000000001101 -00000010101010101110000110101101 +00011100000000000000111111101101 +00000010100110110101000110101101 00000000000100000011100110101110 00101000100000000000000111001110 01001100000000000000000111000000 @@ -854,10 +870,10 @@ 00101000100000000010000001101110 00000010100000010001110000001101 00011100000000000000111111111000 -00000010100110110110001100011000 +00000010100010111101001100011000 01100100000000000000110110101110 00011100000000000000111111111000 -00000010100110110100001100011000 +00000010100010111011001100011000 00000010101111011111110000001101 00000000000101001011011011110111 00000000000101010000000000010110 @@ -890,10 +906,10 @@ 00101000100000000010000001101110 00000010100000010001110000001101 00011100000000000000111111111000 -00000010100110010100001100011000 +00000010100010011011001100011000 01100100000000000000110110101110 00011100000000000000111111111000 -00000010100110010010001100011000 +00000010100010011001001100011000 00000010101111011111110000001101 00000000000101001011011011110111 00000000000101010000000000001111 @@ -923,7 +939,7 @@ 01100100000000000110010000010000 00000010100000000100000000000110 00011100000000000000111111110100 -00000010100111100001001010010100 +00000010100011101000001010010100 00000010100000000001110000000111 00101000100000100110000001110010 00101000100000100101000001110001 @@ -997,7 +1013,7 @@ 01100100000000000110010000011110 00000010100000000100000000010011 00011100000000000000111111101101 -00000010100110010011000110101101 +00000010100010011010000110101101 00000010100000000001110000010100 00101000100000100110000001110001 00101000100000100101000001110000 @@ -1023,7 +1039,7 @@ 01100100000000000101110000011110 00000010100000000100000000010010 00011100000000000000111111101101 -00000010100101111001000110101101 +00000010100010000000000110101101 00000010100000000001110000010011 00101000100000100110000001101111 00101000100000100101000001110000 @@ -1115,7 +1131,7 @@ 00101001100000010110000001101100 01010100000101000110100000000000 00011100000000000000111111101110 -00000010100100100110000111001110 +00000010100000101100000111001110 00101000100000000000000111000110 00101000100000000001000111000111 01010100011010001011000000000000 @@ -1131,12 +1147,12 @@ 00101000100000000010000001101101 00000010100000011000010000001110 00011100000000000000111111111100 -00000010100010100101001110011100 +00000010101110101100001110011100 01011000000000000000110110101110 00011100000000000000111111111100 -00000010100010100111001110011100 +00000010101110101110001110011100 00011100000000000000111111101110 -00000010100100010011000111001110 +00000010100000011001000111001110 00101000100000000001000111001111 00101000100000000000000111001110 00000010101111111111111101011111 @@ -1176,7 +1192,7 @@ 00101000100000010111000001101100 01011111111111111000010010000000 00011100000000000000111111111111 -00000010100011101101001111111111 +00000010101111110011001111111111 00101000100000000000001111100110 00101000100000000001001111100111 00101000100000001010000001100100 @@ -1522,7 +1538,7 @@ 00101001100000000100000001101101 00010100000000000000000011101110 00011100000000000000111111101101 -00000010101100011110000110101101 +00000010101000100101000110101101 00000011101000001100000111001110 00101001100000010001000001101101 00000010100000011110000000001101 @@ -1547,7 +1563,7 @@ 00000000000101010000000000011011 00000000000101010000000000011111 00011100000000000000111111111000 -00000010101100001111001100011000 +00000010101000010110001100011000 01010011111101011110011111111111 00000010101111111111110000001110 00101001100000001010000001101100 @@ -1599,8 +1615,8 @@ 01011011111111111110000111000000 00101010000000000000001101111111 01010011111111111110111111111111 -00011100000000000000111111101101 -00000010101011010101000110101101 +00011100000000000000111111001101 +00000010100111011100000110101101 00101001100000010001000001101101 00000011010000001000001011101110 01011000000000000110000111000000 @@ -1624,8 +1640,8 @@ 00000000000101001011101011110111 00000010100000000000100000001110 01010011111111100001101111111111 -00011100000000000000111111101101 -00000010101010110111000110101101 +00011100000000000000111111001101 +00000010100110111110000110101101 01010011111111111001111111111111 00000010100000000001001101101101 00101001100000000100000001101101 @@ -1771,8 +1787,8 @@ 00101000100000010011000001110000 00000010100000100111000001110011 00000010100000000001110000000111 -00011100000000000000111111110100 -00000010101010010000001010010100 +00011100000000000000111111010100 +00000010100110010111001010010100 00000010100000000100000000000110 00000010101111111100001000010000 00000000000101010000001001101100 @@ -1790,8 +1806,8 @@ 00101000100000010010000001101111 00000010100000100111000001110010 00000010100000000001110000010100 -00011100000000000000111111101101 -00000010101001111001000110101101 +00011100000000000000111111001101 +00000010100110000000000110101101 00000010100000000100000000010011 00000010101111111100001111011110 00000000000101010000001001001100 @@ -1807,8 +1823,8 @@ 01011111111101101011010010000000 00000010100000100111000001110001 00000010100000000001110000010011 -00011100000000000000111111101101 -00000010101001101000000110101101 +00011100000000000000111111001101 +00000010100101101111000110101101 00000010100000000100000000010010 00000010101111111100001111011110 00000000000101010000001000101100 @@ -1827,7 +1843,7 @@ 00101000100000000010000001101100 01011100000000010111010010000000 00011100000000000000111111001101 -00000010100111111001000110101101 +00000010100100000000000110101101 00101001100000000000000110001101 00000010100000000000010000001101 00101001100000000001000110001101 @@ -1870,8 +1886,8 @@ 00000010101111111111111110011000 01100100000000000100100000011000 00000010100000000100000000011011 -00011100000000000000111111111010 -00000010101000101001001101011010 +00011100000000000000111111011010 +00000010100100110000001101011010 00000010100000000001110000011101 00101000100000100110000001101110 00101000100000100101000001101101 @@ -1921,7 +1937,7 @@ 00101000100000011110000001101101 01100000000000010101010000001101 00011100000000000000111111001101 -00000010100110011011000110101101 +00000010100010100010000110101101 00101001100000000000000110001101 00000010100000000000010000001101 00101001100000000001000110001101 @@ -1967,7 +1983,7 @@ 00000000000101010000000110001110 00000010100000000100000000011101 00011100000000000000111111011011 -00000010100111001001001101111011 +00000010100011010000001101111011 00000010100000000001110000011110 00101000100000100110000001101111 00101000100000100101000001101101 @@ -2029,7 +2045,7 @@ 01100100000000000101110000011010 00000010100000000100000000001110 00011100000000000000111111011110 -00000010100110001011001111011110 +00000010100010010010001111011110 00000010100000000001110000010001 00101000100000100110000001101111 00101000100000100101000001101101 @@ -2056,7 +2072,7 @@ 00000010100000000001110000011110 00101001100000000010000001101101 00011100000000000000111111011111 -00000010100101110000001111111111 +00000010100001110111001111111111 01011100000000011000001101100000 01011100000000011000001110100000 00000000000100000111001100001101 @@ -2117,7 +2133,7 @@ 01100111111111000111000000011000 00000010100000000100000000011011 00011100000000000000111111011010 -00000010100100110011001101011010 +00000010100000111010001101011010 00000010100000000001110000011101 00101000100000100110000001101110 00101000100000100101000001101101 @@ -2331,7 +2347,7 @@ 01100111111111111100010000011011 00000010100000000100000000011101 00011100000000000000111111011000 -00000010100001011101001100011000 +00000010101101100100001100011000 00000010100000000001110000011110 00101000100000100110000001101100 00101000100000100101000001101101 @@ -2370,7 +2386,7 @@ 01100111111110001000010000010111 00000010100000000100000000011010 00011100000000000000111111011000 -00000010100000111010001100011000 +00000010101101000001001100011000 00000010100000000001110000011011 00101000100000100110000001101110 00101000100000100101000001101101 @@ -2448,7 +2464,7 @@ 00000000000101010000000010101110 01011100000000000010111000000000 00011100000000000000111111001100 -00000010101111110111000110001100 +00000010101011111101000110001100 00101000100000000000000110000110 00101000100000000001000110000111 01010100010100111101110000000000 @@ -2492,7 +2508,7 @@ 00000010101111111111000010001101 00101001100000000000000010000000 00011100000000000000111111001110 -00101000100101101000000111001110 +00101000100001101100000111001110 00101000100000000000000111001100 01011100000000000001000110000000 00101001100000000000000010001100 @@ -2518,7 +2534,7 @@ 01001100000000000000000000100000 01011100000000000001100110001101 00011100000000000000111111001100 -00101000100101000000000110001100 +00101000100001000100000110001100 00000010100000000011000000001101 00101001100000000000000110001101 01001100000000000000000000100000 @@ -2548,7 +2564,7 @@ 00000010101111111110000000001100 00000000000100000101110010010111 00011100000000000000111111011010 -00000010100100110011001101011010 +00000010100000110111001101011010 00000000000101001011001100011000 00101001100000000000001101010111 00000010101111111111001100011000 @@ -2560,7 +2576,7 @@ 00000000000100000110011011110111 00101001100000000000001101010111 00011100000000000000111111001100 -00000010100100101000000110001100 +00000010100000101100000110001100 00101000100000000000000110001101 01011111111111111000100110100000 00101001100000000000000110011000 @@ -2568,7 +2584,7 @@ 00000010101111111100000001100011 00101001100000000010000001110111 00011100000000000000111111001100 -00000010100100011111000110001100 +00000010100000100011000110001100 00101000100000000000000010010111 00101000100000000000000110001100 00101001100000000000000001111001 @@ -2611,7 +2627,7 @@ 00000010101111111010110000001100 01101100000000000011100110000100 00011100000000000000111111001100 -00101000100011100011000110001100 +00101000101111100111000110001100 00000010100000000011000000001101 00101001100000000000000110001101 00000000000101010000000000010111 @@ -2628,7 +2644,7 @@ 00000000000101001001001100011000 00000010100000000010001100011001 00011100000000000000111111011010 -00000010100011100101001101011010 +00000010101111101001001101011010 00101000100000000000001101010111 01011100000000000001111011100000 00000000000101010000001100100100 @@ -2819,8 +2835,8 @@ 00000000000101010110101110011010 01011000000011111111011101000000 00101000100000000111000001101101 -00011100000000000000111111001100 -00000010101010001000000110001100 +00011100000000000000111110101100 +00000010100110001110000110001100 00101001100000000001000001101100 01011000000000000001000110100000 00000010100000000000110110001100 @@ -2856,7 +2872,7 @@ 00101001100000000000000110101100 00101000100000000111000001101101 00011100000000000000111110101100 -00000010100111110100000110001100 +00000010100011111011000110001100 00101001100000000001000001101100 01011011111111111000000110100000 00101000100000000111000001101110 @@ -2884,18 +2900,18 @@ 00000000000101010011000010100101 00000010101100000000011100011000 00101001100000010010000001100000 -00011100000000000000111111001100 -00000010101001001000000110001100 +00011100000000000000111110101100 +00000010100101001110000110001100 00101000100000000000000110000110 00101000100000000001000110000111 01010100010100111011100000000000 -00011100000000000000111111001100 -00000010101001000101000110001100 +00011100000000000000111110101100 +00000010100101001011000110001100 00101000100000000000000110000110 00101000100000000001000110000111 01010100010011001111010000000000 -00011100000000000000111111001100 -00000010101001000010000110001100 +00011100000000000000111110101100 +00000010100101001000000110001100 00101000100000000000000110000110 00101000100000000001000110000111 01010100001110000111000000000000 @@ -2903,8 +2919,8 @@ 00000000000101010000001100000100 00000000000101010000000010111011 01010100010111011001000000000000 -00011100000000000000111111001100 -00000010101000111011000110001100 +00011100000000000000111110101100 +00000010100101000001000110001100 00101000100000000000000110000110 00101000100000000001000110000111 01010100010011001011110000000000 @@ -2936,7 +2952,7 @@ 01101000000000000011010110010110 00000000010000001000111011001101 00011100000000000000111111001100 -00101000101110011111000110001100 +00101000101010100011000110001100 00000000000100000011010110001100 00101000100000000000000110000110 00101000100000000001000110000111 @@ -3057,7 +3073,7 @@ 00000000010000001000110110001101 00000000010010001001001011011101 00011100000000000000111111001100 -00101000101100100110000110001100 +00101000101000101010000110001100 00000000000100000011010110001100 00000011010000000100001110101110 00101000100000000001000110001101 @@ -3065,7 +3081,7 @@ 00101000100000000000000110001100 01011000000000000100000111000000 00011100000000000000111111001110 -00101000101100100000000111001110 +00101000101000100100000111001110 00101000100000001000000111000110 00101000100000001001000111000111 00101000100000001011000001100100 @@ -3080,7 +3096,7 @@ 00000000000101010000000010111100 00000010100000000000110000011000 00011100000000000000111111011110 -00101000101100010001001111011110 +00101000101000010101001111011110 01010000000000000011010000000000 00000011010000000000011110101111 01011000000000000010010111100000 @@ -3108,16 +3124,16 @@ 00000000000100010101100000011101 00000011010000000011111110101100 00000000010000001000110110001101 -00011100000000000000111111001100 -00101000101011110010000110001100 +00011100000000000000111110101100 +00101000100111110110000110001100 00000000000100000011010110001100 00101000100000000000000110000110 00101000100000000001000110000111 00101000100000001011000001100100 00101000100000001110000001100101 00000000010010001001001110111101 -00011100000000000000111111011110 -00101000101011101100001111011110 +00011100000000000000111110111110 +00101000100111110000001111011110 01010100010010010111000000000000 00000000000101010000000010011001 00000000000101010000000010111100 @@ -3127,7 +3143,7 @@ 00101000100000001111000001101100 01011000000000011100110110000000 00011100000000000000111110101110 -00000010100101011110000111001110 +00000010100001100100000111001110 00101000100000000000000111000110 00101000100000000001000111000111 00000000000101010000001100100100 @@ -3139,7 +3155,7 @@ 00101000100000000100000001101100 01100100000000001110010000001100 00011100000000000000111110101110 -00000010100101010100000111001110 +00000010100001011010000111001110 00101000100000001000000001101101 00101000100000000000000111000110 00101000100000000001000111000111 @@ -3164,7 +3180,7 @@ 00000000000101010000000110100111 01010100010010001100000000000000 00011100000000000000111110101111 -00000010100100111101000111101111 +00000010100001000011000111101111 00101000100000000000000111100110 00101000100000000001000111100111 01010100001101000011110000000000 @@ -3172,7 +3188,7 @@ 00000000000100000001011100011000 01011100000000010011001111000000 00011100000000000000111110101100 -00000010100100110111000110001100 +00000010100000111101000110001100 00101000100000010001000001101110 00101000100000001100000001101101 00101000100000000000000110000110 @@ -3201,8 +3217,8 @@ 00000010100000000011100000001101 01100000000001000010110110110110 00000000010000001000111011001101 -00011100000000000000111111001100 -00101000101010010101000110001100 +00011100000000000000111110101100 +00101000100110011001000110001100 00000000000100000011010110001100 00101000100000000000000110011010 00101000100000000001000110011011 @@ -3211,7 +3227,7 @@ 01100000000000101100000000011111 01011100000001110010001111100000 00011100000000000000111110101100 -00000010100100010000000110001100 +00000010100000010110000110001100 00101000100000000000000110000110 00101000100000000001000110000111 00000000000101010000001101000100 @@ -3252,24 +3268,24 @@ 00000000000100000111100110001100 00101001100000010001000001101100 00101000100000000110000001101100 -00011100000000000000111111001101 -00101000101001100010000110101101 +00011100000000000000111110101101 +00101000100101100110000110101101 00000000000100000011100110101101 00101000100000000000000110100110 00101000100000000001000110100111 01011000000000001111110110000000 00011100000000000000111110101100 -00000010100011001010000110001100 +00000010101111010000000110001100 00101000100000000000000110000100 00101000100000000001000110000101 00101001100000001100000001111000 00011100000000000000111110111000 -00000010100011010111001100011000 +00000010101111011101001100011000 01010100001111000000010000000000 00101000100000001100000001101111 00000000000101010000001100100110 00011100000000000000111110111001 -00000010100011010000001100111001 +00000010101111010110001100111001 00000000000101010000000111100111 01010100010011011011110000000000 00101000100000000001000001111110 @@ -3345,7 +3361,7 @@ 00000000000101010000000010111001 01011100000000001000011110001100 00011100000000000000111110111100 -00000010100001110100001110011100 +00000010101101111010001110011100 00101000100000000000001110000110 00101000100000000001001110000111 00101000100000001100000001100100 @@ -3377,7 +3393,7 @@ 00000000000101010000000111011110 01010011111111111110101111111111 00011100000000000000111110101100 -00000010100001100110000110001100 +00000010101101101100000110001100 00101000100000000000000110000110 00101000100000000001000110000111 01010100010001010101100000000000 @@ -3454,7 +3470,7 @@ 00000000000101010000000110011110 01010011111111111100111111111111 00011100000000000000111110101100 -00000010100000011001000110001100 +00000010101100011111000110001100 00101000100000000000000110000110 00101000100000000001000110000111 00000010100000000000011100011000 @@ -3839,8 +3855,8 @@ 00000000000101010000000000011010 01010011111111010010101111111111 00101000100000000111000001101101 -00011100000000000000111110101100 -00000010101010001001000110001100 +00011100000000000000111110001100 +00000010100110001111000110001100 00101001100000000001000001101100 00000010100000000010000110001100 01011111111100000001010110100000 @@ -3873,13 +3889,13 @@ 00000010101111111100000001100011 00101001100000000010000001110111 00011100000000000000111110110111 -00000010100000001100001011110111 +00000010101100010000001011110111 00101000100000000000001011100100 00101001100000000011000001100001 01011000000000000001100010000000 01010111111010100100111111111111 00011100000000000000111110101100 -00000010100000000101000110001100 +00000010101100001001000110001100 00101001100000000000001011100000 00101001100000000000000110000000 00101000100000000011000001100001 @@ -3887,7 +3903,7 @@ 00000010100000000100000001100011 01001100000000000000000000100000 00011100000000000000111110101100 -00000010101111111100000110001100 +00000010101100000000000110001100 00101000100000000000000110001101 01011100000000000001100110100000 00000010100000000000010000001101 @@ -3898,7 +3914,7 @@ 00000000000101010000000000000100 01001100000000000000000000100000 00011100000000000000111110101100 -00000010101111110010000110001100 +00000010101011110110000110001100 00101000100000000000000110001101 01100100000000001000000110100100 00000010101111111100000001100011 @@ -3912,7 +3928,7 @@ 00000000000101010000000000001100 01011100000000000011110010000000 00011100000000000000111110101100 -00000010101111100101000110001100 +00000010101011101001000110001100 00101000100000000000000110000100 00000000000101010000000110011001 01011000000000000000100010000000 @@ -3923,7 +3939,7 @@ 01011000000000000000100010000000 00101001100000000000001100010111 00011100000000000000111110101100 -00000010101111011010000110001100 +00000010101011011110000110001100 00101000100000000000000110001100 00101000100000000011000001100001 00101000100000000010000001110111 @@ -3933,7 +3949,7 @@ 00000010100000000100000001100011 01001100000000000000000000100000 00011100000000000000111110101100 -00000010101111010000000110001100 +00000010101011010100000110001100 00101000100000000000000110001100 00000000000101010000000110000100 01001100000000000000000000100000 @@ -4247,7 +4263,7 @@ 00000010101111111111110110001100 00000000010000001000100110001100 00011100000000000000111110001101 -00000010100100000110000110101101 +00000010100000001100000110101101 00000000000100000011000110101100 00101000100000000000000110000101 00000000000101010000000000000110 @@ -4558,7 +4574,7 @@ 00000010100000000000100000000100 01010000000000000000010000000000 00011100000000000000111110001110 -00000010100101100000000111001110 +00000010100001100100000111001110 00000000000101010000000000001100 00000000000101010000000111001101 00000010100000001000000000010000 @@ -4628,48 +4644,48 @@ 00101001001111111111110110000000 01010011111111111111001111111111 00011100000000000000111110000100 -00101000100100010001000010000100 +00101000100000010101000010000100 00000010100000111100000010000100 01001100000000000000000000100000 00000000000101010000000010001100 00011100000000000000111110001101 -00000010100010010011000110101101 +00000010101110011010000110101101 00101000100000000000000110100100 01100100000000000011000110000000 00011100000000000000111110001110 -00101000100100000101000111001110 +00101000100000001001000111001110 00000000000100010011100010001110 00000000000100010011000000001111 01101100000000000010110111001111 00011100000000000000111110001100 -00101000100011110100000110001100 +00101000101111111000000110001100 00000010100000000011000000001101 00101001100000000000000110001101 00000010101111111111110000000100 01001100000000000000000000100000 00011100000000000000111110001110 -00101000100011110111000111001110 +00101000101111111011000111001110 00000000000100010001000111001110 01101011111111111101110111001100 00000000000100000011000010001100 00101001100000000000000110101100 01001100000000000000000000100000 00011100000000000000111110001100 -00101000100011101110000110001100 +00101000101111110010000110001100 00101001100000001000000010001100 00011100000000000000111110001100 -00101000100011101000000110001100 +00101000101111101100000110001100 00101001100000001001000010001100 00011100000000000000111110001100 -00101000100011100111000110001100 +00101000101111101011000110001100 00101001100000011000000010001100 00010101111111111111111100001100 00000000000101010011000010100101 00011100000000000000111110001100 -00101000100011011010000110001100 +00101000101111011110000110001100 00101001100000001010000010001100 00011100000000000000111110001100 -00101000100011100001000110001100 +00101000101111100101000110001100 00101001100000000000000010000000 00101001100000000001000010000000 00101001100000000010000010000000 @@ -4685,28 +4701,28 @@ 00101001100000001011000010001100 01001100000000000000000000100000 00011100000000000000111110000101 -00000010100001100011000010100101 +00000010101101101010000010100101 00011100000000000000111110000100 -00101000100011001001000010000100 +00101000101111001101000010000100 01010000000000010000110000000000 00011100000000000000111110001100 -00000010100001011101000110001100 +00000010101101100100000110001100 00101000100000000000000110000100 00000010101111111100000001100011 00101001100000000010000001110111 00101001100000000011000001100001 00011100000000000000111110010111 -00000010100100111001001011110111 +00000010100000111101001011110111 01011000000000000000100010010111 01010100000001110000010000000000 00011100000000000000111110001100 -00000010100001010010000110001100 +00000010101101011001000110001100 00101000100000000000000110000100 00000010100000011100001011101100 01011000000000000000100010001100 01010100000001101110110000000000 00011100000000000000111110001100 -00000010100001001011000110001100 +00000010101101010010000110001100 00101000100000000000000110000100 00000010100000111000001011110111 01011000000000000001010010010111 @@ -4720,18 +4736,18 @@ 01001100000000000000000000100000 00000010101111111100000001100011 00011100000000000000111110001100 -00000010100101110101000110001100 +00000010100001111001000110001100 00011100000000000000000000001101 00000010101111011011000110101101 00000000000101010000000000000110 00000010100000000001000000000101 00011100000000000000111110000100 -00000010100100011011000010000100 +00000010100000011111000010000100 00101001100000000011000001100001 00101001100000000000000110001101 01010111111111101101011111111111 00011100000000000000111110001101 -00000010100100010110000110101101 +00000010100000011010000110101101 00000010100000000000010000000110 00000010100000000010010000000101 00000010100000011100000110100100 @@ -4743,14 +4759,14 @@ 00000010100000000100000001100011 01010011111111101010011111111111 00011100000000000000111110001100 -00000010100100001000000110001100 +00000010100000001100000110001100 00101000100000000000000110001101 01011100000000000010010110100000 00011100000000000000000000001101 00000010101111000111000110101101 00101001100000000000000110001101 00011100000000000000111110001100 -00000010100101010111000110001100 +00000010100001011011000110001100 00101000100000000000000110001100 01011100000000000000100110000000 01010011111111110111011111111111 @@ -4864,7 +4880,7 @@ 00101000010000000011100010000100 01010000000011100111000000000000 00011100000000000000111110001100 -00101000100000100000000110001100 +00101000101100100100000110001100 00101000100000000000000110001100 00000010101111111100000001100011 00101001100000000010000001110111 @@ -4878,7 +4894,7 @@ 00000011010000000100000110001101 01011100000000000010010110100000 00011100000000000000111110001101 -00101000100000001000000110101101 +00101000101100001100000110101101 00000010100000000010010000001110 00101001100000000000000110101110 00000011100000010000000110001100 @@ -4993,7 +5009,7 @@ 01011100000000000000100110000000 01010011110110101010111111111111 00011100000000000000111110001100 -00101000101110010101000110001100 +00101000101010011001000110001100 00000010100000000011000000001101 00101001100000000000000110001101 00000000000101010000000000000100 @@ -5021,7 +5037,7 @@ 00101000100000001010001011101110 01011011111111111110000111000000 00011100000000000000111110011000 -00101000101101111001001100011000 +00101000101001111101001100011000 00000000010001001011000110001101 00101000100000000000001100011001 00000011010000000000010110101101 @@ -5149,12 +5165,12 @@ 01010011111111111100111111111111 01011100000000000001100010000000 00011100000000000000111110000101 -00101000101100000110000010100101 +00101000101000001010000010100101 00011100000000000000000000000100 00000010101111111101000010000100 01010011111110011100111111111111 00011100000000000000111110001100 -00101000101011111110000110001100 +00101000101000000010000110001100 00101000100000000000000110001100 00000010101111111100000001100011 00101001100000000010000001110111 @@ -5324,8 +5340,8 @@ 01010111110101011000011111111111 00101000100000000011000001101110 01011100000000000100000010000000 -00011100000000000000111110001100 -00101000101001001001000110001100 +00011100000000000000111101101100 +00101000100101001101000110001100 00000010100000000011000000001101 00101001100000000000000110001101 00101010010000000011001011101100 @@ -5560,7 +5576,7 @@ 00000010101111111010110000001100 01101100000000000100010110000101 00011100000000000000111101101100 -00101000100101011110000110001100 +00101000100001100010000110001100 00000010100000000011000000001101 00101001100000000000000110001101 00000000000101010000000000011010 @@ -5589,7 +5605,7 @@ 01010111110100001100111111111111 01011100000000000110010010000000 00011100000000000000111101101101 -00101000100101001111000110101101 +00101000100001010011000110101101 00101000100000000000000110101100 01011000000000000011000110000000 01011100000000001000111110001100 @@ -5659,7 +5675,7 @@ 00000010100000111111110000001100 01101100000000000001110110000101 00011100000000000000111101101100 -00101000100011111011000110001100 +00101000101111111111000110001100 00000010100000100010100000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5695,7 +5711,7 @@ 00000010100000000000100000001100 01101100000000000001110110000100 00011100000000000000111101101100 -00101000100011010111000110001100 +00101000101111011011000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5705,7 +5721,7 @@ 00000010100000000000100000001100 01101000000000000110000110000100 00011100000000000000111101101100 -00101000100011001100000110001100 +00101000101111010000000110001100 00101000100000000000000110001100 00000010101111111000000001100011 00101001100000000110000001110111 @@ -5728,7 +5744,7 @@ 01010100000000011010010000000000 01010011111111111110001111111111 00011100000000000000111101101100 -00101000100010110110000110001100 +00101000101110111010000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5751,7 +5767,7 @@ 01001100000000000000000000100000 01011100000000000111100010000000 00011100000000000000111101101100 -00101000100010011110000110001100 +00101000101110100010000110001100 00101000100000000000000110001100 01011000000000001000000110000000 00000010101111111000000001100011 @@ -5780,14 +5796,14 @@ 00000010100000000000011011110111 01010011111111111100101111111111 00011100000000000000111101101100 -00101000100010000010000110001100 +00101000101110000110000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 01001100000000000000000000100000 01001100000000000000000000100000 00011100000000000000111101101100 -00101000100001111011000110001100 +00101000101101111111000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5799,7 +5815,7 @@ 00000000000101010000000000000100 01001100000000000000000000100000 00011100000000000000111101101100 -00101000100001101111000110001100 +00101000101101110011000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5807,7 +5823,7 @@ 00000010100000000000100000001100 01101100000000000001110110000100 00011100000000000000111101101100 -00101000100001100111000110001100 +00101000101101101011000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5817,7 +5833,7 @@ 00000010100000000000100000001100 01101100000000000010000110000100 00011100000000000000111101101100 -00101000100001011101000110001100 +00101000101101100001000110001100 00000010100000000010010000001101 00101001100000000000000110001101 00000010101111111111110000000100 @@ -5826,12 +5842,12 @@ 00000000000101010000000000000100 01010011111111111111011111111111 00011100000000000000111101101100 -00000010100001001101000110001100 +00000010101101010100000110001100 00101000100000000000000110001100 00101001000000000000000110000100 01001100000000000000000000100000 00011100000000000000111101101100 -00000010101111100100000110001100 +00000010101011101011000110001100 00101000100000000000000110001101 00000010100000000001010110101110 00101010000000000000000111001100 @@ -5840,7 +5856,7 @@ 00101001000000000000000110100100 01001100000000000000000000100000 00011100000000000000111101101100 -00000010101111011011000110001100 +00000010101011100010000110001100 00101000100000000000000110001101 00000010101111111100000001100011 00000010100000000001010110101110 @@ -5869,7 +5885,7 @@ 00000000010001001010000011010010 00000010100000000010000000001111 00011100000000000000111101101100 -00101000100000110100000110001100 +00101000101100111000000110001100 00000000000100000100100110001100 00101010000000000000000110001100 00000010100000001000000000010000 @@ -5940,7 +5956,7 @@ 00000000010001001110000111010010 00000010100000000110000000001111 00011100000000000000111101110000 -00101000101111101101001000010000 +00101000101011110001001000010000 00000000000100000100101000010000 00101010000000000000001000010000 00000010100000001000000000001100 @@ -6004,7 +6020,7 @@ 00000000010001001110000011101110 00000010100000000110000000010001 00011100000000000000111101101111 -00101000101110101101000111101111 +00101000101010110001000111101111 00000000000100000011100111101111 00101010000000000000000111101110 00000010100000001000000000010000 @@ -6205,8 +6221,8 @@ 01101000000000000000110011001110 00000000010001001110000011010010 00000010100000000110000000001111 -00011100000000000000111101110000 -00101000101011100011001000010000 +00011100000000000000111101010000 +00101000100111100111001000010000 00000000000100000100101000010000 00101010000000000000001000010000 00000010100000001000000000001110 @@ -6271,8 +6287,8 @@ 01101000000000000000110110101110 00000000010001001110000110110001 00000010100000000110000000001111 -00011100000000000000111101110000 -00101000101010100001001000010000 +00011100000000000000111101010000 +00101000100110100101001000010000 00000000000100000100011000010000 00101010000000000000001000010001 00000010100000001000000000001110 @@ -6323,8 +6339,8 @@ 01101000000000000000110011101100 00000000010001001110000011110001 00000010100000000110000000001110 -00011100000000000000111101101100 -00101000101001101101000110001100 +00011100000000000000111101001100 +00101000100101110001000110001100 00000000000100000100010110001100 00101010000000000000000110001100 00000010100000001000000000001111 @@ -7156,8 +7172,8 @@ 00000010100000000011110000001100 00000000000101011110001110110000 01101000000000101001010110011011 -00011100000000000000111101001111 -00000010101001010110000111101111 +00011100000000000000111100101111 +00000010100101011100000111101111 00000000010000001000101101101110 00000000000100000011100111101110 00101000100000000000000111001100 @@ -7870,7 +7886,7 @@ 00000010100000000000011101110001 01101000000000100100000110011001 00011100000000000000111100101110 -00000010101110011101000111001110 +00000010101010100011000111001110 00000000010000001000101100111001 00000000000100000110010111011001 00101000100000000000001100101100 @@ -9248,15 +9264,15 @@ 00000010100000001000000000001101 01101000000000000010000110000100 00011100000000000000111100001100 -00101000101100000001000110001100 +00101000101000000101000110001100 00000000000100000001000110001100 00101010000000000000000110000100 00000000000100010001000110100100 01001100000000000000000000100000 00000011010000000000000000000000 00000000010001001010000010000100 -00011100000000000000111100001100 -00101000101011111001000110001100 +00011100000000000000111011101100 +00101000100111111101000110001100 00000000000100000001000110001100 00101010000000000000000110000100 00000010100000000110000000001101 @@ -9265,16 +9281,16 @@ 00010100000000100000000000001100 01101000000000000010010010001100 00000000010001001110000010000100 -00011100000000000000111100001100 -00101000101011101111000110001100 +00011100000000000000111011101100 +00101000100111110011000110001100 00000000000100000001000110001100 00101010000000000000000110000100 00000010100000000010000000001101 00000000000100010001000110100100 01001100000000000000000000100000 00000000010001001100000010000100 -00011100000000000000111100001100 -00101000101011100111000110001100 +00011100000000000000111011101100 +00101000100111101011000110001100 00000000000100000001000110001100 00101010000000000000000110000100 00000010100000000100000000001101 @@ -9611,266 +9627,33 @@ 00110010001100110100001101010010 00111000001100000010010100111101 00000000000010100111100001101100 +01000101010011010100100101010100 +01001111010100100101000001011111 +01010101010001110100111101001100 +01101100001001010011110101000101 +00000000000000000000101001110101 +01000101010011010100100101010100 +01001111010011110100110001011111 +01101100001001010011110101010000 +00000000000000000000101001110101 +01000101010011010100100101010100 +01001111010011110100110001011111 +01000101010100000101111101010000 +01101100001001010011110101010010 +00000000000000000000101001110101 +01000101010011010100100101010100 +01001001010100000100010101011111 +01010101010001110100111101001100 +01101100001001010011110101000101 +00000000000000000000101001110101 +01000101010011010100100101010100 +01010100010011110101010001011111 +00100101001111010100110001000001 +00000000000010100111010101101100 01001101010101000100000101001101 01000100010111110100110001010101 00001010010001010100111001001111 00000000000000000000000000000000 -00000000000000000000000000000000 -01110111000001110011000010010110 -11101110000011100110000100101100 -10011001000010010101000110111010 -00000111011011011100010000011001 -01110000011010101111010010001111 -11101001011000111010010100110101 -10011110011001001001010110100011 -00001110110110111000100000110010 -01111001110111001011100010100100 -11100000110101011110100100011110 -10010111110100101101100110001000 -00001001101101100100110000101011 -01111110101100010111110010111101 -11100111101110000010110100000111 -10010000101111110001110110010001 -00011101101101110001000001100100 -01101010101100000010000011110010 -11110011101110010111000101001000 -10000100101111100100000111011110 -00011010110110101101010001111101 -01101101110111011110010011101011 -11110100110101001011010101010001 -10000011110100111000010111000111 -00010011011011001001100001010110 -01100100011010111010100011000000 -11111101011000101111100101111010 -10001010011001011100100111101100 -00010100000000010101110001001111 -01100011000001100110110011011001 -11111010000011110011110101100011 -10001101000010000000110111110101 -00111011011011100010000011001000 -01001100011010010001000001011110 -11010101011000000100000111100100 -10100010011001110111000101110010 -00111100000000111110010011010001 -01001011000001001101010001000111 -11010010000011011000010111111101 -10100101000010101011010101101011 -00110101101101011010100011111010 -01000010101100101001100001101100 -11011011101110111100100111010110 -10101100101111001111100101000000 -00110010110110000110110011100011 -01000101110111110101110001110101 -11011100110101100000110111001111 -10101011110100010011110101011001 -00100110110110010011000010101100 -01010001110111100000000000111010 -11001000110101110101000110000000 -10111111110100000110000100010110 -00100001101101001111010010110101 -01010110101100111100010000100011 -11001111101110101001010110011001 -10111000101111011010010100001111 -00101000000000101011100010011110 -01011111000001011000100000001000 -11000110000011001101100110110010 -10110001000010111110100100100100 -00101111011011110111110010000111 -01011000011010000100110000010001 -11000001011000010001110110101011 -10110110011001100010110100111101 -01110110110111000100000110010000 -00000001110110110111000100000110 -10011000110100100010000010111100 -11101111110101010001000000101010 -01110001101100011000010110001001 -00000110101101101011010100011111 -10011111101111111110010010100101 -11101000101110001101010000110011 -01111000000001111100100110100010 -00001111000000001111100100110100 -10010110000010011010100010001110 -11100001000011101001100000011000 -01111111011010100000110110111011 -00001000011011010011110100101101 -10010001011001000110110010010111 -11100110011000110101110000000001 -01101011011010110101000111110100 -00011100011011000110000101100010 -10000101011001010011000011011000 -11110010011000100000000001001110 -01101100000001101001010111101101 -00011011000000011010010101111011 -10000010000010001111010011000001 -11110101000011111100010001010111 -01100101101100001101100111000110 -00010010101101111110100101010000 -10001011101111101011100011101010 -11111100101110011000100001111100 -01100010110111010001110111011111 -00010101110110100010110101001001 -10001100110100110111110011110011 -11111011110101000100110001100101 -01001101101100100110000101011000 -00111010101101010101000111001110 -10100011101111000000000001110100 -11010100101110110011000011100010 -01001010110111111010010101000001 -00111101110110001001010111010111 -10100100110100011100010001101101 -11010011110101101111010011111011 -01000011011010011110100101101010 -00110100011011101101100111111100 -10101101011001111000100001000110 -11011010011000001011100011010000 -01000100000001000010110101110011 -00110011000000110001110111100101 -10101010000010100100110001011111 -11011101000011010111110011001001 -01010000000001010111000100111100 -00100111000000100100000110101010 -10111110000010110001000000010000 -11001001000011000010000010000110 -01010111011010001011010100100101 -00100000011011111000010110110011 -10111001011001101101010000001001 -11001110011000011110010010011111 -01011110110111101111100100001110 -00101001110110011100100110011000 -10110000110100001001100000100010 -11000111110101111010100010110100 -01011001101100110011110100010111 -00101110101101000000110110000001 -10110111101111010101110000111011 -11000000101110100110110010101101 -11101101101110001000001100100000 -10011010101111111011001110110110 -00000011101101101110001000001100 -01110100101100011101001010011010 -11101010110101010100011100111001 -10011101110100100111011110101111 -00000100110110110010011000010101 -01110011110111000001011010000011 -11100011011000110000101100010010 -10010100011001000011101110000100 -00001101011011010110101000111110 -01111010011010100101101010101000 -11100100000011101100111100001011 -10010011000010011111111110011101 -00001010000000001010111000100111 -01111101000001111001111010110001 -11110000000011111001001101000100 -10000111000010001010001111010010 -00011110000000011111001001101000 -01101001000001101100001011111110 -11110111011000100101011101011101 -10000000011001010110011111001011 -00011001011011000011011001110001 -01101110011010110000011011100111 -11111110110101000001101101110110 -10001001110100110010101111100000 -00010000110110100111101001011010 -01100111110111010100101011001100 -11111001101110011101111101101111 -10001110101111101110111111111001 -00010111101101111011111001000011 -01100000101100001000111011010101 -11010110110101101010001111101000 -10100001110100011001001101111110 -00111000110110001100001011000100 -01001111110111111111001001010010 -11010001101110110110011111110001 -10100110101111000101011101100111 -00111111101101010000011011011101 -01001000101100100011011001001011 -11011000000011010010101111011010 -10101111000010100001101101001100 -00110110000000110100101011110110 -01000001000001000111101001100000 -11011111011000001110111111000011 -10101000011001111101111101010101 -00110001011011101000111011101111 -01000110011010011011111001111001 -11001011011000011011001110001100 -10111100011001101000001100011010 -00100101011011111101001010100000 -01010010011010001110001000110110 -11001100000011000111011110010101 -10111011000010110100011100000011 -00100010000000100001011010111001 -01010101000001010010011000101111 -11000101101110100011101110111110 -10110010101111010000101100101000 -00101011101101000101101010010010 -01011100101100110110101000000100 -11000010110101111111111110100111 -10110101110100001100111100110001 -00101100110110011001111010001011 -01011011110111101010111000011101 -10011011011001001100001010110000 -11101100011000111111001000100110 -01110101011010101010001110011100 -00000010011011011001001100001010 -10011100000010010000011010101001 -11101011000011100011011000111111 -01110010000001110110011110000101 -00000101000000000101011100010011 -10010101101111110100101010000010 -11100010101110000111101000010100 -01111011101100010010101110101110 -00001100101101100001101100111000 -10010010110100101000111010011011 -11100101110101011011111000001101 -01111100110111001110111110110111 -00001011110110111101111100100001 -10000110110100111101001011010100 -11110001110101001110001001000010 -01101000110111011011001111111000 -00011111110110101000001101101110 -10000001101111100001011011001101 -11110110101110010010011001011011 -01101111101100000111011111100001 -00011000101101110100011101110111 -10001000000010000101101011100110 -11111111000011110110101001110000 -01100110000001100011101111001010 -00010001000000010000101101011100 -10001111011001011001111011111111 -11111000011000101010111001101001 -01100001011010111111111111010011 -00010110011011001100111101000101 -10100000000010101110001001111000 -11010111000011011101001011101110 -01001110000001001000001101010100 -00111001000000111011001111000010 -10100111011001110010011001100001 -11010000011000000001011011110111 -01001001011010010100011101001101 -00111110011011100111011111011011 -10101110110100010110101001001010 -11011001110101100101101011011100 -01000000110111110000101101100110 -00110111110110000011101111110000 -10101001101111001010111001010011 -11011110101110111001111011000101 -01000111101100101100111101111111 -00110000101101011111111111101001 -10111101101111011111001000011100 -11001010101110101100001010001010 -01010011101100111001001100110000 -00100100101101001010001110100110 -10111010110100000011011000000101 -11001101110101110000011010010011 -01010100110111100101011100101001 -00100011110110010110011110111111 -10110011011001100111101000101110 -11000100011000010100101010111000 -01011101011010000001101100000010 -00101010011011110010101110010100 -10110100000010111011111000110111 -11000011000011001000111010100001 -01011010000001011101111100011011 -00101101000000101110111110001101 00000000010001100100111001001001 00000000011001100110111001101001 00000000010011100100000101001110 @@ -9888,97 +9671,97 @@ 01101100011101010110111000101000 00000000000000000010100101101100 00000000000000000000000000110000 -00011100000000000000101001111000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000000101010001100 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000000101000101000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000000101010010100 -00011100000000000000101010110100 -00011100000000000001101101100000 -00011100000000000000101010101100 -00011100000000000000101010111100 -00011100000000000001101101100000 -00011100000000000000101100100100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000000101100101100 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000000110010111000 -00011100000000000001101101100000 -00011100000000000000101111000100 -00011100000000000000101111111000 -00011100000000000000110010111000 -00011100000000000000110010111000 -00011100000000000000110010111000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 +00011100000000000000101010111000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000000101011001100 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000000101001101000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000000101011010100 +00011100000000000000101011110100 +00011100000000000001101110100000 +00011100000000000000101011101100 +00011100000000000000101011111100 +00011100000000000001101110100000 +00011100000000000000101101100100 00011100000000000000101101101100 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001011101001000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001011111111100 -00011100000000000001101101100000 -00011100000000000001100010011000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001100100000100 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000000110010111000 -00011100000000000001101101100000 -00011100000000000000101111000100 -00011100000000000000101111111100 -00011100000000000000110010111000 -00011100000000000000110010111000 -00011100000000000000110010111000 -00011100000000000000101101110100 -00011100000000000000101111111100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000000101101101100 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000000110011111000 +00011100000000000001101110100000 +00011100000000000000110000000100 +00011100000000000000110000111000 +00011100000000000000110011111000 +00011100000000000000110011111000 +00011100000000000000110011111000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000000101110101100 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001011110001000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001100000111100 +00011100000000000001101110100000 +00011100000000000001100011011000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001100101000100 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000000110011111000 +00011100000000000001101110100000 +00011100000000000000110000000100 +00011100000000000000110000111100 +00011100000000000000110011111000 +00011100000000000000110011111000 +00011100000000000000110011111000 00011100000000000000101110110100 -00011100000000000001101101100000 -00011100000000000000101110011100 -00011100000000000001101101100000 -00011100000000000001011011011100 -00011100000000000001011101001100 -00011100000000000001011111000000 -00011100000000000000101110110100 -00011100000000000001101101100000 -00011100000000000001011111111100 -00011100000000000000101001110000 -00011100000000000001100010011100 -00011100000000000001101101100000 -00011100000000000001101101100000 -00011100000000000001100101101000 -00011100000000000001101101100000 -00011100000000000000101001110000 +00011100000000000000110000111100 +00011100000000000000101111110100 +00011100000000000001101110100000 +00011100000000000000101111011100 +00011100000000000001101110100000 +00011100000000000001011100011100 +00011100000000000001011110001100 +00011100000000000001100000000000 +00011100000000000000101111110100 +00011100000000000001101110100000 +00011100000000000001100000111100 +00011100000000000000101010110000 +00011100000000000001100011011100 +00011100000000000001101110100000 +00011100000000000001101110100000 +00011100000000000001100110101000 +00011100000000000001101110100000 +00011100000000000000101010110000 00110000001100000011000000110000 00110000001100000011000000110000 00110000001100000011000000110000 @@ -9988,7 +9771,6 @@ 00100000001000000010000000100000 00100000001000000010000000100000 00000000000000000000000000000000 -00000000000000000000000000000000 00111111110000000000000000000000 00000000000000000000000000000000 01000000001100000000000000000000 @@ -10190,38 +9972,38 @@ 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 -11111111111110000110100100111000 -11111111111110000110011011100100 -11111111111110000110011111100000 -11111111111110000110011101000000 -11111111111110000110011111100000 -11111111111110000110100100000000 -11111111111110000110011111100000 -11111111111110000110011101000000 -11111111111110000110011011100100 -11111111111110000110011011100100 -11111111111110000110100100000000 -11111111111110000110011101000000 -11111111111110000110011101010000 -11111111111110000110011101010000 -11111111111110000110011101010000 -11111111111110000110100100011000 -11111111111110000111001111001000 -11111111111110000111000111001000 -11111111111110000111000111001000 -11111111111110000111000111000100 -11111111111110000111000111010100 -11111111111110000111000111010100 -11111111111110000111001110010000 -11111111111110000111000111000100 -11111111111110000111000111010100 -11111111111110000111001110010000 -11111111111110000111000111010100 -11111111111110000111000111000100 -11111111111110000111001110001000 -11111111111110000111001110001000 -11111111111110000111001110001000 -11111111111110000111001110101000 +11111111111110000110110100100000 +11111111111110000110101011001100 +11111111111110000110101111001000 +11111111111110000110101100101000 +11111111111110000110101111001000 +11111111111110000110110011101000 +11111111111110000110101111001000 +11111111111110000110101100101000 +11111111111110000110101011001100 +11111111111110000110101011001100 +11111111111110000110110011101000 +11111111111110000110101100101000 +11111111111110000110101100111000 +11111111111110000110101100111000 +11111111111110000110101100111000 +11111111111110000110110100000000 +11111111111110000111011110110000 +11111111111110000111010110110000 +11111111111110000111010110110000 +11111111111110000111010110101100 +11111111111110000111010110111100 +11111111111110000111010110111100 +11111111111110000111011101111000 +11111111111110000111010110101100 +11111111111110000111010110111100 +11111111111110000111011101111000 +11111111111110000111010110111100 +11111111111110000111010110101100 +11111111111110000111011101110000 +11111111111110000111011101110000 +11111111111110000111011101110000 +11111111111110000111011110010000 00000010000000100000000100000000 00000011000000110000001100000011 00000100000001000000010000000100 @@ -10286,14 +10068,15 @@ 00001000000010000000100000001000 00001000000010000000100000001000 00001000000010000000100000001000 +00000001111101111000101001000000 10111111000000000000000000000000 -00011100000010000000111110110000 -00011100000010000000111100101000 -00011100000010000000111010111000 -00011100000010000000111001001000 +00011100000010000000110000000000 +00011100000010000000101101111000 +00011100000010000000101100001000 +00011100000010000000101010011000 00000000000000000000000000000000 00000000000000000000000000000011 -00011100000010000000111001001000 +00011100000010000000101010011000 00000000000000000000000001000011 00000000000000000000000000000000 00000000000000000000000000000000 @@ -10350,20 +10133,20 @@ 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 -00011100000000000101100001100100 -00011100000000000101100000000100 +00011100000000000101100010100100 +00011100000000000101100001000100 00000000000000000000000000000000 -00011100000010000000100000101111 -00011100000010000000011110101100 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 -00011100000010000000000000110000 +00011100000010000000010010000111 +00011100000010000000010000000100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 +00011100000010000000000010001100 01111111011111110111111101111111 01111111011111110111111101111111 01111111011111110111111101111111 @@ -10388,25 +10171,22 @@ 10111111111000000000000111100000 10111111101011111111111100010000 00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011100000000000100101110011100 -00011100000010000000101010110000 -00011100000010000000110010101100 -00011100000010000000011011011000 -00011100000000000101000001110100 -00011100000010000000011010110000 -00011100000000000100110101111100 -00011100000010000000101010111100 -00011100000000000100110100011100 -00011100000000000100101100110100 -00011100000000000100101111111100 +00011100000000000100101111011100 +00011100000010000000011100001100 +00011100000010000000100011111100 +00011100000010000000001100110000 +00011100000000000101000010110100 +00011100000010000000001100001000 +00011100000000000100110110111100 +00011100000010000000011100011000 +00011100000000000100110101011100 +00011100000000000100101101110100 +00011100000000000100110000111100 00011100000011110000000000000000 -00011100000010000000111001000000 -00011100000010000000100110110000 -00011100000010000000111110110000 -00011100000010000000101011000100 -00011100000010000000110010101000 -00011100000010000000101011010000 -00011100000010000000101011010000 +00011100000010000000101010010000 +00011100000010000000011000001000 +00011100000010000000110000000000 +00011100000010000000011100100000 +00011100000010000000100011111000 +00011100000010000000011100101100 +00011100000010000000011100101100 diff --git a/sdk/software/examples/asm/user-sample.c b/sdk/software/examples/asm/user-sample.c index 5d71fd9..ce5a566 100644 --- a/sdk/software/examples/asm/user-sample.c +++ b/sdk/software/examples/asm/user-sample.c @@ -59,46 +59,13 @@ unsigned long CORE_CLOCKS_PER_SEC = 33000000L; #define STATUS_DONE 0x2 #define STATUS_ERROR 0x4 +// Hardware CRC register (offset 0x010 in matmul IP) +#define MATMUL_CRC (MATMUL_BASE_UNCACHED + 0x010) + /* ─── Convenience macros ──────────────────────────────────────────── */ #define REG_WR(addr, val) (*(volatile uint32_t *)(addr) = (uint32_t)(val)) #define REG_RD(addr) (*(volatile uint32_t *)(addr)) -/* ─── CRC32 table (IEEE 802.3, polynomial 0xEDB88320) ─────────────── */ -static const uint32_t crc32_table[256] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -}; - static volatile int matmul_done_flag = 0; static volatile int dma0_done_flag = 0; static volatile int dma1_done_flag = 0; @@ -138,29 +105,13 @@ static void wait_dma_done_intr(int ch) } } -/* ─── CRC32 over ExtRAM result region ─────────────────────────────── */ -static uint32_t compute_crc32(volatile uint32_t *extram) -{ - uint32_t crc = 0xFFFFFFFF; - uint32_t i, w; - - for (i = 0; i < RESULT_WORDS; i++) { - w = extram[DST_BASE_WORDS + i]; - crc = crc32_table[(crc ^ (w & 0xFF)) & 0xFF] ^ (crc >> 8); - crc = crc32_table[(crc ^ ((w >> 8) & 0xFF)) & 0xFF] ^ (crc >> 8); - crc = crc32_table[(crc ^ ((w >> 16) & 0xFF)) & 0xFF] ^ (crc >> 8); - crc = crc32_table[(crc ^ (w >> 24) ) & 0xFF] ^ (crc >> 8); - } - return crc ^ 0xFFFFFFFF; -} - /* ═══════════════════════════════════════════════════════════════════ */ int main(void) { if (MATMUL_GROUP_NUM <= 0) return 0; volatile uint32_t *extram = (volatile uint32_t *)EXTRAM_BASE_UNCACHED; - uint32_t crc, t_prologue, t_mainloop, t_epilogue, t_crc32; + uint32_t crc, t_prologue, t_mainloop, t_epilogue; int g; // Ping-Pong Register Address Arrays (Physical for DMA) @@ -174,7 +125,8 @@ int main(void) printf("MATMUL_START\n"); // 清理寄存器状态 - REG_WR(MATMUL_STATUS, STATUS_DONE | STATUS_ERROR); + REG_WR(MATMUL_STATUS, STATUS_DONE | STATUS_ERROR); + REG_WR(MATMUL_CRC, 0); // 复位硬件 CRC32 为 0xFFFFFFFF /* ── Prologue: 第0组数据初始化 ────────────────────────── */ t_prologue = get_ns(); @@ -228,10 +180,8 @@ int main(void) wait_dma_done_intr(1); t_epilogue = get_ns() - t_epilogue; - /* ── CRC32 over result region ─────────────────────────────── */ - t_crc32 = get_ns(); - crc = compute_crc32(extram); - t_crc32 = get_ns() - t_crc32; + /* ── Read hardware CRC32 result ──────────────────────────── */ + crc = REG_RD(MATMUL_CRC); /* ── Final markers ────────────────────────────────────────── */ printf("MATMUL_CRC32=%08lx\n", (unsigned long)crc); @@ -239,8 +189,7 @@ int main(void) printf("TIME_LOOP=%lu\n", (unsigned long)t_mainloop); printf("TIME_LOOP_PER=%lu\n", (unsigned long)(t_mainloop / MATMUL_GROUP_NUM)); printf("TIME_EPILOGUE=%lu\n", (unsigned long)t_epilogue); - printf("TIME_CRC32=%lu\n", (unsigned long)t_crc32); - printf("TIME_TOTAL=%lu\n", (unsigned long)(t_prologue + t_mainloop + t_epilogue + t_crc32)); + printf("TIME_TOTAL=%lu\n", (unsigned long)(t_prologue + t_mainloop + t_epilogue)); printf("MATMUL_DONE\n"); return 0; diff --git a/sdk/user-sample.bin b/sdk/user-sample.bin index 12485572ddf8cfd211736c04987161e889805b19..d3159bc92fabdf872afdc75f8ac19b45be856775 100755 GIT binary patch delta 3046 zcma)8eNa@_6~FJig}0HUIu3aYGIN0m)0oJx7VQ`wy9RDNuADnChZDqA9*%Fpgm zW$P`fkftDesBddjt%-`^F<3u~imgZt$vG4<0TCk;?R&z|u87D)VBuM5@$c5n>FoyVsdW4Ca(3px$BK30C>&-Q=HHxt z5Ykcq5e`BeVk0qkm6a+nVug58a%74RcVv>%USzc_l2kYP<(7aSo)QtG2q)4Nlqr%+ zqW#wNm**tBH^VgS{Tf3?(s0;QJmb2jdP5HvO2i ziM%N%Mq)%eA(`S}tcG0`wNK*U-=a#Oa($tRXy2T)0qGa*n-i$4`H^i9gcFd@Mf)K> z2|pKz5iAgdgqufLh|fq0C6cVK-D-s@0ppL0_P@YDJYu8?PMoHFjCQi4al3isKCwMsk` znAPZnM!%{W!vyK82)tbL_Nr%J*dvBtse#rovZ^1k7`2A24XX%Ow?Bi}b`}WR1Qk2g z^6(@98n?5Ch!POqRi(%>0s1OfxoKMTuTJxX#gDPZzCWLazoWk3b+X@^_QOQKy86YE zAeeW6T^X?wiW}K0G3TZ8oI&4*EF^ZBZr|Rku8qwG=_)SNZTNtliObd(gxyRsPu1=F z@3T4PH$d>Pi1>7N-n=pR8ip5$EZ!2wibgeqWe2Wwf>_JW#{Ubxvz_@zzYQC=v2h9i zfP$wy#)5Bo%Z9axVVr#u3w8C$z=?`Co1cS6T5c69ujR2`~=YTWc~CMuIt3+x)! zF$8;%qhroGHgm!#y^N`jt)8$IY)4pwHR@Q(dEDm%>|$y>WF264Q(uJzjclBCjUHRn zfI+cR54OK4HZZ?639_o$7uFPLtYRZo&dy;SD+{v*Vu6nCqmC#DE+@FdHd zv=#a~)r*tT1i0U!is?eI6_tZ558qcsARF>21izOSN z=oDL8FcR*cWaR}ZU^~eU7sNwHCp%k^1g1`Qw;(Y(>jb`URCWnOdkeLO9j$Ea(nPSd zvN=mPfKyfdOGgUuVjH_&_ykNx)$7YFqLh!+A~)<;#Ueq_o%wrM$jaYJIh?bpUcJ8Z zn@}kgox6SSsh_S*48gmlid(9qV4jcFcw(hH;e5CTcGP1TtJ$^&*=>r%_mU)sB~WNG znY6dn)jNY|>mB>muRU2o4*Tr6*~|0i=jG(hd^3CMn9_HK5u#x^d3pKI`^)pQ=MTlQ z^Jo88o;}Z=m7@pE&9cvZGiUjXyxeT8O33Wo?~xytm5|)5TvAq4My$3pwrG#dacUSb z`{HytH^k=H4~Fd7eFAC%`3%+1(r z5PNsTGn-=>F}nY!0nM=)vEPmv%+>X3eQ_v(j3LcAejFQe?7=|e8w1*m&D|&jn+>jU z0`0gnH--@S`2c}-c7Ly;#_vlM9SLjt1LxlE5Bz3ze?Ugz`fsJre7?qoV|;z`5Fwb` zUXJpPF3qUB24pkhgFd%8&i!?04~nO}U-dT#LSp8QhXNi9KM6IOH-{L_MwH#djAnjX z@P7o^J&fJ-efDzGV%$R%4sSCU%?1=V`5(gm*;qX5#vEb}m5k=cMx)s(8qLS^iP?y{ kYcBpUAYO?2M;Mcl!>dP_J=okBj0BKS0WH71f07vMya+aw%E6)?#h6OS_ogd1va!XaD*A=JR&-a}7yyuLcB3pAx`vBh`*L7#G7pt;w=J&cq>qdzxjg_Z+l3I<;|2>7EFl~5-2eUGw|o- zZ8O6}NWKLogGogMQzEX2l0y#I4h^VjLs`HKOv6JhoM;HbSpGbc5>fB9L9uz1Xavp! zk`gmbg2+tL9Fq(rx06#b{>}DsI2-Fu_i|{3<3fyK26V7p$?3aYK}-W)P`Ci3=4(V< zA2bjT)yul-guA5oVGM4TE@9_ku$*M7o)eU)JkJBX#80`f)C`16 zC~>$1j8o-%fb{bopfJr97?=w{A)rLcZtPz+10~gFAP(c=FpjCcvC|b8&k%r1xYsHM zP+VaKVlf~V14=NU7z6muxCsUn;$meMmiO+Y632Oy1fUpWQkWdB>yc?!8w?!^bSEgd z7y=*CUw@jg?LpsQl|zp1)T;B)4$f?-IE;Saj2m}87n)H*IYiq(Y*)VCuol0LDD$%5G>(?u(u}o7`Y!pr}^8B-4A>W zeRcrNG2RFV=h9Wib_8@hfVxZ~pn5;;DTpJWbT6thoo(*7iz!(44)@4ezYG43^$kZg zG8&u<+f?+)!4U?qy9^Dn2!XFlQKH3l&I^nv_AN#Whp*JzvXk`b;qxG;7bh~|arBSn zJbgla40#G&^tR$C+AZ{g>ceQsNN2>iTF?0#!voQGXtnJKly7wkmL0&UGZ5toDASvKSp$wsWjxv3X z?{VZeX%r;XC~;Cg=Q=Jewmpihoy^DOD`7IGn}X?XYM{i`IAyUu9Rk)Y|M&(L>*0}t_g3=87*xb7;NbIANJk5zO1Zq)o zLlR^Tvl8EN=?q`To$v@IN;!fs74~oVW{6bNOo55S6g1g`7$rl%ZI6gA(O;G<{N6M5 zI;?CDdNzN=jBb@kN#V<#fhw?_(QnI`xI)a+YRw8I_$_7f`RO8MUVq+Hh2|`ny;PD4 zlW{6JLn#70!bb;dNzrXzXoChO+Td#*UjX|t=FMIN_jAEAz~cDpaJG8f^9u^7Wa7`+ z`gmC~YFps!;JY940bXQT9c1GL8we=`!uc?LBH_X4LQ1i`UoxeJ3%r>Y<$2v*po>g4lpNR*&bB2Oa*1>$aA?J zJg-FY%LAcwH@b>d_f9l6a2>QwLx%!Kz_J~vD$oJ;q@pK*_)w-IPLLgJNkJ2XMwz!H z;}0h#N+y8r;)-E5-mM-*291Jcb!d0cI_Q=}YlB7*u(cjpuKWO7&eE2vY)MW6MhYgC z(C$)#&^v=qpoJkr^88j_LS2Kolc+4#I zY4j|^cC60sDG@161pspy$G4&25mQsZoS)Xl7t)O=aZ>rS`&*o zMTc$f3wi(iO1OO2k`=_zju>`msEf(pfAYEMmu=!^t`e;Ee(V-}bDb>myOzh~EYEh< z!uKis*62#Z!oQ0ur^IBJ&%Jf!+&$O6+EYKp+?n*%imrK0{9E^zyR@7vwOJr`5dcvU(7*!2Yh;>#c3daPRhimPyMO-SDlPu>sT;Jd&JicPs4j zx}9~$CAP8U$UnWe+M=GWb${0pH~I6l$l~Ve;JfSXSsp)Ikxr|<4NqLz%6~9RX5e$e z4UQEEjOtTucvr?$t_h%1;%x@CN7NjCEWKge*SRYDN{4t(_p+ zq@`C!Bt_KbwZ@NeezfL`tVG^5($nZ%jX4}O(azw@`k7}hiHz#X_Xf%<#PIEx%eG9jJi|MrYTe7Pzxi|3%llhxyY3max3;CuebnCbmVU4%F6plIb@O^fkX_AR z-HD~~iJny!zXWpA5~57BKgwsaBUTs@rrO-_J!?xs-nMC@rSqC%%r`wU%=^8Sf7?Ha zwfF)}PM6w69(!XR+`Pzh?SgxWakIUmT1xH*-s*@j>T>;K=AEg2CAG&d<(})5HCaUeZPjXt`!(=J@z= zQ|pZ?@>RTxmR$yc=`W!@dbrO+zR3^>gDv%<{KRHrqEGxxY*+OAr?9T=w?`WR;e`J~ z24?(A%XP!6d3pkkxY1iIj6Wd%DiFrt{6K8}u#Ywqd)M!0TYQYOhJUmN>OSgdeezQR z@BT$#1NNC%1s0|-r(fSU2SRT=umQ_JjvfBI&reffivk(YN4RJM(E4;(z3OD#*AM34)nA5}+3bCGyG4HSdU?OzI97+da O!TcI=z6jSfWBniZqJ-H1