Variable initialization in vhdl - initialization

I am using Xilinx Isim for vhdl simulation. i have intialized a variable like (signal q: std_logic_vector(15 downto 0):="0000000000000000";). But when it comes to simulation that particular value is not initialized. its showing undefined('U'). I have to use that value in feedback. so the values depending on it are also undefined('U'). And one more thing, if initialize the signal is get synthesized? what happens when I dump it in to an FPGA? please tell me the solution

The initialisation expression will work in ISIM, as well as for synthesis with XST. What you are seeing suggests there is a driver on that signal which is uninitialised or not properly reset. Find and check all the drivers on that signal - reading the ISIM documentation for its "drivers" command may help you in this task.

Related

What is the original use case of SIGEMT?

I can not find any documentation or code that describe what SIGEMT was originally invented for.
All the code I can find (e.g. with debian code search) seems to just handle it like all the other signals that terminate the process or just map the signal number to a name (or name to number).
From the short descriptions it looks like this is used in some kind or instruction emulation that has a kernel and a user space part. Is there any software that actually uses this?
I could find code in the linux kernel that might emit the signal, but it's not documented either.

What does this common SPI function do?

I see this function in Arduino scripts using SPI: ISR (SPI_STC_vect). I am familiar with C but this doesn't seem to follow - it looks like a function though there is no return type definition, and the argument doesn't make sense. I am new to SPI and cannot find much/any documentation online. Other functions which run during an interrupt are called using attachInterrupt, however this doesn't seem to be called anywhere.
ISR() is a macro that introduces an interrupt handler.
SPI_STC_vect is a Serial Transfer Complete interrupt vector.
See here for complete documentation, including the list of available interrupt vectors.

How to bypass Serial port libraries in Arduino

I want to write my own code for managing an Arduino serial port (9bit serial) so I need to bypass the preprogrammed arduino ISR vector for Serial1 TX. I can do that by modifying HardwareSerial1.cpp but I dislike the fact that my code becomes non portable and a potential victim of library updates.
Do you know how to program a different ISR vector without messing into library code? I tried this in my own code to no avail:
//bypass arduino library for serial 1 and use this ISR instead
ISR(UART1_UDRE_vect)
{
9bitSerial.interrupt();
}
The following error is reported, which seems to confirm the approach doesn't work:
ISR.cpp:11:25: error: expected unqualified-id before numeric constant
ISR.cpp:in expansion of macro 'UART1_UDRE_vect'
Any clues?
The safest way, IMHO, is to copy the entire HardwareSerial class to a differently-named class. Then proceed to make your modifications. This is exactly what I did for NeoHWSerial and NeoICSerial: they are copied and renamed from HardwareSerial and AltSoftSerial.
However, all uses of Serialx (instances of HardwareSerial) in a build must be replaced with instances of your class. You won't be able to mix instances of HardwareSerial with your class (duplicate ISR errors). But that's no big deal if your class only adds behavior. Other instances that don't use 9 bits should not be affected. If you don't mind, I'd be interested in folding those changes into NeoHWSerial. I've been occasionally looking at 9-bit serial for NeoSWSerial, too.

Mvapich2 buffer aliasing

I am launched an MPI program with MVAPICH2 and got this error:
Fatal error in PMPI_Gather:
Invalid buffer pointer, error stack:
PMPI_Gather(923): MPI_Gather() failed
PMPI_Gather(857): Buffers must not be aliased
There are two ways I think I could solve this:
Rewrite my MPI program (use different buffers)
Disable checking buffer aliasing
Do someone know how I could do this with MVAPICH2? Some compiler option, parameter, environmental variable, etc?
Something like MV2_NO_BUFFER_ALIAS_CHECK, but it does not work.
What you're doing is an incorrect program and you should rewrite your code to use separate buffers
Alternatively, you might be able to use MPI_IN_PLACE if you want to use the same buffer as both the input and output values of your MPI_GATHER. Without seeing your code, I can't tell you how you could do that. You can check out some documentation about MPI_GATHER and read more about how MPI_IN_PLACE works and see if that solves your problem.

how is the connection between signal and slot made in QT?

I have been a Qt programmer for quite some time now and i understand most of the general features of Qt. I am still confused about how the connect statement connects a signals to a slot at run time. Basically i would like to understand what happens at compile time and what happens at run time..
compile time: meta object compiler will generate code to implement a signal in an additional cpp file (one for each class containing Q_OBJECT).
run time: signal is mapped to a slot, slot gets executed? this is the part i am not clear about...SIGNAL and SLOTS are macros that expand to string representation of the signal/slot names...how does this and the meta object help in mapping calls to slots at run time? details would be appreciated...
EDIT:
this link will give you a better idea..(only if you are interested in the gory details...)
http://dev.libqxt.org/libqxt/wiki/Meta_Object_Format
couple this with the documentation of QMetaObject and things should become clear...
There are various ways you can connect a signal to a method (signal/slot).
However, they all revolve around getting the correct method number.
After you have the correct method number and the object to call it on, you simply call a virtualized function (qt_metacall) in QObject which finds the correct method to call from the number given. You can find this function in the files that the MOC generates. Also, in that generated file, you can find a line which creates a static QMetaObject of your class. This object registers the names of your slots and signals to the method numbers.
These might provide some interesting stuff to read:
http://doc.qt.io/qt-5/qmetaobject.html
http://doc.qt.io/qt-5/metaobjects.html
http://doc.qt.io/qt-5/signalsandslots.html
You can also learn a lot by running thought the slot activations with a debugger.
Basically signals and slots work similar to messages in Objective-C.
The macros cause the preprocessor to replace them with some code which "registers" and "looks up" the functions/methods that are to be effectively executed when a slot is called.
This allows for more flexibility, because the code that is emitting a signal or calling a slot does not need to know much about the other code modules which use them. Each slot and signal generate a signature that is looked up at runtime and then called.
If you are familiar with C/C++, you can compare this to dynamic libraries. Symbols are looked up at runtime and their address is then used to let the CPU "jump" to them to execute.
Also, these links might help you:
Qt question: How do signals and slots work?
http://doc.qt.io/qt-5/signalsandslots.html

Resources