Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

A beginner's question

Status
Not open for further replies.

daisyzari

Junior Member level 3
Joined
Feb 8, 2011
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,907
Can someone help me understand what this code means?
Code:
constant CLK_CNT : unsigned(7 downto 0) := conv_unsigned(20, 8);

Thank you :-D
 

constant CLK_CNT <= "00100000";
unclear why so write
 

No it's equivalent to assigning 20 decimal codded on 8 bits:

Code:
constant CLK_CNT : unsigned(7 downto 0) := X"14";

or

Code:
constant CLK_CNT : unsigned(7 downto 0) := "00010100";
 

conv_unsigned is not part of the official standard library,
so I recommend to_unsigned instead:

Code:
library ieee;
use ieee.numeric_std.all;

constant CLK_CNT : unsigned(7 downto 0) := to_unsigned(20, 8);
 

It is part of the std_logic_arith library which is not an IEEE standard library but is still used very often,
so it depends of the libraries that a specific project uses.
to_unsigned can only be used if numeric_std library is used (instead of std_logic_arith)

Alex
 

Thank you everyone it has become more clear to us now.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top