Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
* [libre-riscv-dev] [Bug 280] POWER spec parser needs to support fall-through cases
From: bugzilla-daemon @ 2020-04-05 22:12 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-280-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=280

--- Comment #5 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Jacob Lifshay from comment #4)

> Um, I don't think the pseudocode in the Power spec was ever supposed to be
> Python,

it's not, however it turns out to be a whitespace-indented one, probably
through expediency and a desire for compact clarity.

i *began* with GardenSnake.py and rapidly morphed it to match the PDF
pseudocode grammar.

it *outputs* python AST because that was what GardenSnake did, and it's worked
well.

however python lacks switch/case about which i always wondered "wth?" and it
makes sense now: case fall-through seriously messes with an already complex
three-pass process.

> so I have no issues with changing the grammar file to more
> accurately match the spec pdf even if the grammar doesn't match Python as
> closely.

the "hard" way is to try and mess with one of the existing stages.

the pseudo syntax does this:

do while test
    foo

by recognising the keyword "while" i managed to insert an extra token ":" when
the newline occurs.

this trick means that the tokens *look* like they were this:

do while test:
    foo

and of course that now looks exactly like python "while" and it was easy to
add.

i therefore have absolutely no problem messing with the token stream to "get
the desired outcome" :)


> > i've made quite a few minor changes, some of them necessary (to support
> > syntax such as CR0[x] rather than CR0_subscript_x, some of them, well,
> > not being lazy, just "trying to get it working fast"
> > 
> > yet-another-preprocessor-stage - even if it is line-based rather than
> > ply-lexer-based, looking for 2 "case" statements (or case followed by
> > default) which are lined up, and inserting the ghost word "fallthrough"
> > would "do the trick"
> 
> I think having the grammar correctly reflect the actual syntax that is used
> is probably a better way to go than adding preprossing cludges to add
> `fallthrough` everywhere.

i'd put it as an actual keyword, which is silently added by the lexer and
silently removed by the yacc parser, if it made any difference.

however by matching against NAME it makes life simpler and easier.

i think what is happening is that

case(5): somename

is matching against "small single line suite".

by then detecting "if len(statements) == 1 and statements[0] == "fallthrough""
that does the trick.

i know - it's awful.  

> The space-counting done by the lexer translates the spaces into the INDENT
> and DEDENT tokens.

yes.  the person who wrote GardenSnake.py copied the algorithm from the python
c interpreter and transliterated it to python ply lexer.

i had a loovely time getting it to recognise whitespace, properly.  changed the
actual lexer context to trick it into swapping fron whitespace-aware to
non-aware :)


> The following algorithm should work to translate lines:
> 
> def lexer(lines):
>     """ lines is a iterator that returns each line
>         of text without the trailing newline """

unfortunately, stripping the newlines removes vital information, particularly
when discerning small statements after a colon from "suites".

a suite is defined as the following tokens

NEWLINE INDENT stmts DEDENT

where the algorithm you wrote (minus NEWLINE stripping) identifies indent and
dedent

oh... er, 1 sec...

>         yield from tokenize(line)
>         yield NL

ah interesting.  so the NL *isn't* removed?

-- 
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] auto-generated simulator working??
From: Jacob Lifshay @ 2020-04-05 21:44 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAPweEDwxO+CcNyjUcdNsHiQu+pQrZ9vQ8TLpPKZEBi95v=14xg@mail.gmail.com>

On Sun, Apr 5, 2020 at 1:20 PM Luke Kenneth Casson Leighton
<lkcl@lkcl.net> wrote:
>
> moo?  it's working? holy cow!

Yay!!

_______________________________________________
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 280] POWER spec parser needs to support fall-through cases
From: bugzilla-daemon @ 2020-04-05 21:43 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-280-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=280

