What are yosys formal capabilities with verific? - yosys

I'm trying to use Yosys formal verification capabilities along with Verific parser.
What are the supported capabilities of yosys with verific for formal verification, compared to the "read_verilog -formal" command?
For example, a quick compilation of formal code that works with read_verilog gave me an error for "assume property" syntax:
"The sva directive is not sensitive to a clock. Unclocked directives are not supported"
I'm not sure if I should modify the Verific library flags in any way to make it support more capabilities, or it's something that is not supported.

Currently Yosys only has very limited support for SVA with or without Verific. However, we plan on vastly extending the Yosys support for SVA via Verific in the near future. The goal is to provide pretty much complete support for everything Verific can parse.
Regarding the "The sva directive is not sensitive to a clock. Unclocked directives are not supported" error message: That's a Verific error message and I don't think there is a Verific library flag to bypass it. (But I'm not sure.) Technically unclocked properties are not part of the SystemVerilog standard afaik. (The syntax would allow it, but the standard text does not define a semantic for it.)
Yosys supports unclocked SVA properties. (But only trivial expression properties.)
Both Verific and Yosys do support immediate assertions and assumptions. (That is assertions and assumptions in always blocks.) Right now this is the thing I recommend for most cases where people write new properties, also because most simulators have better support for immediate assertions (or it would be easier to add if the support is missing so far).
Right now I'd say the biggest advantage of using Verific with Yosys is support for non-SVA System Verilog (and VHDL) code. In a few months we will hopefully have support for much more SVA constructs via Verific, but that isn't implemented yet.
Edit/Update: SVA support via Verific is slowy improving now. See this directory for examples that can be processed via Verific. New examples are added as new features are added to the Verific bindings. Currently counter.sv is the most advanced example there.

Related

Verilog and SystemVerilog supported

In the Yosys manual I read
C.108 read
-sv2005 -sv2009 -sv2012
load HDL designs Load the specified Verilog/SystemVerilog files. (Full SystemVerilog support is only available via Verific.)
C.113 read_verilog – read modules from Verilog file
-sv enable support for SystemVerilog features. (only a small subset of SystemVerilog is supported)
Is there a concise spec anywhere about this? If not, a guidline? Which Verilog and which SystemVerilog?
What is Verific?
In Clifford: A Free and Open Source Verilog-to-Bitstream Flow for iCE40 FPGAs Wolf says that "Verilog is pretty much everything from Verilog 2005". What not from Verilog 2005? Changes over time from this late 2015 lecture?
Verific is a reference to a commercial front-end provided by Verific Design Automation. There's a commercial version of Yosys sold as part of the Symbiotic EDA Suite that comes with this Verific front end installed. The Verific front end provides full VHDL+SV support as you see above.
The open source version of Yosys officially supports only Verilog 2005. Unofficially, several SV features have been added to it, (Enum, Typedef, etc.) and there's a beta VHDL support provided by GHDL-synth that's a work in progress.
It looks like the folks at Antmicro were kind enough to provide a frontend that allows direct reading of SystemVerilog. Check the following blogpost https://antmicro.com/blog/2022/02/simplifying-open-source-sv-synthesis-with-the-yosys-uhdm-plugin/

Easy way to find out whether a Posix API is implemented by an OS

While writing my code I thought of having a common implementation for all POSIX OSes as opposed to separate implementation for each OS. One of the POSIX API I use is posix_fallocate() and while testing I found it not being supported by MacOS.
Had I known this earlier I would have not used this API or have had separate implementations for each OS.
So my question is - what is an easy way to find support for a particular posix call in different OSes? Do people always have to search documentation for each target OS?
Thanks.
Looking at the documentation is a good start, but it often won't tell you when a particular function has been implemented, which is also important. For obscure platforms, it may be difficult to tell which older versions are still relevant, which makes it even harder to decide whether a dependency on a particular POSIX feature is acceptable.
The other question is whether a feature is implemented, but with substandard quality. posix_fallocate is an interesting corner case in this regard. The glibc implementation uses emulation if the file system lacks support for an actual low-level fallocate operation (such as NFS until recently):
https://www.gnu.org/software/libc/manual/html_node/Storage-Allocation.html
Depending on what your application does, this behavior might not be acceptable. Just checking header files and documentation might not reveal this (the Note part in the documentation above was added only recently, for example).
In the end, there isn't a good substitute for building and testing as early as possible on all relevant targets, but I understand that this is increasingly difficult for non-Linux targets.

When is code considered platform-independent?

This question arose as the result of a discussion on the reply to a question about platform-independence of PhysicsFS library. The question is whether particular code could be considered cross-platform or platform-independent? Should the code conform to certain standards or maybe just run on a particular set of platforms?
That's a very good question! I am venturing to guess here so bear with me as I don't have a definite answer really.
I think "platform independent" refers to code that is run by something that hides away the infrastructure. For instance the JVM hides the platform from the language -- there is nothing in the language that gives you access to the platform -- hence the platform independence.
Cross platform I believe is something that is not shielded away from the details of the platform -- think JavaScript for instance : you have access to the browser and all of its quirks. So writing Javascript code to run on all browsers would be cross-browser -- and you can extrapolate this I think to "cross platform".
Platform-independent: if the compiler/system library/VM/etc... are standard conformant for that language/library/etc..., the code must compile/run on every future platform that adheres to the prescribed standard. This means that the code cannot use platform-dependent #ifdefs anywhere, and that the program does not access API's not defined in said standard.
Cross-platform: this is kind of ambiguous, and mostly personal preference. For me, it means that it runs on at least two of the three big platform/OSes (x86(_64) Windows, Linux, and/or Mac). In most cases it will work on a lot more platforms and architectures, and use some or mostly POSIX API functionality (at least for non-Windows code). It will contain a limited number of #ifdefs to call specialized API's for platforms that require it (posix vs win32 vs...).

Are there any text-editors/IDEs that support languages generically?

I'm looking for an editor/IDE that can provide features that are nice to have while coding (example: being able to click-through to function definitions) for languages that it is not specifically built for. By these, I have in mind languages designed for a very specific purpose and often only used by a small community. In other words, ones that would not have native support in most software.
I realize this would require a fair bit of fairy dust but I don't think it's out of the scope of what's possible. Basically, the editor would have to be smart enough to recognize the commonly used syntax and semantics that many declarative languages have in common. It's quite possible this would require some amount of configuration.
Does something like this exist? If not, what challenges do you think there would be in creating it?
If you need only the feature to jump of to the definition of a specific function or class, then VIM (and many other editors, like Emacs, Epsilon and JOE) can read the jump location from the ctags file. You just have to write a ctags file generator for your custom language.
For programmable editors (like VIM, Emacs, Epsilon, Eclipse and gedit), you can write your own plugin for your custom language, but it may quickly become time-consuming and a maintenance nightmare, because new versions of editors tend to change the plugin interface.
Please note that adding support for syntax highlighting is usually much easier than adding ctags-like support for symbol lookups. More advanced features, like refactoring and context-sensitive symbol completion (like Ctrl-Space and Tab in modern IDEs) are even harder to implement.
GNU Emacs has a pretty good infrastructure for this sort of thing. Until recently Haskell was a relatively unknown language used primarily by researchers. Nevertheless, in a few thousand lines of Emacs Lisp, we have
Syntax highlighting with colors
Automatic indentation
Package support
Automatic highlighting of type and other information when placing the cursor over library functions
Meta-dot on an identifier to jump to its definition (through the standard emacs tags mechanism)
The nice thing about Emacs is that (a) there are many models to follow, and (b) you can build up the environment gradually, starting with those aspects that are most important to you.
I'm suprised no one has mentioned Notepad++ yet:
http://notepad-plus-plus.org/
It offers syntax support for a great many languages and offers the user to add new languages, and an active community that adds many languages that are not included out-of-the-box.
Most good IDE's are language agnostic and supports several if not many programming languages. If you are talking about DSL's, eclipse has a solution that seems pretty awsome - Xtext
EditPadPro comes with a set of tools that allow you to build your own syntax highlighting, code folding and file navigation schemes, based on a very powerful regex syntax. So if your language is not among the many that have already been provided out-of-the-box or can be downloaded off the website, you can roll your own quite easily (and share it with the community).
Visual Studio is designed to allow for this, but it requires the language to add explicit support. For example, Delphi Prism will install into Visual Studio, and provide full language support.
This is far above and beyond "configuration", however, and requires quite a bit of custom development to support.
SciTE and Scintilla offer a generic editor/platform for different languages. The library contains several parsers that work with many programming languages and you can reuse one of these for your own language to add formatting and syntax highlighting.
They don't offer advanced features like click-throughs, but you could build it on top of the library.
Visual Studio and Eclipse also support language plug-ins.
Zeus is a language neutral IDE for the Windows platform and it provides this go to definition/declaration functionality for any language supported by ctags.
To make it work you just create a Zeus project/workspace and then add the files to this workspace.

Programming features missing in C++ and Java

What are the programming features that are missing in C++ and Java ?
For eg. You can't do recursive programming in QBasic ? You can't dynamically allocate memory in QBasic.
What would be the good to have features in C++, Java.
I think Lisp Programmers will be able to add a few.
I miss lambda expressions.
This answer deals only with C++
Things I miss from the syntax, or the standard library:
RegExp as part of the standard library
Threads as part of the standard library
Pointer to member methods (not objects!)
Properties would be nice (I have seen codes that emulate this via C++ preprocessor... note an nice looking code).
Some lower level networking API (sockets!), and higher level API (give me this file from this ftp, submit "this" to this site via POST).
This is the list of things I would like to see, but I assume other people will disagree with me.
Memory garbage collector is nice.
A n interface for a GUI toolkit - let MSVC map it to win32, and on Linux... (good question!)
A stable ABI. In C it's a standard - but on C++ we are still missing a few decades. I want also stable ABI between compilers - I want to compile one library in MinGW, the other with CL and all should work.
This is the list of things I want to see, but I know they will not get away:
Compatibility with C. Really, it's a myth right now. using namespace std killed it.
Include, headers. Most of the information is already available in the DLL/so/a/"library", do we really need to keep this bad decision from 30 years ago? If needed the compilers should keep information in the binaries.
The need for Makefiles - the compiler should be smart enough to know what to do with this code, from the code itself. Pascal is doing it quite good. I think also D.
(I might be wrong, please correct me) The official standard openly and freely available for viewing. Why should I pay for the official papers? Do I need to do it for HTTP? UTF8? Unicode?
I think this is a very subjective question. From a theoretical point of view there's nothing "missing" in Java because you can do everything you want to from the perspective of the outcome as an application.
As with QBasic - recursion may not be possible but that doesn't prevent you from changing your recursive algorithm to an iterative algorithm. Programming language theory tells us that you can do this with every recursive problem. So there's also nothing missing here.
I think what you mean are features that are "nice to have" - and here everyone has to decide for himself. I'd even say there are features in the language which would have been "nice not to have" such as static imports - but again this is my subjective opinion...