- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can a data register be one bit wide?
Thanks. MSLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What exactly do you mean by this?
Are you refering to Verilog? or VHDL? then yes. If you are refering to a C++ compiler, then I don't belive that C supports a 1 bit memory of any type. You can make a BOOL type, which is in a sense only 1 bit (on or off) however; the actuall implementation is larger than 1 bit. (Depending upon the compiler, I belive it can be as large as an Integer! Sheesh) If you want 1 bit memory out of the SOPC builder, I dont belive you can do that either. (may be possible, but I dont think any code could address it) Good luck.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sounds like you don't want to waste LE's, so yes you can. Simply use the lsb data bit (send either 0 or 1 to the register), and just store it in the register. One thing though is if you have a seperate software team, make sure they know it's a single bit being stored (if they try to store 2 they would be surprised to read back 0). Registers are simply D flipflops so you can make any width you like (the logic it feeds could experience a performance problem if the data is too wide depending on the implementation).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cannot use Boolean variables with the Nios IDE .. the compilation return an error when declaring a Boolean!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What error do you have? There isn't any problem using booleans in C/C++. It is a standard type in C++, but in C you need to create it with a typedef.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't know that C doesn't support that type!
thanks ..- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My colleague use bool type for some variables. But I think it takes at least 1 Bytes in memory.
You need #include <stdbool.h>- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page