microwatt.git
5 years agodecode: Index minor op table with insn bits for opcode 31
Paul Mackerras [Mon, 30 Sep 2019 05:03:06 +0000 (15:03 +1000)]
decode: Index minor op table with insn bits for opcode 31

This changes decode_op_31_array from being indexed by a ppc_insn_t
(which is derived from the instruction word by a whole series of
if/elsif statements) to being indexed directly by bits 10...1 of
the instruction word.  With this we no longer need ppc_insn.

This then means that the decode1 stage doesn't distinguish between
mfcr and mfocrf, or between mtcrf and mtocrf, since those are
distinguished by the value in bit 20 of the instruction.  To
accommodate that, execute1 changes so that the one op value (OP_MFCR)
does either the mfcr or the mfocrf behaviour depending on bit 20
of the instruction word; and similarly for mtcrf/mtocrf.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agodecode: Index minor op table with insn bits for opcode 30
Paul Mackerras [Sun, 29 Sep 2019 06:41:52 +0000 (16:41 +1000)]
decode: Index minor op table with insn bits for opcode 30

This comprises the 64-bit rotate and mask instructions.  In order to
reduce the table index to 3 bits, we combine rldcl and rdlcr into a
single op (OP_RLDCX), and choose the right mask at execute time based
on bit 1 of the instruction word.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agodecode: Index minor op table with insn bits for opcode 19
Paul Mackerras [Sun, 29 Sep 2019 06:26:07 +0000 (16:26 +1000)]
decode: Index minor op table with insn bits for opcode 19

This changes the decoding of major opcode 19 from using the ppc_insn_t
index to using bits of the instruction word directly.  Opcode 19 has
a 10-bit minor opcode field (bits 10..1) but the space is sparsely
filled.  Therefore we index a table of single-bit entries with the
10-bit minor opcode to filter out the illegal minor opcodes, and
index a table using just 3 bits -- 5, 3 and 2 -- of the instruction
to get the decode entry.  This groups together all the instructions
in 4 columns of the opcode map as a single entry.  That means that
mcrf and all the CR logical ops get grouped together, and bcctr, bclr
and bctar get grouped together.  At present the CR logical ops are not
implemented, so their grouping has no impact.

The code for bclr and bcctr in execute1 is now common, using a single
op, and it now determines the branch address by looking at bit 10 of
the instruction word at execute time.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agodecode: Start moving towards decoding by major opcode first
Paul Mackerras [Sat, 28 Sep 2019 23:17:39 +0000 (09:17 +1000)]
decode: Start moving towards decoding by major opcode first

With this, we have a table for most major opcodes and separate
tables for each major opcode that has further decoding required.
These tables are still mostly indexed by the ppc_insn_t values,
however.

A few things are still decoded completely at the top level: nop,
attn and sim_config.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agodecode: Push mtspr/mfspr register decoding down into execute1
Paul Mackerras [Sat, 28 Sep 2019 04:43:46 +0000 (14:43 +1000)]
decode: Push mtspr/mfspr register decoding down into execute1

Instead of doing mfctr, mflr, mftb, mtctr, mtlr as separate ops,
just pass down mfspr and mtspr ops with the spr number and let
execute1 decode which SPR we're addressing.  This will help reduce
the number of instruction bits decode1 needs to look at.

In fact we now pass down the whole instruction from decode2 to
execute1.  We will need more bits of the instruction in future,
and the tools should just optimize away any that we don't end
up using.  Since the 'aa' bit was just a copy of an instruction
bit, we can now remove it from the record.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agoAdd MCRF instruction
Benjamin Herrenschmidt [Tue, 24 Sep 2019 14:09:35 +0000 (00:09 +1000)]
Add MCRF instruction

Hopefully it's not too timing catastrophic. The variable newcrf will
be handy for the other CR ops when we implement them I suspect.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoImplement absolute branches
Benjamin Herrenschmidt [Tue, 24 Sep 2019 05:47:25 +0000 (15:47 +1000)]
Implement absolute branches

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoMerge pull request #77 from antonblanchard/timing
Anton Blanchard [Mon, 30 Sep 2019 08:21:54 +0000 (18:21 +1000)]
Merge pull request #77 from antonblanchard/timing