--- Comment #4 from Jacob Lifshay <programmerjake@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #3)
> (In reply to Jacob Lifshay from comment #2)
> > (In reply to Luke Kenneth Casson Leighton from comment #0)
> > > this is very tricky to get working at the *lexer* level and still support
> > > whitespace indentation.
> > > 
> > > switch (n)
> > >     case(1): x <- 5
> > >     case(2): # here
> > >     case(3):
> > >         x <- 3
> > >     default:
> > >         x <- 9
> > > print (5)
> > 
> > How about switching the grammar to parse a case-sequence instead of a single
> > case, that way multiple cases before a statement block would be correctly
> > handled.
> 
> annoyingly, the more changes that are made to the grammar, the
> less "like the spec" the grammar becomes, with the implication
> that further manual intervention stages are required when it
> comes to verifying against the 3.0B spec and, in future, against
> 3.0C and other releases.

Um, I don't think the pseudocode in the Power spec was ever supposed to be
Python, so I have no issues with changing the grammar file to more accurately
match the spec pdf even if the grammar doesn't match Python as closely.

> i've made quite a few minor changes, some of them necessary (to support
> syntax such as CR0[x] rather than CR0_subscript_x, some of them, well,
> not being lazy, just "trying to get it working fast"
> 
> yet-another-preprocessor-stage - even if it is line-based rather than
> ply-lexer-based, looking for 2 "case" statements (or case followed by
> default) which are lined up, and inserting the ghost word "fallthrough"
> would "do the trick"

I think having the grammar correctly reflect the actual syntax that is used is
probably a better way to go than adding preprossing cludges to add
`fallthrough` everywhere.

The space-counting done by the lexer translates the spaces into the INDENT and
DEDENT tokens.

The following algorithm should work to translate lines:

def lexer(lines):
    """ lines is a iterator that returns each line
        of text without the trailing newline """

    indent_depth_stack = [0]
    for line in lines:
        # assume we don't have to worry about tabs in string literals
        expanded_line = line.expandtabs()
        line = expanded_line.lstrip()
        # count indent depth
        depth = len(expanded_line) - len(line)
        if line == "" or line[0] == "#":
            # empty lines don't have to match depth
            # don't yield repeated NL tokens
            continue
        if depth > indent_depth_stack.top():
            yield INDENT
            indent_depth_stack.append(depth)
        else:
            while depth < indent_depth_stack[-1]:
                yield DEDENT
                indent_depth_stack.pop()
            if depth > indent_depth_stack[-1]:
                raise IndentDepthMismatch("indent depth doesn't match!")
        yield from tokenize(line)
        yield NL
    while indent_depth_stack[-1] != 0:
        yield DEDENT
        indent_depth_stack.pop()

-- 
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 280] POWER spec parser needs to support fall-through cases
From: bugzilla-daemon @ 2020-04-05 20:37 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-280-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=280

--- Comment #3 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Jacob Lifshay from comment #2)
> (In reply to Luke Kenneth Casson Leighton from comment #0)
> > this is very tricky to get working at the *lexer* level and still support
> > whitespace indentation.
> > 
> > switch (n)
> >     case(1): x <- 5
> >     case(2): # here
> >     case(3):
> >         x <- 3
> >     default:
> >         x <- 9
> > print (5)
> 
> How about switching the grammar to parse a case-sequence instead of a single
> case, that way multiple cases before a statement block would be correctly
> handled.

annoyingly, the more changes that are made to the grammar, the
less "like the spec" the grammar becomes, with the implication
that further manual intervention stages are required when it
comes to verifying against the 3.0B spec and, in future, against
3.0C and other releases.

i've made quite a few minor changes, some of them necessary (to support
syntax such as CR0[x] rather than CR0_subscript_x, some of them, well,
not being lazy, just "trying to get it working fast"

yet-another-preprocessor-stage - even if it is line-based rather than
ply-lexer-based, looking for 2 "case" statements (or case followed by
default) which are lined up, and inserting the ghost word "fallthrough"
would "do the trick"

this is ok:

   case (2): fallthrough
   case (3): x <- 3

the lexer happily recognises that... *sigh*

so it can be "faked" by recognising

spc spc spc case (2):
spc spc spc case (3):
spc spc spc default :

counting the number of spaces, recognising that there is a case after a case
(with no code) and "magically" putting in the ghost-word

horrible, but it "works" :)

-- 
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 282] New: investigate partially-generating unit tests from spec
From: bugzilla-daemon @ 2020-04-05 20:29 UTC (permalink / raw)
  To: libre-riscv-dev

