- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In VHDL, we can assign a value to a variable in a process like:
variable cnt : STD_LOGIC_VECTOR(3 DOWNTO 0) := -1; Can this be synthesized or just for simulation? Thanks very much.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, no problems with synthesis. But it will only have an effect if cnt becomes a register.
NOTE: you cannot assign -1 to a std_logic_vector. a std_logic_Vector is not a number.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A variable in vhdl process ends up as either register or not depending on how its value is located:
if you assign its value after it is updated then no register is synthesized. e.g. var1 := var1+1; data <= var1; if you assign its value before it is updated then it implies memory. e.g. data <= var1; var1 := var1 + 1; in both cases its own value is updated immediately.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks very much, both of you.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page