A number of timing fixes

5 years agoMerge pull request #76 from antonblanchard/misc
Anton Blanchard [Mon, 30 Sep 2019 08:00:41 +0000 (18:00 +1000)]
Merge pull request #76 from antonblanchard/misc

Some misc updates

5 years agoImprove PLL/MMCM clocks configuration
Benjamin Herrenschmidt [Tue, 24 Sep 2019 04:57:34 +0000 (14:57 +1000)]
Improve PLL/MMCM clocks configuration

We can now pass both the input clock and target clock frequency
via generics. Add support for both 50Mhz and 100Mhz target freqs
for both cases.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoDon't reset JTAG request register asynchronously
Benjamin Herrenschmidt [Thu, 26 Sep 2019 01:09:46 +0000 (11:09 +1000)]
Don't reset JTAG request register asynchronously

There's no point and it causes Vivado to spew a pile of warnings

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoMultiply needs to be 16 stages to fix all timing issues
Benjamin Herrenschmidt [Thu, 26 Sep 2019 00:53:55 +0000 (10:53 +1000)]
Multiply needs to be 16 stages to fix all timing issues

This seems dependent on the FPGA type/size, so we should probably
make it a toplevel generic, but for now this helps on the
Arty A7-35

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoloadstore2: Do data formatting after a register stage
Paul Mackerras [Wed, 25 Sep 2019 10:27:08 +0000 (20:27 +1000)]
loadstore2: Do data formatting after a register stage

This moves the data formatting for read data to after a register,
instead of before, in order to improve timing.  The data formatting
is now effectively combinational logic on the input side of the
writeback stage.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agocorefile: Remove duplicate wishbone_debug_master
Benjamin Herrenschmidt [Mon, 30 Sep 2019 03:54:04 +0000 (13:54 +1000)]
corefile: Remove duplicate wishbone_debug_master

It's both in core and soc, it should only be in the latter

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agofpga: Arty A7's don't need multiple filesets
Benjamin Herrenschmidt [Mon, 30 Sep 2019 02:56:09 +0000 (12:56 +1000)]
fpga: Arty A7's don't need multiple filesets

the XDC is identical between variants, so is the fileset

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoexecute1: simplify flush_out
Benjamin Herrenschmidt [Wed, 25 Sep 2019 06:42:44 +0000 (16:42 +1000)]
execute1: simplify flush_out

It's always set when f_out.redirect is set, so may as well set it once
at the end. It's all combo from the register.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoReformat fetch2
Benjamin Herrenschmidt [Wed, 25 Sep 2019 01:28:20 +0000 (11:28 +1000)]
Reformat fetch2

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoMove fetch2 <-> icache definitions
Benjamin Herrenschmidt [Wed, 25 Sep 2019 01:26:36 +0000 (11:26 +1000)]
Move fetch2 <-> icache definitions

To a more logical place before decode related ones

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoRemove unused pipe_stop in Fetch1ToFetch2Type
Benjamin Herrenschmidt [Wed, 25 Sep 2019 02:48:15 +0000 (12:48 +1000)]
Remove unused pipe_stop in Fetch1ToFetch2Type

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoFix PLL reset signal name in toplevel
Benjamin Herrenschmidt [Wed, 11 Sep 2019 11:18:22 +0000 (12:18 +0100)]
Fix PLL reset signal name in toplevel

It shouldn't have a _n suffix, it's active positive.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoSimplify fetch1
Benjamin Herrenschmidt [Tue, 24 Sep 2019 02:17:42 +0000 (12:17 +1000)]
Simplify fetch1

Do the +4 in a single place. This shouldn't cause any difference
in behaviour as these are sequential variable assignments.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoReformat fetch1
Benjamin Herrenschmidt [Tue, 24 Sep 2019 02:11:24 +0000 (12:11 +1000)]
Reformat fetch1

No code change

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoUpdate dependency
Benjamin Herrenschmidt [Wed, 25 Sep 2019 06:54:25 +0000 (16:54 +1000)]
Update dependency

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoMerge pull request #75 from paulusmack/master
Anton Blanchard [Sat, 28 Sep 2019 04:32:31 +0000 (14:32 +1000)]
Merge pull request #75 from paulusmack/master

