[J-core] Fun with nvc.

Nick Gasson nick at nickg.me.uk
Sun Jun 5 14:56:02 EDT 2016


>> [...] For NVC, that means you need the llvm
>> generated binary to be executed, no?   This is a complication, and
>> I don't yet understand enough about how nvc works to do that.
>
> That last part sounds like a question for Nick. :)
>

That's not necessarily the case. NVC at the moment does a lot of
constant folding at compile time. Currently in a slightly ad-hoc way,
but I'm working on rewriting the compile time evaluation to use the
intermediate code representation that is used for LLVM generation - see
http://www.doof.me.uk/2015/04/06/new-code-generator/

It's kind-of a way off yet, but there's no reason in principle this
couldn't work for I/O too, and so you wouldn't need to generate or
execute the LLVM.

Thanks,
Nick


On 03/06/16 18:35, Rob Landley wrote:
> On 06/02/2016 11:52 PM, D. Jeff Dionne wrote:
>> On Jun 3, 2016, at 6:25, Rob Landley <rob at landley.net> wrote:
>>>
>>> Now that it more or less works (there are a bunch of asserts and
>>> the timing is weird, but it passes its internal diagnostics and
>>> runs the gdb stub),
>>
>> There is one more thing: something causes the CPU to take more cycles.
>> This is only slightly weird, it surely has something to do with memory
>> access adding wait states.  It's an odd bug that would cause that!
>>
>>> the next question is how to attach it to
>>> yosys? (Again, discussed in the above message, but since Nick's been
>>> traveling and Jeff's been busy with other stuff, I'm poking a bit
>>> to see what the next steps would be.)
>>
>> There are 2 (big picture) issues:
>>
>> You need to walk the NVC syntax tree, and translate it into a yosys
>> tree.  Or, more likely, code a thing to write out a syntax tree from
>> nvc, and write a reader for yosys that reads that into yosys internal
>> syntax tree.
>>
>> The second issue is yosys trees look a little different than an nvc
>> tree, with the yosys tree expected to be post elaboration (e.g. Post
>> constant folding including evaluation of functions that result in
>> constants, application of generics, instantiation of blocks...)
>>
>> There is a mismatch between nvc and yosys about the structures.
>> If you want constant folding, etc, including things like tables
>> of sin() and cos() for DSP applications, or reading a files
>> (like rom contents) into constants (which we do use some places),
>> then obviously the vhdl code that evaluates these constants
>> including file IO must run.   For NVC, that means you need the llvm
>> generated binary to be executed, no?   This is a complication, and
>> I don't yet understand enough about how nvc works to do that.
> 
> That last part sounds like a question for Nick. :)
> 
>>>
>>> Alas, I don't have the Lattice board the resulting bitstream
>>> would run on.
>>
>> Ok, simple :)
>> http://www.latticestore.com/searchresults/tabid/463/searchid/1/searchvalue/ice40hx1k-stick-evn/default.aspx
>>
>> And/Or
>>
>> http://www.latticestore.com/products/tabid/417/categoryid/59/productid/6117/searchid/1/searchvalue/ice40hx8k/default.aspx
>>
>>> I should probably try to get the xilinx toolchain
>>> to build that source blob for a numato board and see what would
>>> be involved in porting the arduino tools to it.
>>
>> Cheers,
>> J.
>>
> 
> Rob
> 



More information about the J-core mailing list