* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-09 18:23 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #21 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
hiya michael i deployed a trick that was used in the PartitionedAdder.
rather than use 2 separate adds, A and B are shifted up by 1 bit, then
you put a 1 into A[0] and the carry into B[0]. that way you do a 66
bit add, discard bit 0, result is bits 1-64, and carry is the MSB.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-09 19:08 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #22 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
are you studying this btw?
https://github.com/antonblanchard/microwatt/blob/master/execute1.vhdl
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-09 19:12 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #23 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
that's interesting. what's the popcounts all about?
https://github.com/antonblanchard/microwatt/blob/master/logical.vhdl
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* Re: [libre-riscv-dev] Handling Interrupts
From: Luke Kenneth Casson Leighton @ 2020-05-09 19:42 UTC (permalink / raw)
To: Libre-RISCV General Development
In-Reply-To: <BF4B573A-FB3D-48E0-9AFD-9921CC8F01C1@gatech.edu>
On Sat, May 9, 2020 at 6:24 PM Yehowshua <yimmanuel3@gatech.edu> wrote:
>
> One thing I just realized that I’ve never done in any of the RTL CPUs I’ve worked with is enable interrupts.
>
> How are interrupts done in RTL? As soon as the CPU controller sees that EINT
> is high, does it(upon the next clock boundary), flush the pipeline and
> immediately jump to the handler?
there's 2 or 3 ways it can be done, ultimately though they're as
simple as "change the Program Counter but also automatically store
current state when the INT hardware flag gets raised". that state is
usually the Program Counter and the current "mode" -
User/Kernel/Hypervisor.
it then becomes (in software) the responsibility of the trap handler
to save further context because in hardware, to save things like "the
entire register file" is far too many cycles. plus, many fast
interrupt handlers don't *need* to save the entire regfile, because
they only use a subset of the registers.
so, in hardware, when any kind of "interrupt" condition occurs (an INT
line somewhere goes HI):
technique 1) further instruction issue is prevented and prohibited.
outstanding in-flight operations continue, until they are complete.
once complete, the interrupt "activates" (by changing the PC, and
changing the mode, and saving the require minimal state into
CSRs/SPRs)
technique 2) pipelines are permitted to be "cancelled" (flushed).
this means that there must exist a global "cancellation" combinatorial
signal that propagates throughout every single pipeline stage.
technique 3) an augmented version of (2) where certain operations
(particularly those that might do "damage" i.e. once in progress can
in no way be "rolled back" such as memory operations that have already
initiated the process of committing a ST to memory) have a "mask"
which absolutely prevents and prohibits the interrupt - any interrupt
- including NMIs - from taking place.
technique 4) a much more subtle version of (3) where operations are
"shadowed", i.e. only the *write* portion of the operation is
prevented and prohibited from committing (whilst the execution itself
- the computation of the result - is allowed to proceed and be stored
in a latch). if there is no exception - at all - and the "write"
portion is ABSOLUTELY GUARANTEED TO SUCCEED, then and only then is the
"shadow" lifted, and any interrupt that occurs past that point must
wait its turn.
technique 1 *and* 2 comes into effect at that point: anything that is
currently "shadowed" has its global "cancel" pulled (GO_DIE), whilst
anything that can *not* be cancelled must be waited for.
(4) is what we will implement - all the infrastructure is in place:
global mask cancellation bitmaps, shadowing, it's all there.
> I’m aware that there can be external hardware such as a PLIC to arbitrate interrupts,
yes. that's another thing that needs to go on the list.
> I’m just not certain about the actual CPU RTL - what it would do. That is, if the CPU immediately
> jumps to the handler address - or if it bothers to save a few register first
CSRs/SPRs yes. typically the current PC is stored into a CSR/SPR of
its own. this will be used as the "return from trap" address, where
the hardware will, on exit from the trap, restore the current PC from
that CSR/SPR. and restore the current "mode" (user/hypervisor/kernel
mode) from the corresponding SPR/CSR as well.
> ( this might depend on the actual ISA itself too).
yes it depends on the ISA, however the "good" ones minimise the amount
of state that gets "swapped" into CSRs and lets the software (trap
handler) sort it out.
l.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-09 21:18 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #24 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
https://github.com/antonblanchard/microwatt/blob/master/ppc_fx_insns.vhdl
line 563 is where sraw, srad, srawi and sradi exist. there's a *lot*
of code-duplication, which is fairly normal in "traditional" HDLs because
parameterisation can be harder to do.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-09 21:35 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #25 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #24)
> https://github.com/antonblanchard/microwatt/blob/master/ppc_fx_insns.vhdl
>
> line 563 is where sraw, srad, srawi and sradi exist. there's a *lot*
> of code-duplication, which is fairly normal in "traditional" HDLs because
> parameterisation can be harder to do.
Those are already done in main_stage.py, though they could do with a bit more
rigorous testing.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-09 21:42 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #26 from Michael Nolan <mtnolan2640@gmail.com> ---
I just realized I'm going to run into some difficulty with rlwinm, as the
values controlling the mask amounts (MB and ME) aren't exposed by
Decode2ToExecute1. Should they be added, or is there another path you think we
should take for things like this (there are almost certainly other instructions
with fields like that).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 4:25 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #27 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #26)
> I just realized I'm going to run into some difficulty with rlwinm, as the
> values controlling the mask amounts (MB and ME) aren't exposed by
> Decode2ToExecute1. Should they be added, or is there another path you think
> we should take for things like this (there are almost certainly other
> instructions with fields like that).
hmm hmm don't know. microwatt throws the actual instruction opcode around, as
a global, which is fine for single issue
for a large scale multi issue processor with pipelines, not so much.
option 1
* pass the undecoded insn via Execute1Tyoe and add the POWER decoder "field
selector" to pspec. this will get the bitfields and forms etc
option 2
* add mb and me and slowly more and more copies of fields over time.
honestly we will probably have to do (1) sooner rather than later although (2)
is the easier option.
any other ideas?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 4:30 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #28 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #25)
> (In reply to Luke Kenneth Casson Leighton from comment #24)
> > https://github.com/antonblanchard/microwatt/blob/master/ppc_fx_insns.vhdl
> >
> > line 563 is where sraw, srad, srawi and sradi exist. there's a *lot*
> > of code-duplication, which is fairly normal in "traditional" HDLs because
> > parameterisation can be harder to do.
>
> Those are already done in main_stage.py,
nice.
> though they could do with a bit
> more rigorous testing.
i noticed an assert on bits in SelectableInt not being happy.
cmp by the way apologies for moving the add into the switch statement.
don't do trap in this Function Unit, it changes the PC so i think really should
be in a special FunctionUnit which outputs a new PC, alongside Branch etc.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 306] New: Formal Correctness Proof for ALU pipeline
From: bugzilla-daemon @ 2020-05-10 11:33 UTC (permalink / raw)
To: libre-riscv-dev
https://bugs.libre-soc.org/show_bug.cgi?id=306
Bug ID: 306
Summary: Formal Correctness Proof for ALU pipeline
Product: Libre-SOC's first SoC
Version: unspecified
Hardware: PC
OS: Mac OS
Status: CONFIRMED
Severity: enhancement
Priority: ---
Component: Formal Verification
Assignee: lkcl@lkcl.net
Reporter: lkcl@lkcl.net
CC: libre-riscv-dev@lists.libre-riscv.org
NLnet milestone: ---
https://git.libre-soc.org/?p=soc.git;a=tree;f=src/soc/alu/formal;hb=HEAD
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 306] Formal Correctness Proof for ALU pipeline
From: bugzilla-daemon @ 2020-05-10 11:33 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-306-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=306
Luke Kenneth Casson Leighton <lkcl@lkcl.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
NLnet milestone|--- |NLNet.2019.10.Formal
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 306] Formal Correctness Proof for ALU pipeline
From: bugzilla-daemon @ 2020-05-10 11:34 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-306-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=306
Luke Kenneth Casson Leighton <lkcl@lkcl.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|lkcl@lkcl.net |mtnolan2640@gmail.com
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 198] Formal correctness proofs are needed for low-level libraries in LibreSOC
From: bugzilla-daemon @ 2020-05-10 11:36 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-198-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=198
Luke Kenneth Casson Leighton <lkcl@lkcl.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
budget (EUR) for|8800 |8400
completion of task| |
(excludes budget| |
allocated to| |
subtasks)| |
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 306] Formal Correctness Proof for ALU pipeline
From: bugzilla-daemon @ 2020-05-10 11:36 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-306-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=306
Luke Kenneth Casson Leighton <lkcl@lkcl.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
parent task for| |198
budget allocation| |
total budget (EUR)|0 |400
for completion of| |
task and all| |
subtasks| |
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 306] Formal Correctness Proof for ALU pipeline
From: bugzilla-daemon @ 2020-05-10 13:01 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-306-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=306
--- Comment #1 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
python3 alu/formal/proof_main_stage.py ..
----------------------------------------------------------------------
Ran 2 tests in 312.563s
wooow :)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 306] Formal Correctness Proof for ALU pipeline
From: bugzilla-daemon @ 2020-05-10 13:46 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-306-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=306
--- Comment #2 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #1)
> python3 alu/formal/proof_main_stage.py ..
> ----------------------------------------------------------------------
> Ran 2 tests in 312.563s
>
> wooow :)
Yeah, adding shifts to the proof *really* slowed it down
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 23:03 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #29 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
https://git.libre-soc.org/?p=soc.git;a=blob;f=src/soc/alu/main_stage.py;hb=HEAD#l137
i'm fairly certain that this:
136 with m.Case(InternalOp.OP_RLC):
137 with m.If(self.i.ctx.op.imm_data.imm_ok):
138 comb += rotate_amt.eq(self.i.ctx.op.imm_data.imm[0:5])
139 with m.Else():
140 comb += rotate_amt.eq(self.i.b[0:5])
can just be this:
136 with m.Case(InternalOp.OP_RLC):
137 comb += rotate_amt.eq(self.i.b[0:5])
because in input_stage.py there is this:
40 # If there's an immediate, set the B operand to that
41 with m.If(self.i.ctx.op.imm_data.imm_ok):
42 comb += self.o.b.eq(self.i.ctx.op.imm_data.imm)
43 with m.Else():
44 comb += self.o.b.eq(self.i.b)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 23:06 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #30 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #29)
> https://git.libre-soc.org/?p=soc.git;a=blob;f=src/soc/alu/main_stage.py;
> hb=HEAD#l137
>
> i'm fairly certain that this:
>
> 136 with m.Case(InternalOp.OP_RLC):
> 137 with m.If(self.i.ctx.op.imm_data.imm_ok):
> 138 comb +=
> rotate_amt.eq(self.i.ctx.op.imm_data.imm[0:5])
> 139 with m.Else():
> 140 comb += rotate_amt.eq(self.i.b[0:5])
>
> can just be this:
>
> 136 with m.Case(InternalOp.OP_RLC):
> 137 comb += rotate_amt.eq(self.i.b[0:5])
>
> because in input_stage.py there is this:
>
> 40 # If there's an immediate, set the B operand to that
> 41 with m.If(self.i.ctx.op.imm_data.imm_ok):
> 42 comb += self.o.b.eq(self.i.ctx.op.imm_data.imm)
> 43 with m.Else():
> 44 comb += self.o.b.eq(self.i.b)
The issue is the `rlwimi` instruction, which in addition to RS and an immediate
also reads in RA. Because of this, I disabled putting the immediate into
operand b in the input stage of the ALU for the RLC opcode
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 23:11 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #31 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
these would be better (again) as (sigh) add(x,y) etc. sub(63, n) rather than
63-n
also if the use of EXTZ64 *really* is necessary, that's actually a bug in the
spec
rather than something that we should arbitrarily fix, and it should be
reported.
@@ -168,9 +168,9 @@
@inject()
def op_slw(self, RB, RS):
n = RB[59:64]
- r = ROTL32(RS[32:64], n)
+ r = ROTL32(EXTZ64(RS[32:64]), n.value)
if eq(RB[58], 0):
- m = MASK(32, 63 - n)
+ m = MASK(32, 63 - n.value)
else:
m = concat(0, repeat=64)
RA = r & m
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 23:15 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #32 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #30)
> The issue is the `rlwimi` instruction, which in addition to RS and an
> immediate also reads in RA. Because of this, I disabled putting the
> immediate into operand b in the input stage of the ALU for the RLC opcode
interesting. am taking a closer look. it doesn't look that different.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-10 23:42 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #33 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
i haven't committed it (i leave it to you to evaluate)
this passes the tests nosetests3 decoder/isa/test_caller.py
register RA is read in - however it's not involved in the datapath for RB.
here's the pseudocode
* rlwinm RA,RS,SH,MB,ME (Rc=0)
* rlwinm. RA,RS,SH,MB,ME (Rc=1)
n <- SH
r <- ROTL32((RS)[32:63], n)
m <- MASK(MB+32, ME+32)
RA <- r & m
* rlwnm RA,RS,RB,MB,ME (Rc=0)
* rlwnm. RA,RS,RB,MB,ME (Rc=1)
n <- (RB)[59:63]
r <- ROTL32((RS)[32:63], n)
m <- MASK(MB+32, ME+32)
RA <- r & m
the only difference is in n
both are 5 bit, SH should be coming from the immediate-decoding, (RB)[59:63]
means get the 5 LSBs of RB.
i believe we're ok making the change below. it doesn't make sense that IBM
would design something that needs a special exception path for the immediate,
just for one instruction.
lkcl@fizzy:~/src/libreriscv/soc/src/soc$ git diff
diff --git a/src/soc/alu/input_stage.py b/src/soc/alu/input_stage.py
index 389954b..2dda52a 100644
--- a/src/soc/alu/input_stage.py
+++ b/src/soc/alu/input_stage.py
@@ -39,8 +39,7 @@ class ALUInputStage(PipeModBase):
##### operand B #####
# If there's an immediate, set the B operand to that
- with m.If(self.i.ctx.op.imm_data.imm_ok &
- ~(self.i.ctx.op.insn_type == InternalOp.OP_RLC)):
+ with m.If(self.i.ctx.op.imm_data.imm_ok):
comb += self.o.b.eq(self.i.ctx.op.imm_data.imm)
with m.Else():
comb += self.o.b.eq(self.i.b)
diff --git a/src/soc/alu/main_stage.py b/src/soc/alu/main_stage.py
index 59c896a..173ca78 100644
--- a/src/soc/alu/main_stage.py
+++ b/src/soc/alu/main_stage.py
@@ -134,10 +134,7 @@ class ALUMainStage(PipeModBase):
comb += self.o.o.eq(rotl_out & mask)
with m.Case(InternalOp.OP_RLC):
- with m.If(self.i.ctx.op.imm_data.imm_ok):
- comb += rotate_amt.eq(self.i.ctx.op.imm_data.imm[0:5])
- with m.Else():
- comb += rotate_amt.eq(self.i.b[0:5])
+ comb += rotate_amt.eq(self.i.b[0:5])
comb += maskgen.mb.eq(mb+32)
comb += maskgen.me.eq(me+32)
comb += mask.eq(maskgen.o)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-11 0:04 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #34 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
https://libre-soc.org/openpower/isatables/
hmmm, anton's team has synthesised the commonality between the different
rotates and shifts
https://github.com/antonblanchard/microwatt/blob/master/rotator.vhdl
back in execute1.vhdl they do this:
right_shift <= '1' when e_in.insn_type = OP_SHR else '0';
rot_clear_left <= '1' when e_in.insn_type = OP_RLC or e_in.insn_type =
OP_RLCL else '0';
rot_clear_right <= '1' when e_in.insn_type = OP_RLC or e_in.insn_type =
OP_RLCR else '0';
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-11 1:11 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #35 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
i can do a brain-dead translation of this code to nmigen, tomorrow, if you're
good with that? (i quite like doing no-brain work...)
https://github.com/antonblanchard/microwatt/blob/master/rotator.vhdl
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] [Bug 305] Create Pipelined ALU similar to alu_hier.py
From: bugzilla-daemon @ 2020-05-11 10:30 UTC (permalink / raw)
To: libre-riscv-dev
In-Reply-To: <bug-305-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=305
--- Comment #36 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Luke Kenneth Casson Leighton from comment #35)
> i can do a brain-dead translation of this code to nmigen, tomorrow, if you're
> good with that? (i quite like doing no-brain work...)
> https://github.com/antonblanchard/microwatt/blob/master/rotator.vhdl
okok i just did it anyway :)
https://git.libre-soc.org/?p=soc.git;a=commitdiff;h=0604fe1e0b040def2e3f599fc523340eeeefe519
i cut out the hand-coded ROTL and replaced it with... ROTL.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
* [libre-riscv-dev] daily kan-ban update 11may2020
From: Luke Kenneth Casson Leighton @ 2020-05-11 12:26 UTC (permalink / raw)
To: Libre-RISCV General Development
btw i forgot to mention: here's what kan-ban is supposed to be :)
https://en.wikipedia.org/wiki/Kanban_(development)
we forgot the board, however one important aspect is that the
"updates" are very brief, and they start with "what you did yesterday"
and continue with "what you plan to do today". here's a (stunningly
simple) bugzilla kan-ban "view" https://github.com/leif81/bzkanban
anyway.
yesterday i recovered my laptop after my daughter played Minecraft on
it for several hours and the intel dri DMA driver got a null-pointer
de-reference. i lost 150 editor sessions across 5 group-contexted
virtual screens. sigh. i also continued background-helping michael
with the ALU, and asked Jacob if he'd like to perhaps do a DIV and/or
MUL Function Unit (CMP, BR and TRAP also need doing). also i did a
preliminary review of the MarketNext article with their team (at the
moment it's 1500+ words when it should be 600-800)
today i brain-dead-converted rotator.vhdl to nmigen, as it covers - in
an elegant way - the full range of rotate functions from POWER9. i am
still thinking about how to fit the new 3-in 2-out LDSTCompUnit into
the scoreboard.
l.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
^ permalink raw reply
page: next prev latest
Libre RISC-V Mailing list Archives (accessible via public-inbox)
Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev
Example config snippet for mirrors
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git