Skip to content

Commit

Permalink
mor1kx: Enable rotate, sign extend under linux, new fpu extension
Browse files Browse the repository at this point in the history
My thought is that if we are running linux the FPGA should be able to
handle these extra instruction's footprint.  Also, since we are running
on linux there may be any kind of software running on the CPU, so allow
handling these instructions.

FPU is added bia a new +fpu extension.

But really, I am running GLIBC tests and they run faster with this
enabled.
  • Loading branch information
stffrdhrn committed Dec 22, 2020
1 parent d90d3e0 commit 51327e0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 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 @@ -51,6 +51,11 @@ def gcc_flags(self):
flags = "-mhard-mul "
flags += "-mhard-div "
flags += "-D__mor1kx__ "

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

return flags

@property
Expand All @@ -77,7 +82,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 +112,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 51327e0

Please sign in to comment.