@@ -14,26 +14,41 @@ package spatz_pkg;
1414 // ////////////////
1515 // Parameters //
1616 // ////////////////
17-
17+
1818 // Number of IPUs in each VFU (between 1 and 8)
19- localparam int unsigned N_IPU = 1 ;
19+ `ifdef SPATZ_N_IPU
20+ localparam int unsigned N_IPU = `SPATZ_N_IPU ;
21+ `else
22+ localparam int unsigned N_IPU = 1 ;
23+ `endif
2024 // Number of FPUs in each VFU (between 1 and 8)
21- localparam int unsigned N_FPU = 4 ;
25+ `ifdef SPATZ_N_FPU
26+ localparam int unsigned N_FPU = `SPATZ_N_FPU ;
27+ `else
28+ localparam int unsigned N_FPU = 4 ;
29+ `endif
2230 // Number of FUs in each VFU
2331 localparam int unsigned N_FU = N_IPU > N_FPU ? N_IPU : N_FPU ;
2432 // FPU support
2533 localparam bit FPU = N_FPU != 0 ;
2634 // Single-precision floating point support
27- localparam bit RVF = 1 ;
35+ `ifdef SPATZ_RVF
36+ localparam bit RVF = `SPATZ_RVF ;
37+ `else
38+ localparam bit RVF = 1'b1 ;
39+ `endif
2840 // Double-precision floating-point support
2941 `ifdef SPATZ_RVD
3042 localparam bit RVD = `SPATZ_RVD ;
3143 `else
32- localparam bit RVD = 0 ; // Default
44+ localparam bit RVD = 0 ;
3345 `endif
3446 // Vector support
35- localparam bit RVV = 1 ;
36-
47+ `ifdef SPATZ_RVV
48+ localparam bit RVV = `SPATZ_RVV ;
49+ `else
50+ localparam bit RVV = 1'b1 ;
51+ `endif
3752 // Maximum size of a single vector element in bits
3853 localparam int unsigned ELEN = RVD ? 64 : 32 ; // = 64 with RVD=1
3954 // Maximum size of a single vector element in bytes
@@ -42,15 +57,18 @@ package spatz_pkg;
4257 `ifdef SPATZ_VLEN
4358 localparam int unsigned VLEN = `SPATZ_VLEN ;
4459 `else
45- localparam int unsigned VLEN = 256 ; // Default: 256 bits
60+ localparam int unsigned VLEN = 256 ;
4661 `endif
4762 // Number of bytes in a vector register
4863 localparam int unsigned VLENB = VLEN / 8 ;
4964 // Maximum vector length in elements
5065 localparam int unsigned MAXVL = VLEN ;
5166 // Number of vector registers
52- localparam int unsigned NRVREG = 32 ;
53-
67+ `ifdef SPATZ_NRVREG
68+ localparam int unsigned NRVREG = `SPATZ_NRVREG ;
69+ `else
70+ localparam int unsigned NRVREG = 32 ;
71+ `endif
5472 // Spatz' data width
5573 localparam int unsigned DataWidth = ELEN ;
5674 // Spatz' strobe width
@@ -64,8 +82,12 @@ package spatz_pkg;
6482 localparam int unsigned NrWordsPerVector = VLEN / VRFWordWidth;
6583 // Number of VRF words
6684 localparam int unsigned NrVRFWords = NRVREG * NrWordsPerVector;
67- // Number of VRF banks
68- localparam int unsigned NrVRFBanks = 4 ;
85+ // Number of VRF banks (affects banking conflicts and parallel access)
86+ `ifdef SPATZ_NR_VRF_BANKS
87+ localparam int unsigned NrVRFBanks = `SPATZ_NR_VRF_BANKS ;
88+ `else
89+ localparam int unsigned NrVRFBanks = 4 ; // Default
90+ `endif
6991 // Number of elements per VRF Bank
7092 localparam int unsigned NrWordsPerBank = NrVRFWords / NrVRFBanks;
7193
@@ -77,7 +99,11 @@ package spatz_pkg;
7799 localparam int GPRWidth = FPU ? 6 : 5 ;
78100
79101 // Number of parallel vector instructions
80- localparam int unsigned NrParallelInstructions = 4 ;
102+ `ifdef SPATZ_NR_PARALLEL_INSTR
103+ localparam int unsigned NrParallelInstructions = `SPATZ_NR_PARALLEL_INSTR ;
104+ `else
105+ localparam int unsigned NrParallelInstructions = 4 ;
106+ `endif
81107
82108 // Largest element width that Spatz supports
83109 localparam vew_e MAXEW = RVD ? EW_64 : EW_32 ;
@@ -350,8 +376,13 @@ package spatz_pkg;
350376 // FPU Configuration //
351377 // ///////////////////////
352378
353- // No support for floating-point division and square-root for now
354- localparam bit FDivSqrt = 1'b0 ;
379+ // FP division and square-root support
380+ // No support for floating point division/square-root for now
381+ `ifdef SPATZ_XDIVSQRT
382+ localparam bit FDivSqrt = `SPATZ_XDIVSQRT ;
383+ `else
384+ localparam bit FDivSqrt = 1'b0 ;
385+ `endif
355386
356387 localparam int unsigned FLEN = RVD ? 64 : 32 ;
357388
0 commit comments