fpga: Add definitions for Arty A7-100 board

5 years agoMerge pull request #74 from paulusmack/divider
Anton Blanchard [Sat, 28 Sep 2019 04:32:14 +0000 (14:32 +1000)]
Merge pull request #74 from paulusmack/divider

Divider

5 years agofpga: Add definitions for Arty A7-100 board
Paul Mackerras [Fri, 27 Sep 2019 23:08:13 +0000 (09:08 +1000)]
fpga: Add definitions for Arty A7-100 board

These are a copy of the A7-35 definitions with 35 changed to 100.
The A7-100 uses the same .xdc file (arty_a7-35.xdc) as the A7-35
since the only difference between the two is the FPGA part; the
hardware and connections on the two boards are identical.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agodivider: Do absolute-value ops in divider instead of decode
Paul Mackerras [Fri, 27 Sep 2019 22:55:08 +0000 (08:55 +1000)]
divider: Do absolute-value ops in divider instead of decode

This moves the negation of negative operands for signed divide and
modulus operations out of the decode2 stage and into the divider.
If either of the operands for a signed divide or modulus operation
is negative, the divider now takes an extra cycle to negate the
operands that are negative.

The interface to the divider now has an 'is_signed' signal rather
than a 'neg_result' signal, and the dividend and divisor can be
negative, so divider_tb had to be updated for the new interface.

The reason for doing this is that one of the worst timing violations
on the Arty A7-100 at 100MHz involved the carry chain in the adders
that did the negation of the dividend and divisor in the decode stage.
Moving the negations to a separate cycle fixes that and also seems to
reduce the total number of slice LUTs used.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agodivider: Always compute result/sresult/d_out.write_reg_data
Paul Mackerras [Wed, 25 Sep 2019 10:03:46 +0000 (20:03 +1000)]
divider: Always compute result/sresult/d_out.write_reg_data

These are intended to be combinatorial.  The previous code was giving
warnings in vivado about registers/latches with no clock defined.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agoMerge pull request #73 from antonblanchard/remove-divide-patch
Anton Blanchard [Tue, 24 Sep 2019 23:13:18 +0000 (09:13 +1000)]
Merge pull request #73 from antonblanchard/remove-divide-patch

Remove gcc software divide patch

5 years agoRemove gcc software divide patch
Anton Blanchard [Tue, 24 Sep 2019 22:03:10 +0000 (08:03 +1000)]
Remove gcc software divide patch

We have a divider, thanks to Paul.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #72 from antonblanchard/build-error
Anton Blanchard [Tue, 24 Sep 2019 10:54:28 +0000 (20:54 +1000)]
Merge pull request #72 from antonblanchard/build-error

Fix build issue in dmi_dtm_dummy.vhdl

5 years agoMerge pull request #71 from antonblanchard/dependencies
Anton Blanchard [Tue, 24 Sep 2019 10:34:52 +0000 (20:34 +1000)]
Merge pull request #71 from antonblanchard/dependencies

Update Makefile dependencies

5 years agoFix build issue in dmi_dtm_dummy.vhdl
Anton Blanchard [Tue, 24 Sep 2019 10:27:34 +0000 (20:27 +1000)]
Fix build issue in dmi_dtm_dummy.vhdl

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoUpdate Makefile dependencies
Anton Blanchard [Tue, 24 Sep 2019 07:50:17 +0000 (17:50 +1000)]
Update Makefile dependencies

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge branch 'divider' of https://github.com/paulusmack/microwatt
Anton Blanchard [Tue, 24 Sep 2019 07:33:21 +0000 (17:33 +1000)]
Merge branch 'divider' of https://github.com/paulusmack/microwatt

5 years agoMerge pull request #70 from antonblanchard/badly-named-carry
Anton Blanchard [Tue, 24 Sep 2019 07:25:44 +0000 (17:25 +1000)]
Merge pull request #70 from antonblanchard/badly-named-carry

Rename OP_SUBFC -> OP_SUBFE, OP_ADDC -> OP_ADDE