http://bugs.libre-riscv.org/show_bug.cgi?id=282

            Bug ID: 282
           Summary: investigate partially-generating unit tests from spec
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Source Code
          Assignee: lkcl@lkcl.net
          Reporter: lkcl@lkcl.net
                CC: libre-riscv-dev@lists.libre-riscv.org
   NLnet milestone: ---

michael, hi,

the PDF spec (and now the isa mdwn pages) contain the "format" of
the instruction:

opcode R1, R2, R3

we can therefore look at *using* that for template purposes, to create
an instruction to test.

-- 
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] auto-generated simulator working??
From: Luke Kenneth Casson Leighton @ 2020-04-05 20:19 UTC (permalink / raw)
  To: Libre-RISCV General Development

moo?  it's working? holy cow!

    def test_load_store(self):
        lst = ["addi 1, 0, 0x0010",
               "addi 2, 0, 0x1234",
               "stw 2, 0(1)",
               "lwz 3, 0(1)"]

(SelectableInt(value=0x1234, bits=64),)
writing reg 3
reg  0 00000000 00000010 00001234 00001234 00000000 00000000 00000000 00000000
reg  8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
reg 16 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
reg 24 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
SelectableInt(value=0x10, bits=64)
.
----------------------------------------------------------------------
Ran 3 tests in 1.918s

OK

_______________________________________________
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 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-05 20:03 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=269

--- Comment #31 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
i put a comment in where that would need to go:

lkcl@fizzy:~/src/libreriscv/soc/src/soc$ git diff d4c6
diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py
index 5b5e3c1..5b6e158 100644
--- a/src/soc/decoder/isa/caller.py
+++ b/src/soc/decoder/isa/caller.py
@@ -123,17 +123,22 @@ class ISACaller:
     def memassign(self, ea, sz, val):
         self.mem.memassign(ea, sz, val)

-    def prep_namespace(self):
+    def prep_namespace(self, formname, op_fields):
+        # TODO: get field names from form in decoder*1* (not decoder2)
+        # decoder2 is hand-created, and decoder1.sigform is auto-generated
+        # from spec
+        # then "yield" fields only from op_fields rather than hard-coded
+        # list, here.
         for name in ['SI', 'UI', 'D', 'BD']:
             signal = getattr(self.decoder, name)
             val = yield signal
             self.namespace[name] = SelectableInt(val, bits=signal.width)

     def call(self, name):

-- 
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 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-05 19:52 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=269

--- Comment #30 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
commit 6f640248c2bebfd5fd522cae2727bdbb0b9bf9a3
Author: Michael Nolan <mtnolan2640@gmail.com>
Date:   Sun Apr 5 15:41:23 2020 -0400

    Autogenerate all.py


haha i was wondering when you might do that :)


i just added Form name parsing, spotting when they're used in the
pseudo-code, and dropping them into a dictionary that's passed
back along with the other regs.

as the fields are supposed to be read-only (you don't modify the
actual instruction fields) the logic is much simpler.

it *should* be possible to "yield" the fields, from the Form
(sd.sigform[op.form]) and drop the values into the dictionary
for "injection".

-- 
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 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-05 19:05 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=269

--- Comment #29 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Luke Kenneth Casson Leighton from comment #15)

> you will find however that much of decode2 is ignored (not useful).  the
> opcode *name* (not InternalOp), and you will need the Form name.

i added Form onto the end (and removed ISACaller as a base class)

class sprset:

    sprset_instrs = {}
    sprset_instrs['mtspr'] = (op_mtspr, OrderedSet(['RS']),
                OrderedSet(), OrderedSet(), 'XFX')

-- 
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 281] put reverted code back (import of isa)
From: bugzilla-daemon @ 2020-04-05 18:57 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-281-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=281

--- Comment #1 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
assigned this one to you, michael.  we need just the import back:
-from soc.decoder.isa import ISA
+from soc.decoder.isa.all import ISA

remember next time, single-purpose commits - this is why :)

-- 
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 281] New: put reverted code back (import of isa)
From: bugzilla-daemon @ 2020-04-05 18:56 UTC (permalink / raw)
  To: libre-riscv-dev

