omnitechnomancer has quit [Quit: Idle for 30+ days]
<Lofty>
Ping Sarayan
<Sarayan>
pong you
<Lofty>
Did you see my message above? :p
<Lofty>
[02:32:47] Lofty: Sarayan: Been working on nextpnr-cyclonev some more.
<Lofty>
[02:38:35] Lofty: I also need to consistently name these pins, which is...tricky.
<Lofty>
[02:33:57] Lofty: So, I have a Bel - say, a flop. To implement getBelPins, I need a list of connected pins. I'm not sure how to get those from libmistral
<Lofty>
I also politely asked daveshah for a nextpnr Arch API abstraction
<Sarayan>
no, had to reboot my system, changing HD
<Lofty>
That was sent yesterday morning :P
<Sarayan>
then I missed it :-)
<Lofty>
Either way, yeah, you'll have to walk me through some of the libmistral API bits
<Sarayan>
there are bits missing in the API, we need to find out what needs to be added
<Sarayan>
so, the logic is, BELs have pnodes, aka port nodes, which indicates their pins. They 64-bits values fwiw
<Sarayan>
you have a pnode_to_rnode function to get the routing node it is associated to
<Sarayan>
(routing nodes are 32 bits)
<Sarayan>
it's a 1:1 association, nicely
<Sarayan>
the list of pnodes existing for a given BEL has no API to get it though, it's in the doc
<Sarayan>
for instance, if you look at the LABs, you see that you have a port named 'A' with instance number 0-9 that's the input A of the given labcell
<Sarayan>
its pnode value is mistral::CycloneV::pnode(LAB, pos, A, 0-9, -1)
<Sarayan>
the you can call model->pnode_to_rnode(that value) to get the routing node that it is connected to
<Sarayan>
then
<Sarayan>
you have pn2s(node) to get a string describing a pnode, and rn2s(node) to get a string describing a rnode
<Sarayan>
pn2s givesn ouy something like LAB.010.009.5:A
<Sarayan>
rn2s something like GOUT.000.002.0049
<Sarayan>
That BaseArch stuff? Very cool
<Sarayan>
(damn, I lost Lofty)
<Lofty>
I'm here, plus or minus notification problems
<Lofty>
Hi Sarayan :P
<Sarayan>
:-)
<Sarayan>
was that understandable?
<Sarayan>
hmmm, actually there is an api to get the pnodes, since I use it to dump the list for the doc
<Sarayan>
model->get_all_p2r() will get you the pairs for all peripheral blocks
<Sarayan>
model->get_all_p2ri() will get one the inner blocks but with only one block per inner type
<Sarayan>
model->get_all_p2p() will get you the pnode-pnode direct links that do not go through the routing grid
<Sarayan>
i/o input to pll clock input for instance
<Sarayan>
(lost poor Lofty again)
<Lofty>
It kinda helps if you ping me, you know :P
<Lofty>
Anyway
<Lofty>
It's...maybe not as understandable as it could be
<Sarayan>
ohkay
<Sarayan>
let's try it again, slightly differently (ping Lofty!)
<Sarayan>
Say, you want a port of a LAB
<Sarayan>
You can look up the list in the doc
<Sarayan>
For instance, the top register output of the labcell 5 from the lab at (15, 10) (if there's one, I don;t actually know :-)
<Sarayan>
you get a pos_t from the position with mistral::CycloneV::xy2pos(15, 10)
<Sarayan>
(that's a 16 bits value fwiw)
<Sarayan>
((x << 7) | y even)
<Sarayan>
from then you can build a pnode_t which represent the pin of the bel
<Sarayan>
the syntax is pnode(type, pos, port type, bel instance number, bit number)
<Sarayan>
when there's no instance or no bit, use -1
<Sarayan>
so in our case it's pnode(LAB, xy2pos(15, 10), FFT0, 5, -1)
<Sarayan>
that gives you a pnode_t, a 64-bits value
<Sarayan>
then you can ask the object the actualy routing node that's connected to it with model->pnode_to_rnode(pnode)
<Sarayan>
that's the 32-bits value you're going to use for routing
<Sarayan>
better lofty?
<Lofty>
Gotta love the pings completely not working on my phone :P
<Lofty>
Does libmistral catch if you pass a -1 where it expects a value or vice versa?
<Sarayan>
you'll get 0 for a rnode
<Sarayan>
you'll get 0 for any pnode that's incorrect in fact
<Lofty>
Is there a way to get it to assert that? I'd very much prefer it to crash noisily for debugging.
<daveshah>
yeah asserting when things are wrong is definitely the way to go here
<Sarayan>
well.... I only use the "testing" capability it gives on rnode_to_pnode, so sure
<Sarayan>
in cv-rmux.cc there's pnode_to_rnode
<Sarayan>
there's a return 0 at the end, abort there
<Sarayan>
I use it in rnode_to_pnode when decompiling, to see if a node is connected to something interesting
<Lofty>
I think having something like that would be a good idea :P
<Sarayan>
like what?
<Sarayan>
Lofty really needs something else than a phone to discuss libraries :-P
<Lofty>
I also need more free time and probably less alcohol