5 years agoRename OP_SUBFC -> OP_SUBFE, OP_ADDC -> OP_ADDE
Anton Blanchard [Tue, 24 Sep 2019 06:55:09 +0000 (16:55 +1000)]
Rename OP_SUBFC -> OP_SUBFE, OP_ADDC -> OP_ADDE

These were somewhat badly named.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #69 from antonblanchard/debug-module
Anton Blanchard [Tue, 24 Sep 2019 06:51:03 +0000 (16:51 +1000)]
Merge pull request #69 from antonblanchard/debug-module

Merge debug module patches

5 years agoTerminate test on illegal instruction
Anton Blanchard [Mon, 23 Sep 2019 11:22:18 +0000 (21:22 +1000)]
Terminate test on illegal instruction

This gets the CI going again, but we will want to fix the test
harness since it's useful to be able to debug the core after it
executes an illegal instruction.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoFix ghdl error
Anton Blanchard [Mon, 23 Sep 2019 11:20:12 +0000 (21:20 +1000)]
Fix ghdl error

I'm seeing an issue on my version of ghdl:

  core.vhdl:137:24:error: actual expression must be globally static

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoAdd core_debug.vhdl to fusesoc configs
Anton Blanchard [Mon, 23 Sep 2019 10:49:21 +0000 (20:49 +1000)]
Add core_debug.vhdl to fusesoc configs

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoSpeed up the divider a little
Paul Mackerras [Mon, 23 Sep 2019 04:39:50 +0000 (14:39 +1000)]
Speed up the divider a little

This looks for cases where the next 8 bits of the quotient are obviously
going to be zero, because the top 72 bits of the 128-bit dividend
register are all zero.  In those cases we shift 8 zero bits into the
quotient and increase count by 8.  We only do this if count < 56.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agoAdd a divider unit and a testbench for it
Paul Mackerras [Sun, 22 Sep 2019 07:24:14 +0000 (17:24 +1000)]
Add a divider unit and a testbench for it

This adds a divider unit, connected to the core in much the same way
that the multiplier unit is connected.  The division algorithm is
very simple-minded, taking 64 clock cycles for any division (even
32-bit division instructions).

The decoding is simplified by making use of regularities in the
instruction encoding for div* and mod* instructions.  Instead of
having PPC_* encodings from the first-stage decoder for each of the
different div* and mod* instructions, we now just have PPC_DIV and
PPC_MOD, and the inputs to the divider that indicate what sort of
division operation to do are derived from instruction word bits.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
5 years agoAdd distclean to Makefile
Benjamin Herrenschmidt [Fri, 20 Sep 2019 06:45:26 +0000 (16:45 +1000)]
Add distclean to Makefile

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoNew C based JTAG debug tool
Benjamin Herrenschmidt [Mon, 16 Sep 2019 15:29:08 +0000 (16:29 +0100)]
New C based JTAG debug tool

This works with both the sim socket and urjtag, and supports the
new core functions, loading a file in memory etc...

The code still needs a lot of cleanup and a help!

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoAdd core debug module
Benjamin Herrenschmidt [Tue, 10 Sep 2019 16:43:52 +0000 (17:43 +0100)]
Add core debug module

This module adds some simple core controls:

  reset, stop, start, step

along with icache clear and reading the NIA and core
status bits

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org
5 years agoAdd jtag support in simulation via a socket
Benjamin Herrenschmidt [Mon, 16 Sep 2019 15:28:48 +0000 (16:28 +0100)]
Add jtag support in simulation via a socket

This adds a local socket that can be used to communicate with
the debug tool (which will be committed separately) and generates
the JTAG signals.

We generate the low level JTAG signals, thus directly driving the
simulated BSCANE2, and the Xilinx DTM

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoAdd DMI address decoder
Benjamin Herrenschmidt [Tue, 10 Sep 2019 16:39:59 +0000 (17:39 +0100)]
Add DMI address decoder

And prepare signals for core DMI support

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoWishbone debug module
Benjamin Herrenschmidt [Tue, 10 Sep 2019 16:31:25 +0000 (17:31 +0100)]
Wishbone debug module

