VCD dump for vhdl simulation via modelsim. HOWTO? - simulation

It's the first time i try to generate a VCD and i am getting some troubles.
I have a testbench called bench_minimips.vhdl that contain the entity sim_minimips.
I want simulate it and get a VCD out of it.
i am typing the following command in the Modelsim shell:
vsim work.sim_minimips
vcd file myvcd1.vcd
vcd add -file bench_minimips.vhd/*
run
but if i open myvcd1.vcd in an empty file. What should i do to create the dump?
I tryed as well as sudgested in another forum the command:
wlf2vcd -o myvcd2.vcd vsim.wlf
but a error is generated.
I am really lost in understanding because all the websites i find tells you to use a TCL generated by altera or some other company and i do not have theyr content to look at.
Does someone knows what should i do?
Best,
Stefano

The -file parameter to vcd add is not used to specify signals but the name of the VCD (if you've created several).
What you want to do instead is to add objects in your simulation. For example:
vcd file myvcd1.vcd
vcd add -r /sim_minimips/*

Related

colorgcc perl script with output to non-tty enabled writing to C dependency files

Ok, so here's my issue. I have written a build script in bash that pipes output to tee and sorts different output to different log files (so I can summarize errors/warnings at the end and get some statistics on files built). I wanted to use the colorgcc perl script (colorgcc.1.3.2) to colorize the output from gcc and had found in other places that this won't work piping to tee, since the script checks if it is writing to something that is not a tty. Having disabled this check everything was working until I did a full build and discovered some of the code we receive from another group builds C dependency files (we don't control this code, changing it or the build process for these isn't really an option).
The problem is that these .d files have the form as follows:
filename.o filename.d : filename.c \
dependant_file1.h \
dependant_file2.h (and so on for however many dependencies there are)
This output from GCC gets written into the .d file, but, since it is close enough to a warning/error message colorgcc outputs color codes (believe it's the check for filename:lineno:message but not 100% sure, could be filename:message check in the GCCOUT while loop). I've tried editing the regex to attempt to not match this but my perl-fu is admittedly pretty weak. So what I end up with is a color code on each line for these dependency files, which obviously causes the build to fail.
I ended up just replacing the check for ! -t STDOUT with a check for a NO_COLOR envar I set and unset in the build script for these directories (emulates the previous behavior of no color for non-tty). This works great if I run the full script, but doesn't if I cd into the directory and just run make (obviously setting and unsetting manually would work but this is a pain to do every time). Anyone have any ideas how to prevent this script from writing color codes into dependency files?
Here's how I worked around this. I added the following to colorgcc to search the gcc input for the flag to generate the .d files and just directly called the compiler in that case. This was inserted in place of the original TTY check.
for each $argnum (0 .. $#ARGV)
{
if ($ARGV[$argnum] =~ m/-M{1,2}/)
{
exec $compiler, #ARGV
or die("Couldn't exec");
}
}
I don't know if this is the proper 'perl' way of doing this sort of operation but it seems to work. Compiling inside directories that build .d files no longer inserts color codes and the source file builds do (both to terminal and my log files like I wanted). I guess sometimes the answer is more hacks instead of "hey, did you try giving up?".

Generate Swift Interface from Objective-C Header from Command Line

In Xcode, for any Objective-C header, we can view the Generated Interface, which shows how it is seen by Swift in interop.
I'd like to generate that from the command line. Any idea how to do it?
Bonus task: The header should be precompiled first, so all #imports should be replaced already.
Invoke interpreter command :type lookup on the module you are trying to inspect.
Suppose you have a header file named header.h. Put it into a separate directory, so that the interpreter would recognise it as a module. Also create a modulemap in the same directory. Let's call this directory Mod:
./
./Mod/
/header.h
/module.modulemap
Fill in the modulemap with the following:
module Mod {
header "./header.h"
export *
}
Once it's done, issue a command like this:
echo "import Mod\n:type lookup Mod" | swift -I./Mod | tail -n+2 >| generated-interface.swift
Alternatively, you might want use a command like this with equal effect:
echo "import Mod\n:print_module Mod" | swift -deprecated-integrated-repl -I./Mod >| generated-interface.swift
It's broken down as follows:
first we echo the script to be executed: import module and type-lookup it;
then we launch the interpreter and feed the script into it; the -I argument helps it find our module, which is crucial;
then we cut off the “Welcome to Swift” part with Tail
and write the result into generated-interface.swift.
While running the above commands, make sure your working directory is set to one level higher than the Mod directory.
Note that the output might not be exactly the same as from Xcode, but it's very similar.
Just for the record, if you want to produce the interface from a Swift file, then it's just this:
swiftc -print-ast file.swift

Can we give two files as input while using JasperStarter

I am using JasperStarter to create pdf from several jrprint files and then print it using JasperStarter functtions.
I want to create one single pdf file with all the .jrprint files.
If I give command like:
jasperstarter pr a.jprint b.jprint -f pdf -o rep
It does not recognise the files after the first input file.
Can we create one single output file with many input jasper/jrprint files?
Please help.
Thanks,
Oshin
Looking at the documentation, this is not possible:
The command process (pr)
The command process is for processing a report.
In direct comparison to the command for compiling:
The command compile (cp)
The command compile is for compiling one report or all reports in a directory.

How can I find Simulink Executable on my computer?

After I generate code with Simulink Coder choosing grt.tlc target Matlab gives me this adres as executable's adress. C:/PROGRA~1/MATLAB/R2013a\sys\lcc\bin\lcclnk -s -LC:/PROGRA~1/MATLAB/R2013a\sys\lcc\lib -o ../untitled.exe What does it mean? What am I supposed to do when I get a misterious adress like this?
Nothing "mysterious"
Your executable is at
../untitled.exe
meaning untitled.exe is present in one folder above the current working folder, probably the place where the simulink model resides
-o is used for output file name given to linker.

Why do I get an error with fopen when using matlab's mcc?

Setup:
Windows 7 Enterprise.
Matlab 7.10.0 (R2010a).
mcc compiler: Microsoft Visual C++ 2008 Express.
What's happening:
My project runs fine when running it through Matlab, but when trying to run the .exe through the command prompt after using mcc to compile, the command prompt generates an error.
The mcc command I issue is:
mcc -m -v STARTUP1.m -o EXE_REDUC
The error I receive in the command prompt is:
??? Error using ==> textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
I have a file called LoadXLS.m that loads and reads a .csv file using:
fid = fopen(file,'r');
temp_data = textscan(fid,...args...);
And then I process temp_data.
The csv file I'm trying to load is called spec.csv. It is located two directories down from where I have STARTUP1.m stored. The location of STARTUP1.m is also the place that the mcc generated files are stored to. I have used the pathtool to "Add with subfolders" this location, but am aware that those locations are not transferred to mbuild when compiling.
What I've Tried:
I have gone in and added print statements to print the value of fid to make sure it is valid. When I run it in Matlab, it has a valid value, however when I run in the command prompt it always returns an invalid value of -1.
I have removed all addpath() calls, I have tried adding the STARTUP1.m directory to the mcc ctf archive using:
mcc -m -v -a 'C:\Users\...path...\STARTUP1.m_location' STARTUP1.m -o EXE_REDUC;
However when I do this, I get a different error when running in the command prompt:
Cannot open CTF archive file
'C:\...path...\AppData\Local\Temp\mathworks_tmp_7532_28296'
or
'C:\...path...\AppData\Local\Temp\mathworks_tmp_7532_28296.zip'
??? Undefined function or variable 'matlabrc'.
To fix this, I've tried adding the pragma
%#function matlabrc
to the top of STARTUP1.m to try and enforce its inclusion, but had no success.
I also copied the spec.csv file to a new directory in the ctfroot and changed
fid = fopen(...)
to:
[tempFile, message] = fopen(fullfile(ctfroot, 'Added Config Files', ad.spec_file));
The message is:
message is: No such file or directory
Objective:
Rearranging file locations is a sufficient workaround while the exectuable only runs on my computer, however the idea is to take this standalone and distribute it to multiple people on many different computers. I would like to be able to have a top folder with a startup file and within this folder, have as many subfolders as the package requires. The startup file should be able to access all subfolders and files within them as necessary.
I read something about the exectuable actually running from a "secret location" on the machine here: http://matlab.wikia.com/wiki/FAQ
I would just like to be able to group one entire folder tree with all its files into a package containing the executable and be able to run it anywhere.
More info:
When I put the spec.csv file in the same directory as STARUTP1.m, it finds it fine using mcc without the -a 'path' option and using the following in the LoadXLS.m file:
[tempFile, message] = fopen(ad.spec_file,'r');
This project contains GUIs, generates PDFs, generates plots, and also creates a zip directory.
Thank you in advance.