<Bluefoxicy>
I had to add like 9 more gates because I misunderstood the math a little, but none of them are on the critical path
<Bluefoxicy>
:| it's weird sitting on something AMD and Intel haven't been able to figure out in the past 60 years
jacklsw has quit [Quit: Back to the real world]
jacklsw has joined #riscv
riff-IRC has quit [Remote host closed the connection]
riff-IRC has joined #riscv
EchelonX has joined #riscv
<Sofia>
Bluefoxicy: You believe you have a faster division implementation than AMD and Intel?
<Bluefoxicy>
Current state of the art is SRT division using a look-up table
<Bluefoxicy>
I have a trivial circuit that can generate any cell in the look-up table \o/
<Bluefoxicy>
i.e. I'm using what is in current (2017 and more recent) research considered to be a division circuit requiring a ROM and an address decoder, for which there is ongoing research into doing things to get around the look-up table being so damned slow
<Bluefoxicy>
and not doing any of that
_whitelogger has joined #riscv
BOKALDO has joined #riscv
<Sofia>
Interesting algorithm for division.
<Bluefoxicy>
it's from like 1950-ish
<Bluefoxicy>
what's weird is everyone had the specs for the look-up tables, but one of the big advances made around 1970 was a foldable look-up table so you could store it in half the PLA space
<Bluefoxicy>
literally just draw a picture of the table, draw the 1/3 D and 2/3 D and 8/3 D lines and whatnot, and color in the boxes until you have something logical, it's not hard
<Bluefoxicy>
what bugs me is IEEE754 doesn't seem to explain how it wants division done, and while you get 2 digits of the quotient each iteration, you really need to check your internal precision
<Bluefoxicy>
otoh that may be because Lukas had hard-coded 52 bits of internal precision in his application
<Bluefoxicy>
I started getting incorrect results at 27 digits of precision—base-4 digits, 54 binary digits.
<Sofia>
I thought you were sleeping <_<
<Bluefoxicy>
i should do that
<Bluefoxicy>
my cat is whining at me because he wants me to get in bed so he can use me as a pillow :|
<Sofia>
Under clang, the result is so undefined it inherits uninitialized register values?
<gordonDrogon>
by my newbie+naive understanding; looks like it.
<gordonDrogon>
someone pointed out compiler explorer to me just yesterday too. I think he was trying to persuade me to not use ASM for my project.
<Sofia>
gordonDrogon: What were you using assembly for?
<gordonDrogon>
I still am using asm - it's for a freestanding project which is a small bytecode interpreter/vm thingy.
<Sofia>
I mean, you wrote assembly for what?
<Sofia>
Vs. writing code in any higher level language
<gordonDrogon>
the project is currently on the 65815 (16-bit version of the 6502 - ish) looking to move it to risc-v.
<gordonDrogon>
the bytecode is what BCPL compiles into.
<gordonDrogon>
so I currently have a little retro style OS and utilities all in BCPL and it runs well, if a little slow on the '816 system, so looking at something a little faster.
<gordonDrogon>
I could run it all under Linux on my desktop where I have a C version of the bytecode/vm but that's too easy..
<Sofia>
solrize: I forgot to check clang for x86-64. It shares the undefined uninitialized result. Odd. https://godbolt.org/z/8MGfE3q86
<Sofia>
At least Rust defines the semantic. But it seems to add additional code for the casting.
<Sofia>
s/seems/
<Sofia>
s/seems to add/adds/
<gordonDrogon>
hence my recent quest for a small RV system that's in-between 32KB microcontroller and not 4GB Linux. ESP32-C3 or FPGA...
freakazoid343 has quit [Ping timeout: 252 seconds]
<Sofia>
Good luck gordonDrogon
* Sofia
thought your name ended in Dragon, just noticed now it does not.
<gordonDrogon>
thanks. I've written most of an RV emulator in BCPL and am testing out snippets of the bytecode in that - fun but slowish.
<gordonDrogon>
this person: https://github.com/ultraembedded seems to have a goof fpga solution though - I'll be investigating all that soon too.
<gordonDrogon>
*good
<solrize>
i don't recognize that number sofia
<gordonDrogon>
Sofia, yea, long story, anagram of gordon :)
<gordonDrogon>
a name I picked in 1992 for a MUD I wrote & ran; The Land of Drogon ... those were the days!
<solrize>
it's slightly larger than 2**32
<gordonDrogon>
doggie walk time - back later...
<Sofia>
solrize: It was a snippet from stackoverflow.
<Sofia>
dh`: GCC sets f = -1, g = 429496768. Clang aggrees for g, but leaves f undefined by returning straight away without even initializing the a0 register to a constant.
jacklsw has quit [Ping timeout: 256 seconds]
<dh`>
that seems thoroughly wrong
<Sofia>
The float in f is too large to fit in u32, while g somehow gets divided by 2.
<Sofia>
er, not 2, 10.
<dh`>
though I suppose casting out-of-range values from float and double isn't defined
<Sofia>
That is the point, but it is still unexpected to see the result be this degree of undefined...
<dh`>
that's the problem with the current attitude towards UB
<dh`>
it would be more helpful to just call abort(), but no...
<Sofia>
Or just trap.
<dh`>
let me guess, neither prints a diagnostic
<Sofia>
Correct.
<Sofia>
Though I'll admit I didn't add -Wall or even check for that
<Sofia>
Adding -Wall did not yield any warning.
<Sofia>
Nor with -Wpedantic.
<dh`>
ok, I got godbolt to run, and now I can't paste from it
<Sofia>
Wonderful.
<dh`>
I swear, the world is made of regressions this decade
<Sofia>
Shall we start from scratch?
<dh`>
godbolt is a pretty neat toy but browsers should be burned down
<Sofia>
Yes.
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
kaph has joined #riscv
wingsorc has quit [Quit: Leaving]
<Sofia>
dh`: #llvm on oftc. -> add -fno-strict-float-cast-overflow to define the semantic.
<The_Decryptor>
For LLVM you can pass "-emit-llvm" to get it to emit bytecode instead of assembly, it's "optimising" out f() at that point
<muurkha>
ugh
<Sofia>
The_Decryptor: But that doesn't work if it is a library...
<Sofia>
I.e. something links against it and calls the function.
Sofia has quit [Ping timeout: 276 seconds]
jjido has joined #riscv
Sofia has joined #riscv
<The_Decryptor>
I don't think it'd happen with a library, unless you're doing LTO
<The_Decryptor>
With optimisations off it produces a value and calls the function
pecastro has joined #riscv
<muurkha>
but what will the function return?
<The_Decryptor>
Optimisations will enable inlining, and it'll basically see an invalid value is being passed to something that can never produce a valid output
<muurkha>
if it doesn't even initialize a0 it'll return whatever was previously in a0
<The_Decryptor>
Yeah, that's how LLVM handles "poison" values
<The_Decryptor>
A random but fixed value, so it just uses whatever is in a register at the time
<Sofia>
I really don't like that..
<The_Decryptor>
Same thing happens if you give it a NaN, in clang at least
<muurkha>
computers were a mistake
<muurkha>
burn it all down
<Sofia>
muurkha: Wait for the RISC-V cores to be ready to replace those burned x86 and arm machines first.
<muurkha>
won't matter if they're running software compiled with llvm
<Sofia>
So use different compilers.
<enthusi>
gordonDrogon: Hah, that sounds pretty similar to what I am currently doing
<enthusi>
a simple minimal OS in asm for fun
<enthusi>
but most likely way simpler than yours/anyones idea of an OS :)
aerkiaga has joined #riscv
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<gordonDrogon>
enthusi, My OS is in BCPL, but I need the bytecode interpreter for the code the BCPL compiler produces... So I have a slight advantage :)
<Sofia>
enthusi: I like simple. Any links?
<la_mettrie>
my RISC-V ISA manuals (unprivileged from 2019, privileged from 2021) do not mention global pointer at all. have they been dropped??
<la_mettrie>
those seem to contain thread pointer & global pointer only in a part which is from 2017 (older than official (?) manuals that do not contain them). so it seems they are dropped?
<Sofia>
la_mettrie: I don't know what would be the dropped detail. The RISC-V C calling convention defines their use. It is primarily useful for linking code together, especially with C code, across boundaries where the optimizer might not have visibility (perhaps because a library is dynamically loaded.)
<Sofia>
The compressed instructions extension assumes the convention is followed to optimize its encoding, thus the "stack pointer" and "return address" registers are at least more set. Still by convention and convenience, but you're still free to use whatever registers you like.
<la_mettrie>
as i said, since the latest ISA manuals don't mention thread & global pointers, i'd like to get it confirmed are they dropped or not
<la_mettrie>
(yes, they are just alternative names for general registers. but anyway...)
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<Sofia>
la_mettrie: The only mention of "thread pointer" and "global pointer" are exactly in that handbook. The only difference I see is the handbook being moved out of volume I. Volume I still references it. https://riscv.org/wp-content/uploads/2019/12/riscv-spec-20191213.pdf
<Sofia>
I do not interpret this as dropped.
<la_mettrie>
okay, the problem was simply that okular's find feature didn't find it from that table
<la_mettrie>
(okular = pdf reader)
<Sofia>
la_mettrie: Oh, I thought you were comparing official 2019 with master, for which the latter does not mention these directly as the handbook has been split out.
<Sofia>
I suspect the split is due to the platform and profile specs.
<Sofia>
la_mettrie: As active as I think you can get it. :)
Andre_H has joined #riscv
<gordonDrogon>
enthusi, re. mandelbrot - nice to see some other hand-written assembler for RV - thanks.
freakazoid333 has joined #riscv
rvalles has quit [Ping timeout: 240 seconds]
aerkiaga has quit [Remote host closed the connection]
rvalles has joined #riscv
freakazoid333 has quit [Ping timeout: 240 seconds]
shicz2 has quit [Ping timeout: 256 seconds]
jjido has joined #riscv
Andre_H has quit [Quit: Leaving.]
kaph has quit [Ping timeout: 256 seconds]
shicz2 has joined #riscv
jacklsw has joined #riscv
jacklsw has quit [Changing host]
jacklsw has joined #riscv
jacklsw has quit [Client Quit]
jacklsw has joined #riscv
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bauruine has joined #riscv
Andre_H has joined #riscv
shicz2 has quit [Ping timeout: 240 seconds]
shicz2 has joined #riscv
Andre_H has quit [Client Quit]
tgamblin_ has quit [Quit: Leaving]
tgamblin has joined #riscv
gaude has joined #riscv
<enthusi>
gordonDrogon: Thanks for the feedback :) there is also some small lz4 decoder for rv32 on my github which might actually be useful
<gordonDrogon>
enthusi, my plan is to get my bytecode thing going then I can jump in with BCPL ...
<enthusi>
yes, BCPL seems ideal for that. Wasnt that even the main purpose? To set foot onto new architectures? ):
compscipunk has quit [Ping timeout: 240 seconds]
<gordonDrogon>
not sure, but it was designed with portability in-mind way back in the late 60's.
<gordonDrogon>
with the compiler outputing code for some virtual machine, so all you needed to do was write the interpreter for the code to bootstrap bcpl...
<gordonDrogon>
I'm considering BPCL a RISC version of C :-)
freakazoid333 has joined #riscv
freakazoid333 has quit [Read error: Connection reset by peer]
freakazoid333 has joined #riscv
<gaude>
anyone here using riscv and xip?
aerkiaga has joined #riscv
<enthusi>
gordonDrogon: well, it was BCPL -> B -> C, wasnt it?
<gordonDrogon>
enthusi, yep...
jjido has joined #riscv
adjtm has joined #riscv
jacklsw has quit [Read error: Connection reset by peer]
Andre_H has joined #riscv
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
mahmutov has joined #riscv
motherfsck has quit [Quit: quit]
motherfsck has joined #riscv
alMalsamo has joined #riscv
* geertu
has fond memories of BPTR and BSTR
kaph has joined #riscv
jellydonut has quit [Quit: jellydonut]
jellydonut has joined #riscv
jamtorus has joined #riscv
jamtorus2 has joined #riscv
jellydonut has quit [Ping timeout: 256 seconds]
jellydonut has joined #riscv
jellydonut has quit [Read error: Connection reset by peer]
jamtorus has quit [Ping timeout: 256 seconds]
jamtorus2 has quit [Ping timeout: 256 seconds]
vagrantc has joined #riscv
jellydonut has joined #riscv
jjido has joined #riscv
jjido has quit [Client Quit]
EchelonX has quit [Quit: Leaving]
motherfsck has quit [Quit: quit]
motherfsck has joined #riscv
mahmutov_ has joined #riscv
mahmutov has quit [Ping timeout: 256 seconds]
kailo has joined #riscv
<gordonDrogon>
I don't recognise those, but I didn't get into BCPL until about 1983...
* gordonDrogon
guesses a byte pointer and string..
aerkiaga has quit [Remote host closed the connection]