http://bugs.libre-riscv.org/show_bug.cgi?id=281

            Bug ID: 281
           Summary: put reverted code back (import of isa)
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Source Code
          Assignee: lkcl@lkcl.net
          Reporter: lkcl@lkcl.net
                CC: libre-riscv-dev@lists.libre-riscv.org
   NLnet milestone: ---

see http://bugs.libre-riscv.org/show_bug.cgi?id=278#c5

-- 
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 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-05 18:55 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=269

--- Comment #28 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #27)
> Hmm. I figured I'd be able to create a class with multiple types of
> instruction (so I can use loads and arithmetic instructions) like so:
> 
> class ISA(fixedarith, fixedload, fixedstore, ...):
> 
> But it seems that the different superclasses interfere with each other when
> they initialize their instrs dict by doing "instrs = {}"

funny, i just wrote about this:
http://bugs.libre-riscv.org/show_bug.cgi?id=272#c19

> Is there a better way to do this?

i don't know about "better", one possibility is to use uniquely-named
dictionaries

commit 9276f73c76a342af9555bb4dd255f348c297f3ab (HEAD -> master, origin/master)
Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
Date:   Sun Apr 5 19:54:30 2020 +0100

    drop instr info into uniquely-named dict

-- 
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 278] POWER v3.0B spec ambiguity on EXTS and missing EXTZ
From: bugzilla-daemon @ 2020-04-05 18:50 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-278-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=278

--- Comment #5 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
hi michael, i reverted commit b5e4e847c2841189386da3509949d9206de92f8b
Author: Michael Nolan <mtnolan2640@gmail.com>
Date:   Sun Apr 5 14:31:48 2020 -0400

    Implement bug 278, comment 1 - better version of EXTS

the reason is that

unfortunately, as it wasn't a single-purpose commit, it's also reverted
this:

diff --git a/src/soc/decoder/isa/test_caller.py
b/src/soc/decoder/isa/test_caller.py
index aa6f23a..12db984 100644
--- a/src/soc/decoder/isa/test_caller.py
+++ b/src/soc/decoder/isa/test_caller.py
@@ -9,7 +9,7 @@ from soc.simulator.program import Program
 from soc.decoder.isa.caller import ISACaller, inject
 from soc.decoder.selectable_int import SelectableInt
 from soc.decoder.orderedset import OrderedSet
-from soc.decoder.isa import ISA
+from soc.decoder.isa.all import ISA


i'll leave that with you to fix?


the reason i reverted the use of exts() is because exts() returns
integers.

when it comes to SV, we will *need* things to be in classes such
as SelectableInt, because it will be there that the bitwidths
can be over-ridden (to implement the polymorphic behaviour of SV)

ints cannot have their behaviour over-ridden.

EXTS and the other functions will also at some point need to go into
a class, so that their behaviour can also be over-ridden.

however they can be dropped into the namespace as-is - appearing
to be global non-class-based functions - using the @inject decorator.

-- 
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 278] POWER v3.0B spec ambiguity on EXTS and missing EXTZ
From: bugzilla-daemon @ 2020-04-05 18:46 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-278-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=278

