[<<][rtl][>>][..]
Mon Sep 3 10:05:21 EDT 2018

VPI

So I have some cargo-culted code that compiles and runs.  Now I want
to know how exactly I get "events".  What I miss is the shape of the
context these functions are supposed to run in.

This is quite typical: the API is too granular to reconstruct this
kind of context.  Examples are essential to get the big picture.


I find this in the myhdl.c code:

 vpi_register_cb(&cb_data_s);

Googling for that, I find:

http://www.asic-world.com/systemc/hdl8.html

Some remarks:

- userdata has nothing to do with the argument to a function.  it
  seems to be just a user state pointer.

- everything is dynamically typed, and referenced using vpiHandle

- some calls allocate objects that need to be freed,
  e.g. vpi_iterate() (EDIT: this caused a crash... reference manual?)

https://books.google.com/books?id=3pEMBwAAQBAJ&pg=PA213&lpg=PA213&dq=vpi+posedge&source=bl&ots=AYdk0XJym9&sig=3W4FA1Xe5LP4zUGPSm7QQv6O2z4&hl=en&sa=X&ved=2ahUKEwjnttT_lJ_dAhXDIzQIHSPLDhUQ6AEwB3oECAQQAQ#v=onepage&q=vpi%20posedge&f=false



Now, how to put it all together?

Instead of syncing on clock inside the module, what about calling it
like this:

always @(posedge clock)
   $seq_tick


This could then read out all the registers that were tagged in
$to_seq(), and write to all the registers tagged in $from_seq().

This seems straightforward.  The problem is then how to define the
protocol between the Haskell side and the simulation?



EDIT: This seems to work.  Proof of concept, clean up later.

Next: generic way to get an I/O pipe into a C program from Haskell.
TCP?  Named pipe?

The most straightforward way I can think of:
- Have Haskell set up the pipes
- Put pipe locations in environemnt
- Let module open the pipes


EDIT: How to set this up?
There is this, which is a higher level interface:
http://hackage.haskell.org/package/pipes-4.3.9/docs/Pipes-Tutorial.html

Seems overkill.  I just need the system calls.
EDIT: Trying named pipes, but this is really hacky.
Unix socket?

EDIT: Basic unix socket infra is in place.  How to (de)serialize?

I don't understand how to link the Char8 to the Data.Binary.Get

    • Couldn't match expected type ‘Data.ByteString.Lazy.Internal.ByteString’
                  with actual type ‘Data.ByteString.Internal.ByteString’




[Reply][About]
[<<][rtl][>>][..]