Bug 172 - partitioned signal add/sub/neg
Summary: partitioned signal add/sub/neg
Status: PAYMENTPENDING FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: ALU (including IEEE754 16/32/64-bit FPU) (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- enhancement
Assignee: Luke Kenneth Casson Leighton
URL:
Depends on:
Blocks: 132
  Show dependency treegraph
 
Reported: 2020-02-07 15:56 GMT by Luke Kenneth Casson Leighton
Modified: 2020-09-21 17:22 BST (History)
2 users (show)

See Also:
NLnet milestone: NLnet.2019.02
total budget (EUR) for completion of task and all subtasks: 150
budget (EUR) for this task, excluding subtasks' budget: 150
parent task for budget allocation: 48
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2020-02-07 15:56:58 GMT
PartitionedSignal needs add, sub and neg (~NNNN).
Comment 1 Luke Kenneth Casson Leighton 2020-02-08 16:50:01 GMT
cf to conversation:
http://lists.libre-riscv.org/pipermail/libre-riscv-dev/2020-February/003861.html
Comment 2 Michael Nolan 2020-02-10 17:09:32 GMT
I think I have sub, neg, and carry out working now
Comment 3 Luke Kenneth Casson Leighton 2020-02-10 17:46:37 GMT
(In reply to Michael Nolan from comment #2)
> I think I have sub, neg, and carry out working now

(confirmed here the unit test runs.  a good TODO would be
a formal unit test however we need to do the MoU for that)

niice, it looks like...

+                        bit_set = int(math.log2(lsb))
+                        carry_result |= c << int(bit_set/4)

yeah, then tested that... excccellent, muahahah.

of course (sigh) now eeeverything has to have carry in it, but hey :)
Comment 4 Luke Kenneth Casson Leighton 2020-02-10 20:36:34 GMT
oh wait... do you think you could update the docstring of PartitionedAdder,
make sure i got it right, and/or simply remove the table, replace it with
the link below (or "see wiki page listed at top of page") and edit that instead?

https://libre-riscv.org/3d_gpu/architecture/dynamic_simd/add/

this is kinda important so that people looking at this stuff, from an
educational and review perpsective can go "ok that's actually
understandable".
Comment 5 Michael Nolan 2020-02-12 14:26:12 GMT
(In reply to Luke Kenneth Casson Leighton from comment #4)
> oh wait... do you think you could update the docstring of PartitionedAdder,
> make sure i got it right, and/or simply remove the table, replace it with
> the link below (or "see wiki page listed at top of page") and edit that
> instead?

Updated
Comment 6 Luke Kenneth Casson Leighton 2020-02-12 15:02:09 GMT
(In reply to Michael Nolan from comment #5)
> (In reply to Luke Kenneth Casson Leighton from comment #4)
> > oh wait... do you think you could update the docstring of PartitionedAdder,
> > make sure i got it right, and/or simply remove the table, replace it with
> > the link below (or "see wiki page listed at top of page") and edit that
> > instead?
> 
> Updated

star.

ah! spaces, michael! :)  i caught one in an earlier commit as well
(src/ieee754/part_shift_scalar/formal/proof_shift_scalar.py)


+    exp-b    : 0BBBBIBBBBIBBBBIBBBBIBBBBc (32+2 bits plus 4 zeros)
+    exp-o    : o....oN...oN...oN...oN...x (32+4+2 bits - x to be discarded)
     o        :  .... N... N... N... N... (32 bits - x ignored, N is carry-over)
-    carry-out:      o    o    o    o      (4 bits)
+    carry-out: o    o    o    o    o      (5 bits)
vvv SPACE SPACE SPACE SPACE
+    
^^^ SPACE SPACE SPACE SPACE
+    A couple of differences should be noted:

it may sound funny / pedantic however when you are looking at every single
person's diff (like i am) and the spaces show up in red, because if someone
uses a different editor then the whitespace mods end up as well and you
can't tell what's code and what's whitespace in a commit review, that becomes
a major distraction to the reviewer (and other code-readers).

please always always do a "git diff" prior to "git commit", skim-read it
all to the bottom, and you'll see that bash deliberately highlights
extraneous space in red.

i'll update the HDL workflow to match this.
Comment 7 Luke Kenneth Casson Leighton 2020-02-12 15:06:26 GMT
-    carry-in :           c    c    c    c (4 bits)
-    C = c & P:           C    C    C    c (4 bits)
-    I = P=>c :           I    I    I    I (4 bits)
+    carry-in :      c    c    c    c    c (5 bits)
+    C = c & P:      C    C    C    C    c (5 bits)
+    I = P=>c :      I    I    I    I    c (5 bits)


err... oh yes!  of course, well spotted: the example i had done (or
maybe it was jacob), actually it is 5 partitions, but only 4 bits to
subdivide them, and i'd gotten confused when adding the number of
carry-in and carry-out bits.

good catch.
Comment 8 Michael Nolan 2020-02-12 15:46:19 GMT
> ah! spaces, michael! :)  i caught one in an earlier commit as well
> (src/ieee754/part_shift_scalar/formal/proof_shift_scalar.py)

ARGH! I added a pre-commit hook that runs flake8 with the trailing whitespace and line width warnings to catch exactly this, but it looks like I don't have it configured quite right (there's a separate warning for the whitespace on a blank line)
Comment 9 Luke Kenneth Casson Leighton 2020-02-12 15:55:38 GMT
(In reply to Michael Nolan from comment #8)
> > ah! spaces, michael! :)  i caught one in an earlier commit as well
> > (src/ieee754/part_shift_scalar/formal/proof_shift_scalar.py)
> 
> ARGH! I added a pre-commit hook that runs flake8 with the trailing
> whitespace and line width warnings to catch exactly this, but it looks like
> I don't have it configured quite right (there's a separate warning for the
> whitespace on a blank line)

:)

it's a useful thing to do to get into the habit of always typing "git diff"
prior to literally every "git commit" even if it's just to skim-read.

with the [justifiably-breakable-] rule being "keep commits reasonable and
small(-ish)" this isn't burdensome at all.

it also means you get to see exactly what you've done, right before you
start typing up the git commit message.