--- Comment #4 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Jacob Lifshay from comment #3)
> (In reply to Luke Kenneth Casson Leighton from comment #2)
> > (In reply to Jacob Lifshay from comment #1)
> > > You don't need an infinite number of hardware bits to represent the
> > > mathematical integer, since you know the exact range the values fall in so
> > > you can calculate exactly how many bits you need, sign/zero-extending as
> > > needed when converting back to a bitstring.
> > 
> > if it's ok i'd like to go with "EXTS returns bitsize of 256" and see how
> > that goes, because string-to-int comes with a performance penalty.
> 
> Basically all that's needed is to create a new type with the original bits
> and record if it's sign or zero extended, no Python strings need to be
> created or processed. 

oh ok - a different type, rather than an "actual python string".

or, a flag (in the SelectableInt) would do as well.  it's... slightly
better than overloading the meaning "bitlen=256".


> nmigen's simulator uses python longs internally to represent the value of a
> Signal, so it shouldn't be that much slower.

what i mean is... hmmm it's been a long time since i looked at the code:
i believe they use an int (long) for when numbers fit into a long, and
a different type - which takes far more time - when numbers go beyond
2^64.  this in the actual interpreter source code.

therefore, you won't know it, but if you use numbers greater than size 2^64
the interpreter slows down slightly.

i could be wrong about that, it's been a while since i looked at the
python interpreter source code.

-- 
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 272] functions needed in POWER simulator which match 3.0B spec
From: bugzilla-daemon @ 2020-04-05 18:37 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-272-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=272

--- Comment #19 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
hiya michael, saw the commit (reinstated addi) - couple of things:

* generally, a blank __init__.py is kiiinda the normal convention?
  (there's a few exceptions)

* i believe you may have created a circular import dependency loop

* multiple ISACaller base classes have been added.  this is a pain
  to workaround.

imports in python work hierarchically.  so, import x.y.z will
look for x, then x.y and finally x.y.z

because class ISA(fixedarith, fixedload) is in soc.decoder.isa
and because fixedarith is derived from ISACaller
and because ISACaller is in soc.decoder.isa.caller i think
that goes circular.

but the multiple ISACaller bases is slightly more problematic.

how about instead either:

* creating a class ISA which has fixedarith and fixedload (etc)
  as *member* variables, which, in the constructor, merge the
  instr dictionaries into one?

* removing ISACaller as a base then making it a base of ISA:
  class ISA(ISACaller, fixedarith, fixedload)

* changing pywriter.py to output dicts named fixedarith_instr (etc.)
  which can be merged / accessed separately

oh - i think you might have fixed it, just saw the latest push :)

-- 
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 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-05 18:23 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=269

--- Comment #27 from Michael Nolan <mtnolan2640@gmail.com> ---
Hmm. I figured I'd be able to create a class with multiple types of instruction
(so I can use loads and arithmetic instructions) like so:

class ISA(fixedarith, fixedload, fixedstore, ...):

But it seems that the different superclasses interfere with each other when
they initialize their instrs dict by doing "instrs = {}"

I tried removing that from each generated class, and adding it to the ISACaller
class, but now the generated classes can't find the dict from the superclass.
It looks like I can get it to sort of work by rearranging the generated class
like so: 

class fixedarith(ISACaller):
    @inject()
    def op_add(self, RA, RB):
        RT = RA + RB
        return (RT,)
    def __init__(self, dec, regs):
        super().__init__(dec, regs)

        self.instrs['add'] = (self.op_add, OrderedSet(['RA', 'RB']),
                OrderedSet(), OrderedSet(['RT']))

Is there a better way to do this?

-- 
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 280] POWER spec parser needs to support fall-through cases
From: bugzilla-daemon @ 2020-04-05 17:01 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-280-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=280

Jacob Lifshay <programmerjake@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |programmerjake@gmail.com

--- Comment #2 from Jacob Lifshay <programmerjake@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #0)
> this is very tricky to get working at the *lexer* level and still support
> whitespace indentation.
> 
> switch (n)
>     case(1): x <- 5
>     case(2): # here
>     case(3):
>         x <- 3
>     default:
>         x <- 9
> print (5)

How about switching the grammar to parse a case-sequence instead of a single
case, that way multiple cases before a statement block would be correctly
handled.

It might look like the following (doesn't handle empty lines):

switch := "switch" LPAREN expression RPAREN NL INDENT (case_sequence
case_body)+ DEDENT

case_sequence := (case NL)* case (NL default)?
              | default

case := "case" LPAREN expression RPAREN COLON

default := "default" COLON

case_body := statement_with_nl
          | NL INDENT statement_with_nl+ DEDENT

statement_with_nl := lhs "<-" expression NL
          | ...

-- 
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 278] POWER v3.0B spec ambiguity on EXTS and missing EXTZ
From: bugzilla-daemon @ 2020-04-05 16:27 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-278-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=278