This adds a debug module off the DMI (debug) bus which can act as a
wishbone master to generate read and write cycles.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoAdd a debug (DMI) bus and a JTAG interface to it on Xilinx FPGAs
Benjamin Herrenschmidt [Tue, 10 Sep 2019 16:17:59 +0000 (17:17 +0100)]
Add a debug (DMI) bus and a JTAG interface to it on Xilinx FPGAs

This adds a simple bus that can be mastered from an external
system via JTAG, which will be used to hookup various debug
modules.

It's loosely based on the RiscV model (hence the DMI name).

The module currently only supports hooking up to a Xilinx BSCANE2
but it shouldn't be too hard to adapt it to support different TAPs
if necessary.

The JTAG protocol proper is not exactly the RiscV one at this point,
though I might still change it.

This comes with some sim variants of Xilinx BSCANE2 and BUFG and a
test bench.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoUse a 3 way WB arbiter and cleanup fpga toplevel
Benjamin Herrenschmidt [Tue, 10 Sep 2019 16:03:37 +0000 (17:03 +0100)]
Use a 3 way WB arbiter and cleanup fpga toplevel

The 3rd master is currently unused, it will host the WB debug module.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 years agoMerge pull request #66 from antonblanchard/reformat-4
Anton Blanchard [Thu, 19 Sep 2019 12:49:41 +0000 (22:49 +1000)]
Merge pull request #66 from antonblanchard/reformat-4

More reformatting

5 years agoReformat crhelpers, and remove some stale code
Anton Blanchard [Thu, 19 Sep 2019 11:53:27 +0000 (21:53 +1000)]
Reformat crhelpers, and remove some stale code

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat helpers
Anton Blanchard [Thu, 19 Sep 2019 11:53:09 +0000 (21:53 +1000)]
Reformat helpers

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat insn_helpers
Anton Blanchard [Thu, 19 Sep 2019 11:52:07 +0000 (21:52 +1000)]
Reformat insn_helpers

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #65 from antonblanchard/loadstore-opt
Anton Blanchard [Thu, 19 Sep 2019 11:48:22 +0000 (21:48 +1000)]
Merge pull request #65 from antonblanchard/loadstore-opt

A small loadstore optimisation, and some reformatting

5 years agoReformat loadstore1
Anton Blanchard [Thu, 19 Sep 2019 11:37:43 +0000 (21:37 +1000)]
Reformat loadstore1

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat loadstore2
Anton Blanchard [Thu, 19 Sep 2019 11:36:51 +0000 (21:36 +1000)]
Reformat loadstore2

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoloads don't do both byte reversal and sign extension
Anton Blanchard [Thu, 19 Sep 2019 11:31:34 +0000 (21:31 +1000)]
loads don't do both byte reversal and sign extension

Give the synthesis tools a clue that we don't need to do both byte reversal
and sign extension.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #64 from antonblanchard/reformat-3
Anton Blanchard [Thu, 19 Sep 2019 11:07:31 +0000 (21:07 +1000)]
Merge pull request #64 from antonblanchard/reformat-3

Reformat some more files

5 years agoMerge pull request #63 from antonblanchard/multiply-cleanup
Anton Blanchard [Thu, 19 Sep 2019 10:36:26 +0000 (20:36 +1000)]
Merge pull request #63 from antonblanchard/multiply-cleanup

Multiply cleanup

