Ruby and SystemVerilog DPI - ruby

The DPI functionality in System Verilog always mentions that you can interface it with any language, the most common one being C/C++. I want to interface my system Verilog code with Ruby. Is there any documentation or support for this functionality? Any known way to do this?
I should add that my main goal is to call a ruby script from my system Verilog uvm test.
Thanks

While the standard mentions that the DPI can interface SystemVerilog with any other foreign language, it then chickens out and says:
For now, however, SystemVerilog defines a foreign language layer only
for the C programming language.
This means that you should get DPI-C support in all IEEE 1800 compliant simulators, but any other foreign languages you get depend on your simulator vendor. Mine for example also offers SystemC, but requires that the SystemC code be patched (i.e. it won't work out of the box).
Some guys in my company managed to interface Python with SystemVerilog through the DPI, but they did it via a 2-step approach: Python -> C and C -> SystemVerilog. You would probably need to do something similar.

This is as close as you get to Ruby, but using VPI:
https://github.com/sunaku/ruby-vpi
If you like Python, you can try coco_tb:
http://potentialventures.github.io/cocotb/

Related

Are there any good extensible language cross compilers?

I am working on a project right now, and I would greatly enjoy being able to extend a cross compiler to convert some code into other languages. For example, I might have an AST of some code, and I would like to pass that off to a cross compiler with the intended language and receive some code in the language specified in return.
So to sum it up: is there any extensible cross compiler that I can just give an AST or equivalent and receive code in return?
(I know about Haxe, but the compiler is not very extensible and I would prefer to not transpile)
I have made the decision to use LLVM as the native compiler, and will write my own custom transpilers to other languages, as I could find no other decent option. If you would like to follow my project, head over to Provalang.

Implement VHDL/Verilog only using lookup tables in Xilinx ISE

Is there any way of telling ISE to synthesize my VHDL/Verilog code into combinational circuits consisting only of look-up tables? I would like to avoid multiplexers, multipliers, and the like in the tech schematic... and wouldn't mind having an unoptimized (with many components than is optimal) version because of this preference.
Thanks SOCommunity!
There is a way to do that. Look at the XST user guide for switches that control the use of the primitives you want to avoid:
http://www.xilinx.com/support/documentation/sw_manuals/xilinx13_2/xst_v6s6.pdf
or:
http://www.xilinx.com/support/documentation/sw_manuals/xilinx13_2/xst.pdf
depending on your target architecture.
For example, to avoid DSP blocks use:
-use_dsp48 no
To avoid automatic packing into BRAMs use:
-auto_bram_packing no
This switch can also be useful:
-slice_utilization_ratio
as will others.
I have a convenient way to look at the available switches, along with some explanation of what they do, on my site:
https://www.boldport.com/flow/#new/options
(click 'Edit', and then 'More options...')
I hope this helps.
In Xilinx you can use the Language templates for this purpose. Select the device you are using and check the available type of LUT's and other components. You can individually instantiate these LUT in your design.
You may have to switch off the "optimization during synthesis" option in XST properties to make this work correctly.
http://www.xilinx.com/support/documentation/sw_manuals/xilinx13_1/ise_p_lt_using_language_templates.htm

What Syntax for file-based Smalltalks are there?

I know of GNU Smalltalk's Syntax that puts the method body surounded by square-brackets after the selector like so:
add: anObject [
self tally add: anObject.
]
Are there other file based approaches?
There is the chunk file format which is what GNU Smalltalk (GST) used to use, and which most other Smalltalks support as File In/Out format. The contents of the Squeak sources and changes files are in this format.
Additionally there is the Smalltalk Interchange Format (SIF) which is specified by the ANSI Smalltalk standard, which is similar to the chunk format but incorporates some additional metadata and structure. I know that there is a reader for SIF in GST, but I'm not sure if VisualWorks or Squeak have readers for this format.
There's the changeset (or fileOut) format (off a random changeset on my machine):
'From Squeak4.1alpha of 3 April 2010 [latest update: #9883] on 5 April 2010 at 11:41:27 am'!
!Browser methodsFor: 'initialize-release' stamp: 'fbs 4/5/2010 11:38'!
classListFrame: bottomFraction
^self
classListFrame: bottomFraction
fromTop: 0
fromLeft: 0.25
width: 0.25.! !
The Resilient programming language
differs from Smalltalk in the
following ways ... We introduce a full
syntax for classes to allow
programmers to use standard tools for
program manipulation and source
control management.
p5 Design, Implementation, and Evaluation of the Resilient Smalltalk Embedded Platform pdf
In addition to the mentioned syntaxes there are the following, I am aware of:
Coral: http://rmod.lille.inria.fr/coral/
A syntax extension for scripting with Smalltalk (Pharo)
SOM: http://github.com/smarr/SOM/
A minimal file-based Smalltalk
Pepsi: http://piumarta.com/pepsi/pepsi.html
Another file-based Smalltalk dialect, but with prototypes instead of classes.
GemStone/S filein sytax is described in the Topaz Maual section 1.13
I should also mention the Cypress package format which is currently shared by 6 different Smalltalk dialects:
Amber (Cypress)
Cuis (Cypress)
GemStone (FileTree)
Pharo (FileTree)
Squeak (FileTree)
VW (STIG)
The Cypress package format should be relatively easy to port to additional dialects....
The read of sources is part of the fileIn procedure, that is used to communicate systems. The format for fileIn can change while reading, because the fileIn stream can contain new classes and methods, that when evaluated in the reader, teach the system e.g. on how to read the following data.
The fileIn is a method designed to sync (objects=data&behavior of) systems.
More information can be found in http://alereimondo.no-ip.org/U8/277
and use cases are frequent using S8 (see http://u8.smalltalking.net ) in systems development for web and mobile.

windows programming without a OOP language

Which language ( that is not oop ) should I consider using for writing gui windows apps ?
I guess the obvious answers are visual basic and C , but am wondering if I should look into anything else
am not saying OOP sucks or anything. I just don't.. not using it. The END
ty
Edit: I just want a language that has a non oop paradigm option and that is/can be used to write a windows gui application .
It is quite possible to write procedural code in any language.
There is FreeBasic
I'd personally recommend giving Fortran a go, it's quite nice...
I'd use Python. Sure it can be used in a OO way (as pretty much all other languages can as well), but it's pretty easy to write clean, simple, procedural code with it as well.
C would be my choice, Visual Studio supports it and has an excellent debugger. There are also plenty of examples out on the web in C for Windows programming so you'll have the easiest time getting your code to work.
OO is kind of a pervasive paradigm these days. It's pretty much impossible to avoid, even languages like VB and C can be used to program in an OO way, although I do get what you mean. Have you considered Fortran? COBOL? J? Perl? Python? They can all pretty much be used in a non OO way.
Not to mention assembly language.
F# I guess, avoiding its inherent object-oriented programming model. But do you like functional languages and the .NET framework?!
Out of curiosity, why do you need such a thing?
Windows programming is OO by design. Even if you use C, all the API functions work like OO.
Every handle has a corresponding Create function
CloseHandle if used to close any object, not just a specific type
And finally every single API function gets a Handle to a relevant object, just like the old implementation of OO in pure C with structs - the equivalent of this.
Well, there are guys who are still using Visual Foxpro, or Visual Basic 6 (which is NOT OO, contrary to what some people say).
C and Windows API. It is not OO, but feels like, because OO (C++, Java, C#) is nothing but making structs into objects.

What tools for migrating programs from a platform A to B

As a pet project, I was thinking about writing a program to migrate applications written in a language A into a language B.
A and B would be object-oriented languages. I suppose it is a very hard task : mapping language constructs that are alike is doable, but mapping libraries concepts will be a very long task.
I was wondering what tools to use, I know this has to do with compilation, but I'm a bit afraid to use Lex and Yacc and all that stuff.
I was thinking of maybe using the Eclipse Modeling Framework, which would help me write models (of application code) transformations in a readable form.
But first I would have to write parsers for creating the models (and also create the metamodel from the language grammar).
Are there tools that exist that would make my task easier?
You can use special transformation tools/languages for that TXL or Stratego/XT.
Also you can have a look and easily try Java to Python and Java to Tcl migrating projects made by me with TXL.
You are right about mapping library concepts. It is rather hard and long task. There are two ways here:
Fully migrate the class library from language A to B
Migrate classes/functions from language A to the corresponding concepts in language B
The approach you will choose depends on your goals and time/resources available. Also in many cases you wont be doing a general A->B migration which will cover all possible cases, you will need just to convert some project/library/etc. so you will see in your particular cases what is better to do with classes/libraries.
I think this is almost impossibly hard, especially as a personal project. But if you are going to do it, don't make life even more difficult for yourself by trying to come up with a general solution. Choose two specific real-life programming languages ind investigate the possibities of converting between them. I think you will be shocked by the number of problems and issues this will expose.
There are some tools for direct migration for some combinations of A and B.
There are a variety of reverse engineering and code generation tools for different languages and platforms. It's fairly rare to see reverse engineering tools which capture all the semantics of the source language, and the semantics of UML are not well defined ( since it's designed to map to different implementation languages, it itself doesn't define a complete execution model for its behavioural representations ), so you're unlikely to be able to reverse engineer and generate code between tools. You may find one tool that does full reverse engineering and full code generation for your A and B languages, and so may be able to get somewhere.
In general you don't use the same idioms on different platforms, so you're more likely to get something which emulates A code on B rather than something which corresponds to a native B solution.
If you want to use Java as the source language(that language you try to convert) than you might use Checkstyle AST(its used to write Rules). It gives you tree structure with every operation done in the source code. This will be much more easier than writing your own paser or using regex.
You can run com.puppycrawl.tools.checkstyle.gui.Main from checkstyle-4.4.jar to launch Swing GUI that parse Java Source Code.
Based on your comment
I'm not sure yet, but I think the source language/framework would be Java/Swing and the target some RIA language like Flex or a Javascript/Ajax framework. – Alain Michel 3 hours ago
Google Web Toolkit might be worth a look.
See this answer: What kinds of patterns could I enforce on the code to make it easier to translate to another programming language?

Resources