Академический Документы
Профессиональный Документы
Культура Документы
New Posts
What's New?Unansw ered Posts FAQ Forum Actions Com m unity Quick Links Advanced Search
Forum Digital Design and Programming PLD, SPLD, GAL, CPLD, FPGA Design
VHDL hexadecimal instead of binary
Results 1 to 11 of 11
+ Post New Thread
VHDL hexadecimal instead of binary
02-03-12, 21:25 #1
shaiko
VHDL hexadecimal instead of binary
Advanced Member level 4
PHP Code:
process is
Join Date: Aug 2011
begin
Posts: 1,035 case address_i is
Helped: 110 / 110 when "0100" =>
Points: 4,832
--- do something
when "0101" =>
Level: 16 --- do something else
when others =>
--- do something else
end case ;
end process ;
02-03-12, 21:25
02-03-12, 23:01 #2
lucbra
Re: VHDL hexadecimal instead of binary
www.edaboard.com/thread243075.html 1/6
9/5/13 VHDL hexadecimal instead of binary
Advanced Member level 1
like you wrote it: x"4" for an address range from 0 to 15 (0 -> F),
x"FF" for an address range of 0 to FF (255).
Achievements: If you want you can use a separator between bytes, like:
x"C0_FF_EE", which is identical to x"C0FFEE".
Join Date: Oct 2003
Location: Belgium 1 members found this post helpful.
Posts: 496
Helped: 68 / 68
Points: 4,030
Level: 14
02-03-12, 23:22 #3
shaiko
Re: VHDL hexadecimal instead of binary
Advanced Member level 4
There's a problem here.
actually "0100" is just an example.
Join Date: Aug 2011 The real address bus I'm dealing with is 15 bits wide ( wich isn't a
Posts: 1,035 multiple of 4 ).
Helped: 110 / 110
Points: 4,832
Level: 16
02-03-12, 23:22
03-03-12, 09:20 #4
TrickyDicky
Re: VHDL hexadecimal instead of binary
Advanced Member level 5
you could concatenate 3 bits with 3 hex digits.
03-03-12, 09:20
www.edaboard.com/thread243075.html 2/6
9/5/13 VHDL hexadecimal instead of binary
03-03-12, 10:25 #5
std_match
Re: VHDL hexadecimal instead of binary
Full Member level 6
I think it is better to do a concatenation in the case expression:
Code:
variable tmp_addr: std_logic_vector(15 downto 0);
begin
tmp_addr := '0' & addr;
case tmp_addr is
when x"7890" => do_something
03-03-12, 22:00 #6
lucbra
Re: VHDL hexadecimal instead of binary
Advanced Member level 1
I would concatenate before the case using a variable like
std_match did
Achievements:
04-03-12, 00:02 #7
www.edaboard.com/thread243075.html 3/6
9/5/13 VHDL hexadecimal instead of binary
Code:
variable address_integer: natural range 0 to 2**15 - 1
;
...
address_integer := to_integer(address_i)
case address_integer is
when 16#0004# =>
when 16#1234# =>
when 16#2BCD# =>
when 16#7FFF# =>
when others =>
end case;
Kevin Jennings
04-03-12, 00:22 #8
shaiko
Re: VHDL hexadecimal instead of binary
Advanced Member level 4
K-J,
Is writing 16#7FFF# and x"7FFF" is the same ?
Join Date: Aug 2011
Posts: 1,035
Helped: 110 / 110
Points: 4,832
Level: 16
04-03-12, 00:44 #9
K-J
Re: VHDL hexadecimal instead of binary
Full Member level 5
Note that since you're specifying an integer value rather than bits
within a collection, you're not hamstrung by having to have the
right collection of bits as you are currently having with your posted
problem which has 15 bits which isn't a multiple of 4 which means
you have to kludge together the last three bits somehow.
Kevin Jennings
std_match
Re: VHDL hexadecimal instead of binary
Full Member level 6
www.edaboard.com/thread243075.html 5/6
9/5/13 VHDL hexadecimal instead of binary
TrickyDicky
Re: VHDL hexadecimal instead of binary
Advanced Member level 5
just as a note, VHDL2008 has some string literal enhancements:
copied from
http://www.doulos.com/knowhow/vhdl_d...ease/#bistring
need verilog code for 8bit alu with component instantiating | VHDL : question about components and packages
Similar Threads
Need VHDL Coding for converting Hexadecimal into ASCII value (2)
Hexadecimal to Binary for Odd Hexadecimal numbers (1)
Converting from binary to hexadecimal using C18 (4)
The Binary and hexadecimal number systems explained (3)
Verilog Expert Question: hexadecimal and binary in SM (5)
-- Edaboard Classic Contact Us Forum for Electronics Privacy Statement Terms of Service
Top
Powered by vBulletin
Copyright 2010 vBulletin Solutions, Inc. All rights reserved.
SEO by vBSEO 2011, Crawlability, Inc.
www.edaboard.com/thread243075.html 6/6