5 years agoReformat wishbone code
Anton Blanchard [Thu, 19 Sep 2019 10:35:42 +0000 (20:35 +1000)]
Reformat wishbone code

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat glibc_random
Anton Blanchard [Thu, 19 Sep 2019 10:33:58 +0000 (20:33 +1000)]
Reformat glibc_random

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat simple_ram_behavioural
Anton Blanchard [Thu, 19 Sep 2019 10:32:07 +0000 (20:32 +1000)]
Reformat simple_ram_behavioural

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat sim_console
Anton Blanchard [Thu, 19 Sep 2019 10:28:37 +0000 (20:28 +1000)]
Reformat sim_console

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat multiply_tb
Anton Blanchard [Thu, 19 Sep 2019 10:26:55 +0000 (20:26 +1000)]
Reformat multiply_tb

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat execute2
Anton Blanchard [Thu, 19 Sep 2019 10:24:29 +0000 (20:24 +1000)]
Reformat execute2

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat CR file
Anton Blanchard [Thu, 19 Sep 2019 10:22:36 +0000 (20:22 +1000)]
Reformat CR file

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat register file
Anton Blanchard [Thu, 19 Sep 2019 10:21:58 +0000 (20:21 +1000)]
Reformat register file

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoReformat multiply code
Anton Blanchard [Thu, 19 Sep 2019 10:19:46 +0000 (20:19 +1000)]
Reformat multiply code

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoDon't use VHDL 2008 condition operator in multiply
Anton Blanchard [Thu, 19 Sep 2019 10:18:01 +0000 (20:18 +1000)]
Don't use VHDL 2008 condition operator in multiply

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #62 from antonblanchard/byte-reverse-store-opt
Anton Blanchard [Mon, 16 Sep 2019 03:17:37 +0000 (13:17 +1000)]
Merge pull request #62 from antonblanchard/byte-reverse-store-opt

Move byte reversal of stores to first cycle

5 years agoMerge pull request #61 from antonblanchard/execute-cleanup
Anton Blanchard [Mon, 16 Sep 2019 03:14:25 +0000 (13:14 +1000)]
Merge pull request #61 from antonblanchard/execute-cleanup

execute1 no longer needs sim_console

5 years agoMove byte reversal of stores to first cycle
Anton Blanchard [Mon, 16 Sep 2019 01:49:44 +0000 (11:49 +1000)]
Move byte reversal of stores to first cycle

We are seeing some timing issues with the second cycle of loadstore,
and  we aren't doing much in the first cycle, so move it here.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoexecute1 no longer needs sim_console
Anton Blanchard [Mon, 16 Sep 2019 01:18:53 +0000 (11:18 +1000)]
execute1 no longer needs sim_console

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #60 from antonblanchard/testbenches
Anton Blanchard [Sun, 15 Sep 2019 12:52:14 +0000 (22:52 +1000)]
Merge pull request #60 from antonblanchard/testbenches

Add a few more test benches

5 years agoFix multiply_tb
Anton Blanchard [Fri, 13 Sep 2019 10:35:08 +0000 (20:35 +1000)]
Fix multiply_tb

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoAdd an icache testbench
Anton Blanchard [Fri, 13 Sep 2019 10:17:17 +0000 (20:17 +1000)]
Add an icache testbench

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #56 from antonblanchard/writeback-fix3
Anton Blanchard [Sun, 15 Sep 2019 12:08:57 +0000 (22:08 +1000)]
Merge pull request #56 from antonblanchard/writeback-fix3

Remove cycle in writeback

5 years agoRemove cycle in writeback
Anton Blanchard [Sun, 15 Sep 2019 08:03:48 +0000 (18:03 +1000)]
Remove cycle in writeback

The pipeline had a cycle in writeback. Writeback is pretty
simple and unlikely to be a bottleneck, so lets remove it.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #59 from antonblanchard/trap-decode
Anton Blanchard [Sun, 15 Sep 2019 11:37:47 +0000 (21:37 +1000)]
Merge pull request #59 from antonblanchard/trap-decode

Fix make check

5 years agoMerge pull request #58 from antonblanchard/decode2-assert
Anton Blanchard [Sun, 15 Sep 2019 11:30:30 +0000 (21:30 +1000)]
Merge pull request #58 from antonblanchard/decode2-assert

Fix spurious outstanding assert

5 years agoFix make check
Anton Blanchard [Sun, 15 Sep 2019 11:21:36 +0000 (21:21 +1000)]
Fix make check

We need to finish support for all the trap instructions, but for now
we at least need a decode entry for tw, so we know to stall until the
previous instruction completes. Some of our test cases were failing
because the trap executed before the previous instruction completed.

All these trap instructions need to be resolved at completion, not
in execute.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoFix spurious outstanding assert
Anton Blanchard [Sun, 15 Sep 2019 08:59:24 +0000 (18:59 +1000)]
Fix spurious outstanding assert