--- Comment #3 from Jacob Lifshay <programmerjake@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #2)
> (In reply to Jacob Lifshay from comment #1)
> > You don't need an infinite number of hardware bits to represent the
> > mathematical integer, since you know the exact range the values fall in so
> > you can calculate exactly how many bits you need, sign/zero-extending as
> > needed when converting back to a bitstring.
> 
> if it's ok i'd like to go with "EXTS returns bitsize of 256" and see how
> that goes, because string-to-int comes with a performance penalty.

Basically all that's needed is to create a new type with the original bits and
record if it's sign or zero extended, no Python strings need to be created or
processed. What I called a bitstring above is basically a bitvector and the
same as the underlying bits in a nmigen Signal, I used the name bitstring
instead of nmigen Signal since there are people on the openpower list who
aren't familiar with nmigen.
> 
> yes so do python Longs (to use a python2-ism) however i don't believe it
> will be as high.

nmigen's simulator uses python longs internally to represent the value of a
Signal, so it shouldn't be that much slower.

> keep this bug open so we have an alternative idea.

-- 
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 280] POWER spec parser needs to support fall-through cases
From: bugzilla-daemon @ 2020-04-05 15:58 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-280-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=280

--- Comment #1 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
current work-around: add a "comment" at the end (as in the example),
then set the parser looking for that, and ignore it.

-- 
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 280] New: POWER spec parser needs to support fall-through cases
From: bugzilla-daemon @ 2020-04-05 15:57 UTC (permalink / raw)
  To: libre-riscv-dev

http://bugs.libre-riscv.org/show_bug.cgi?id=280

            Bug ID: 280
           Summary: POWER spec parser needs to support fall-through cases
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Source Code
          Assignee: lkcl@lkcl.net
          Reporter: lkcl@lkcl.net
                CC: libre-riscv-dev@lists.libre-riscv.org
   NLnet milestone: ---

this is very tricky to get working at the *lexer* level and still support
whitespace indentation.

switch (n)
    case(1): x <- 5
    case(2): # here
    case(3):
        x <- 3
    default:
        x <- 9
print (5)

-- 
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] POWER Spec parser nearly done
From: Luke Kenneth Casson Leighton @ 2020-04-05 13:10 UTC (permalink / raw)
  To: Libre-RISCV General Development

for a given value of "done" :)

i have a switch case grammar to write, to support sprset, and the integer
opcodes as far as parsing is concerned is done.

that will just leave actually *using* the resultant code, which involves
identifying missing variables, functions, SPRs and so on and ensuring they
go correctly in and out of the various opcode functions.

hardware-wise i have had a chance to go over the full instruction set, and
there's very little chance of doing full automated conversion.

partial, yes (saving time) however full conversion, no, the pseudocode is
too "linear" where hardware is parallel.

l.




-- 
---
crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68
_______________________________________________
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] Who Buys Talos Workstations?
From: Luke Kenneth Casson Leighton @ 2020-04-05 10:13 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <1E8B88FD-241D-437C-9D5F-505632D5C56F@gmail.com>

On Sun, Apr 5, 2020 at 8:34 AM Cole Poirier <colepoirier@gmail.com> wrote:

> Some brief info with links below. As far as I am aware we don’t have plans to use this interface in Libre-SOC V1, but please correct me if this is incorrect. If it’s the the case that we are not using the interface, would you still like me to add this to the resources section of the wiki?

you misunderstand the purpose of the wiki.  if you find something cool
or useful *do not wait to ask* - just add it.

if you are unsure about where to add it, add it to your personal page
or to a discussion link, or to a "TODO: investigate" section at the
end of any half-appropriate page.

the purpose of the wiki is to A save time B not lose anything which
happens within hours to minutes on a mailing list.

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 278] POWER v3.0B spec ambiguity on EXTS and missing EXTZ
From: bugzilla-daemon @ 2020-04-05 10:08 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-278-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=278

--- Comment #2 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Jacob Lifshay from comment #1)

> > EXTS(x) Result of extending x on the left with sign
> >         bits
> >
> > the problem is illustrated by asking the very simple question, "how many
> > bits?"
> 
> 
> Maybe it would work to treat it as a conversion from a bitstring to a
> mathematical integer (like a Python3 int) where it can then be converted
> back to a bitstring when it is assigned to something with a size again?

hmm...

   if AA then NIA <-iea EXTS(LI || 0b00)
   else       NIA <-iea CIA + EXTS(LI || 0b00)

the args to that would be integer-values by that point (not the AST)
so it would in theory be ok...

