Skip to content

Commit

Permalink
Merge pull request #737 from stffrdhrn/or1k-linux-insns
Browse files Browse the repository at this point in the history
mor1kx: Enable rotate, fpu and sign extensions under linux
  • Loading branch information
mithro authored Dec 22, 2020
2 parents d90d3e0 + 3067c57 commit b3a0b4b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions litex/soc/cores/cpu/mor1kx/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from litex.soc.interconnect import wishbone
from litex.soc.cores.cpu import CPU

CPU_VARIANTS = ["standard", "linux"]
CPU_VARIANTS = ["standard", "standard+fpu", "linux", "linux+fpu"]


class MOR1KX(CPU):
Expand Down Expand Up @@ -50,7 +50,13 @@ def gcc_triple(self):
def gcc_flags(self):
flags = "-mhard-mul "
flags += "-mhard-div "
flags += "-mcmov "
flags += "-D__mor1kx__ "

if "linux" in self.variant:
flags += "-mror "
flags += "-msext "

return flags

@property
Expand All @@ -77,7 +83,7 @@ def __init__(self, platform, variant="standard"):
self.memory_buses = []


if variant == "linux":
if "linux" in variant:
self.mem_map = self.mem_map_linux

# # #
Expand Down Expand Up @@ -107,14 +113,21 @@ def __init__(self, platform, variant="standard"):
p_DBUS_WB_TYPE = "B3_REGISTERED_FEEDBACK",
)

if variant == "linux":
if "fpu" in variant:
cpu_args.update(
p_FEATURE_FPU = "ENABLED",
)

if "linux" in variant:
cpu_args.update(
# Linux needs the memory management units.
p_FEATURE_IMMU = "ENABLED",
p_FEATURE_DMMU = "ENABLED",
# FIXME: Currently we need the or1k timer when we should be
# using the litex timer.
p_FEATURE_TIMER = "ENABLED",
p_FEATURE_ROR = "ENABLED",
p_FEATURE_EXT = "ENABLED",
)
# FIXME: Check if these are needed?
use_defaults = (
Expand Down

0 comments on commit b3a0b4b

Please sign in to comment.