Check it in the sequential process, not the combinatorial one.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #57 from antonblanchard/add-nop
Anton Blanchard [Sun, 15 Sep 2019 08:34:27 +0000 (18:34 +1000)]
Merge pull request #57 from antonblanchard/add-nop

Add a decode for the nop instruction

5 years agoAdd a decode for the nop instruction
Anton Blanchard [Sun, 15 Sep 2019 08:18:24 +0000 (18:18 +1000)]
Add a decode for the nop instruction

We want these to go out without any GPR dependencies, so add
a specific entry in decode for them.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #55 from antonblanchard/fetch-fix
Anton Blanchard [Sun, 15 Sep 2019 01:18:42 +0000 (11:18 +1000)]
Merge pull request #55 from antonblanchard/fetch-fix

Add a default value for RESET_ADDRESS

5 years agoAdd a default value for RESET_ADDRESS
Anton Blanchard [Sun, 15 Sep 2019 00:25:57 +0000 (10:25 +1000)]
Add a default value for RESET_ADDRESS

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #51 from antonblanchard/writeback-fix
Anton Blanchard [Sat, 14 Sep 2019 23:55:10 +0000 (09:55 +1000)]
Merge pull request #51 from antonblanchard/writeback-fix

Some writeback updates

5 years agoReformat writeback.vhdl
Anton Blanchard [Sat, 14 Sep 2019 23:07:34 +0000 (09:07 +1000)]
Reformat writeback.vhdl

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoExit if we try to write more than one GPR or CR in a cycle
Anton Blanchard [Sat, 14 Sep 2019 23:04:47 +0000 (09:04 +1000)]
Exit if we try to write more than one GPR or CR in a cycle

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #50 from antonblanchard/decode1-opt
Anton Blanchard [Thu, 12 Sep 2019 11:15:24 +0000 (21:15 +1000)]
Merge pull request #50 from antonblanchard/decode1-opt

No need to gate nia or insn in decode1

5 years agoNo need to gate nia or insn in decode1
Anton Blanchard [Thu, 12 Sep 2019 07:06:09 +0000 (17:06 +1000)]
No need to gate nia or insn in decode1

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #49 from antonblanchard/icache-2
Anton Blanchard [Thu, 12 Sep 2019 06:14:28 +0000 (16:14 +1000)]
Merge pull request #49 from antonblanchard/icache-2

Add a simple direct mapped icache

5 years agoAdd a simple direct mapped icache
Anton Blanchard [Wed, 11 Sep 2019 03:05:17 +0000 (13:05 +1000)]
Add a simple direct mapped icache

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoSOC memory wishbone should clear ACK regardless of STB
Anton Blanchard [Wed, 11 Sep 2019 07:21:52 +0000 (17:21 +1000)]
SOC memory wishbone should clear ACK regardless of STB

The memory wishbone doesn't clear ACK and move the state machine on
until STB is de-asserted. This seems like it isn't compliant with
the spec and results in a maximum throughput of 1 transfer every
3 cycles.

Fixing this improves the situation to one transfer every 2 cycles.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #48 from antonblanchard/clk_gen_bypass
Anton Blanchard [Thu, 12 Sep 2019 03:03:33 +0000 (13:03 +1000)]
Merge pull request #48 from antonblanchard/clk_gen_bypass

Fix clk_gen_bypass

5 years agoFix clk_gen_bypass
Anton Blanchard [Thu, 12 Sep 2019 02:25:18 +0000 (12:25 +1000)]
Fix clk_gen_bypass

I broke clk_gen_bypass when updating the SOC reset code.

Fixes 03fd06deaf9f ("Rework SOC reset")
Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
5 years agoMerge pull request #47 from antonblanchard/if-fix
Anton Blanchard [Wed, 11 Sep 2019 23:46:22 +0000 (09:46 +1000)]
Merge pull request #47 from antonblanchard/if-fix

Explicitly check against '1' in if statements

5 years agoMerge pull request #46 from antonblanchard/record-fix
Anton Blanchard [Wed, 11 Sep 2019 23:46:01 +0000 (09:46 +1000)]
Merge pull request #46 from antonblanchard/record-fix

Remove names from end record statements