> You don't need an infinite number of hardware bits to represent the
> mathematical integer, since you know the exact range the values fall in so
> you can calculate exactly how many bits you need, sign/zero-extending as
> needed when converting back to a bitstring.

if it's ok i'd like to go with "EXTS returns bitsize of 256" and see how
that goes, because string-to-int comes with a performance penalty.

yes so do python Longs (to use a python2-ism) however i don't believe it will
be as high.

keep this bug open so we have an alternative idea.

-- 
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 279] inconsistency in 3.0B spec on definition of "equivalence" operator
From: bugzilla-daemon @ 2020-04-05 10:01 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-279-13@http.bugs.libre-riscv.org/>

http://bugs.libre-riscv.org/show_bug.cgi?id=279

--- Comment #2 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Jacob Lifshay from comment #1)
> In my opinion, both == and XNOR (as well as != and XOR) can be used to
> denote the same operation, but with two different ways of thinking about it:
> 
> 1. XNOR/XOR used when flipping bits, (carry-less) adding, LFSRs, etc.
> 2. ==/!= used when checking for same/different values.

yes, interestingly, Anton, in Microwatt, splits up add/sub into its
sub-components:

* add 0, 1, carry
* actual add
* invert / don't bit-invert result (1s complement)

therefore, bit-inversion of the result could, hypothetically, be done
here as well.

i "solved" this one temporarily by removing the XNOR operator and
replacing it with invert (a XOR 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

* Re: [libre-riscv-dev] SiFIve to go with PowerVR
From: Luke Kenneth Casson Leighton @ 2020-04-05  9:56 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <5DE3CABB-66B3-4EE5-BCB4-B41FC9035FB5@gatech.edu>

On Sun, Apr 5, 2020 at 3:53 AM Immanuel, Yehowshua U
<yimmanuel3@gatech.edu> wrote:
>
> This isn’t exactly new news, but SiFive was/is working with PowerVR to create an entirely integrated SOC with a GPU, WiFi, etc…

that they picked PowerVR - when the entire industry HATES PowerVR with
a pathological and entirely justifiable vengeange - says it all,
really.

"“There are a diminishing number of suppliers in the GPU space,"

cheeky f*****r.  he knew *damn well* that we were working on a GPU
based on RISC-V.

> But it won’t be Libre…

and it will be an unmitigated disaster as well.  see here (or roundabout that)
https://youtu.be/7z6xjIRXcp4?t=2234

the PowerVR core is... "flexible".  it was designed by an Imperial
College professor over 20 years ago, as a parameterisable flexible
hardware-software solution.  great idea, except when it was
commercialised, the licensing was made insanely draconian, and
"support" tagged at a minimum of USD $150,000.

this combination made software releases absolute hell not only for the
internal developers, who had to remember what they'd "dialled" for any
one given customer, it meant that the drivers *would not work on
another customer's machine*, and, worse, those customers were forced
to pay MORE MONEY to get help to update drivers (you should be getting
a sinking feeling about where that goes).

got a driver for linux kernel 3.4 and you want to upgrade to 3.5?
tough s**t Texas Instruments / Intel / Rockchip: pay us money and
we'll help you, otherwise piss off.

not only that: the licensing was so draconian that, despite the
engineers having the source for android-3D they *were not permitted to
compile it for Xorg*

as if that wasn't enough, the "flexibility" mentioned above was so
great that Imagination's own engineers were unable to cope, and
systematically and regularly release crap that crashes entire machines
thanks to the poor software quality.

when i say that engineers the world over HATE PowerVR, i really mean
it.  one Intel Atom product from the 1990s had it (because the
proprietary non-end-user TV processors by Intel also had it), and it
was a serious and costly mistake that caused no end of user grief and
massive unreliability and the source of crashes that they *could not
fix*.

it's not a coincidence that Apple, when Imagination's main patent
expired (on shader tiles), immediately abandoned it *the next day* and
announced their own GPU internal project.

> https://www.eetimes.com/imagination-gpu-now-on-sifive-risc-v-design-platform/
>
> Perhaps we should have a page with content like this, just to refer to…

good idea.  when i've calmed down a bit from the shock / alarm of
seeing SiFive not do their due diligence.

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:   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