summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/conf/machine/include/microblaze/arch-microblaze.inc53
-rw-r--r--meta/conf/machine/include/microblaze/feature-microblaze-math.inc33
-rw-r--r--meta/conf/machine/include/microblaze/feature-microblaze-versions.inc67
-rw-r--r--meta/conf/machine/include/tune-microblaze.inc8
4 files changed, 161 insertions, 0 deletions
diff --git a/meta/conf/machine/include/microblaze/arch-microblaze.inc b/meta/conf/machine/include/microblaze/arch-microblaze.inc
new file mode 100644
index 0000000000..eab7171cb2
--- /dev/null
+++ b/meta/conf/machine/include/microblaze/arch-microblaze.inc
@@ -0,0 +1,53 @@
1# MicroBlaze architecture tune feature configuration
2
3# Architecture feature and override
4TUNEVALID[microblaze] = "MicroBlaze"
5MACHINEOVERRIDES =. "${@bb.utils.contains("TUNE_FEATURES", "microblaze", "microblaze:", "", d)}"
6
7# Endian
8TUNEVALID[bigendian] = "Use Microblaze Big Endian"
9TUNECONFLICTS[bigendian] += "v10.0"
10
11MBPKGARCH_ENDIAN = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", "eb", "el", d)}"
12
13TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "bigendian", "-mbig-endian", "-mlittle-endian", d)}"
14
15# General features
16TUNEVALID[barrel-shift] = "Enable Hardware Barrel Shifter"
17TUNEVALID[pattern-compare] = "Enable Pattern Compare Instructions"
18TUNEVALID[reorder] = "Enable Reorder Instructions"
19TUNECONFLICTS[reorder] += "v8.00 v8.10 v8.20"
20
21# Core configuration tune optimizations
22TUNEVALID[frequency-optimized] = "Enabling tuning for frequency optimized core (AREA_OPTIMIZED_2)"
23TUNECONFLICTS[frequency-optimized] += "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1 v9.2 v9.3 v9.4 v9.5 v9.6"
24
25# Feature compiler args
26TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "barrel-shift", "-mxl-barrel-shift", "-mno-xl-barrel-shift", d)}"
27TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "pattern-compare", "-mxl-pattern-compare", "-mno-xl-pattern-compare", d)}"
28TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "frequency-optimized", "-mxl-frequency", "", d)}"
29
30# Disable reorder for v8.30 if pattern-compare is not enabled
31TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "reorder", \
32 bb.utils.contains("TUNE_FEATURES", "v8.30", \
33 bb.utils.contains("TUNE_FEATURES", "pattern-compare", \
34 "-mxl-reorder", "-mno-xl-reorder", d), \
35 "-mxl-reorder", d), "-mno-xl-reorder", d)}"
36
37# Feature package architecture formatting
38MBPKGARCH_TUNE = ""
39MBPKGARCH_TUNE .= "${@bb.utils.contains("TUNE_FEATURES", "barrel-shift", "-bs", "", d)}"
40MBPKGARCH_TUNE .= "${@bb.utils.contains("TUNE_FEATURES", "pattern-compare", "-cmp", "", d)}"
41MBPKGARCH_TUNE .= "${@bb.utils.contains("TUNE_FEATURES", "reorder", "-re", "", d)}"
42MBPKGARCH_TUNE .= "${@bb.utils.contains("TUNE_FEATURES", "frequency-optimized", "-fo", "", d)}"
43
44# Additional features
45require conf/machine/include/microblaze/feature-microblaze-versions.inc
46require conf/machine/include/microblaze/feature-microblaze-math.inc
47
48# Architecture name, either 'microblazeeb' or 'microblazeel' depending on endianess
49TUNE_ARCH = "microblaze${@bb.utils.contains("TUNE_FEATURES", "bigendian", "eb", "el", d)}"
50
51# Package Architecture formatting
52TUNE_PKGARCH = "microblaze${MBPKGARCH_ENDIAN}${MBPKGARCH_VERSION}${MBPKGARCH_TUNE}${MBPKGARCH_MATH}"
53
diff --git a/meta/conf/machine/include/microblaze/feature-microblaze-math.inc b/meta/conf/machine/include/microblaze/feature-microblaze-math.inc
new file mode 100644
index 0000000000..a31516659c
--- /dev/null
+++ b/meta/conf/machine/include/microblaze/feature-microblaze-math.inc
@@ -0,0 +1,33 @@
1# This include describes the math features (integer and floating point) that
2# are available for the MicroBlaze ISA
3
4TUNEVALID[multiply-low] = "Hardware multipler with 32 bit result"
5TUNEVALID[multiply-high] = "Hardware multipler with 64 bit result"
6TUNEVALID[divide-hard] = "Hardware divider"
7TUNEVALID[fpu-soft] = "Software FPU"
8TUNEVALID[fpu-hard] = "Hardware FPU in basic mode"
9TUNEVALID[fpu-hard-extended] = "Hardware FPU in extended mode (conversion and square root instructions)"
10
11TUNECONFLICTS[fpu-soft] = "fpu-hard fpu-hard-extended"
12TUNECONFLICTS[fpu-hard] = "fpu-soft"
13TUNECONFLICTS[fpu-hard-extended] = "fpu-soft"
14
15# Compiler args
16TUNE_CCARGS += "${@bb.utils.contains_any('TUNE_FEATURES', ['multiply-low', 'multiply-high'], '-mno-xl-soft-mul', '-mxl-soft-mul', d)}"
17TUNE_CCARGS += "${@bb.utils.contains('TUNE_FEATURES', 'multiply-high', '-mxl-multiply-high', '', d)}"
18
19TUNE_CCARGS += "${@bb.utils.contains('TUNE_FEATURES', 'divide-hard', '-mno-xl-soft-div', '-mxl-soft-div', d)}"
20
21TUNE_CCARGS += "${@bb.utils.contains('TUNE_FEATURES', 'fpu-soft', '', '', d)}"
22TUNE_CCARGS += "${@bb.utils.contains_any('TUNE_FEATURES', ['fpu-hard', 'fpu-hard-extended'], '-mhard-float', '', d)}"
23TUNE_CCARGS += "${@bb.utils.contains('TUNE_FEATURES', 'fpu-hard-extended', '-mxl-float-convert -mxl-float-sqrt', '', d)}"
24
25# Set target fpu (bitbake known target) to soft or hard (basic or extended)
26TARGET_FPU = "${@bb.utils.contains_any('TUNE_FEATURES', 'fpu-hard fpu-hard-extended', 'fpu-hard', 'fpu-soft', d)}"
27
28# Package Architecture formatting
29MBPKGARCH_MATH = ""
30MBPKGARCH_MATH .= "${@bb.utils.contains('TUNE_FEATURES', 'multiply-high', '-mh', bb.utils.contains('TUNE_FEATURES', 'multiply-low', '-ml', '', d), d)}"
31MBPKGARCH_MATH .= "${@bb.utils.contains('TUNE_FEATURES', 'divide-hard', '-div', '', d)}"
32MBPKGARCH_MATH .= "${@bb.utils.contains('TUNE_FEATURES', 'fpu-hard-extended', '-fe', bb.utils.contains('TUNE_FEATURES', 'fpu-hard', '-fb', '', d), d)}"
33
diff --git a/meta/conf/machine/include/microblaze/feature-microblaze-versions.inc b/meta/conf/machine/include/microblaze/feature-microblaze-versions.inc
new file mode 100644
index 0000000000..955674fff9
--- /dev/null
+++ b/meta/conf/machine/include/microblaze/feature-microblaze-versions.inc
@@ -0,0 +1,67 @@
1# MicroBlaze versions are defined as features, the features are setup to
2# conflict with other versions as well as unavailable features for particular
3# versions.
4#
5# Versions before v9.0 of MicroBlaze use a versioning scheme of "vX.YY.Z"
6# (where Z = [abc]). For v8.* versions of MicroBlaze the revision (Z) changes
7# did not affect ABI and are ignored by this tune configuration. Though this
8# format is expected by GCC including the revision, but this is defaulted to
9# ".a".
10#
11# Since v9.0 of MicroBlaze the revision (Z) part of versions was entirely
12# dropped and the version scheme was changed to "vX.Y".
13
14def microblaze_current_version(d, gcc = False):
15 import re
16 # find the current version, and convert it to major/minor integers
17 version = None
18 for t in (d.getVar("TUNE_FEATURES") or "").split():
19 m = re.search("^v(\d+)\.(\d+)", t)
20 if m:
21 version = int(m.group(1)), int(m.group(2))
22 break
23
24 # format the version string in generic or GCC specific formats
25 if version:
26 if version[0] <= 8:
27 return ("v%d.%02d" % version[0:2]) + (".a" if gcc else "")
28 else:
29 return "v%d.%d" % version[0:2]
30 return ""
31
32# MicroBlaze versions
33TUNEVALID[v8.00] = "MicroBlaze version 8.00"
34TUNEVALID[v8.10] = "MicroBlaze version 8.10"
35TUNEVALID[v8.20] = "MicroBlaze version 8.20"
36TUNEVALID[v8.30] = "MicroBlaze version 8.30"
37TUNEVALID[v8.40] = "MicroBlaze version 8.40"
38TUNEVALID[v8.50] = "MicroBlaze version 8.50"
39TUNEVALID[v9.0] = "MicroBlaze version 9.0"
40TUNEVALID[v9.1] = "MicroBlaze version 9.1"
41TUNEVALID[v9.2] = "MicroBlaze version 9.2"
42TUNEVALID[v9.3] = "MicroBlaze version 9.3"
43TUNEVALID[v9.4] = "MicroBlaze version 9.4"
44TUNEVALID[v9.5] = "MicroBlaze version 9.5"
45TUNEVALID[v9.6] = "MicroBlaze version 9.6"
46TUNEVALID[v10.0] = "MicroBlaze version 10.0"
47
48# Version conflict matrix
49TUNECONFLICTS[v8.00] = ""
50TUNECONFLICTS[v8.10] = "v8.00"
51TUNECONFLICTS[v8.20] = "v8.00 v8.10"
52TUNECONFLICTS[v8.30] = "v8.00 v8.10 v8.20"
53TUNECONFLICTS[v8.40] = "v8.00 v8.10 v8.20 v8.30"
54TUNECONFLICTS[v8.50] = "v8.00 v8.10 v8.20 v8.30 v8.40"
55TUNECONFLICTS[v9.0] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50"
56TUNECONFLICTS[v9.1] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0"
57TUNECONFLICTS[v9.2] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1"
58TUNECONFLICTS[v9.3] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1 v9.2"
59TUNECONFLICTS[v9.4] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1 v9.2 v9.3"
60TUNECONFLICTS[v9.5] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1 v9.2 v9.3 v9.4"
61TUNECONFLICTS[v9.6] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1 v9.2 v9.3 v9.4 v9.5"
62TUNECONFLICTS[v10.0] = "v8.00 v8.10 v8.20 v8.30 v8.40 v8.50 v9.0 v9.1 v9.2 v9.3 v9.4 v9.5 v9.6"
63
64# Version flags
65TUNE_CCARGS += "-mcpu=${@microblaze_current_version(d, True)}"
66MBPKGARCH_VERSION = "-${@microblaze_current_version(d)}"
67
diff --git a/meta/conf/machine/include/tune-microblaze.inc b/meta/conf/machine/include/tune-microblaze.inc
new file mode 100644
index 0000000000..41f0afe668
--- /dev/null
+++ b/meta/conf/machine/include/tune-microblaze.inc
@@ -0,0 +1,8 @@
1DEFAULTTUNE ?= "microblaze"
2
3require conf/machine/include/microblaze/arch-microblaze.inc
4
5AVAILTUNES += "microblaze"
6TUNE_FEATURES_tune-microblaze = "microblaze"
7PACKAGE_EXTRA_ARCHS_tune-microblaze = "${TUNE_PKGARCH}"
8