Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > golomb code

Reply
Thread Tools

golomb code

 
 
s.arthi s.arthi is offline
Junior Member
Join Date: Nov 2011
Posts: 2
 
      11-20-2011
how to write the vhdl code for run's of zeroes end with 1...

eg:0001
should written as 3

the code which i ve tried is,

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity sample is
port( b0: inout std_logic_vector(13 downto 0):="10110000000010";
count0: out std_logic_vector(13 downto 0);
count1: out bit;
reset,clk: in std_logic);
end sample;

architecture beh of sample is
signal a0: std_logic_vector(13 downto 0);
--constant c: integer := 1;

begin
process(clk,reset)
variable cnt0 : std_logic_vector(13 downto 0);--:=(others=>'0');
variable cnt1 : std_logic;

begin
if reset='0' then
a0<=(others=>'0');
elsif clk='1' and clk'event then
a0<=b0;

end if;
cnt0:=(others=>'0');
for i in 0 to 13 loop
if a0(i) = '0' then
cnt0:= cnt0 + 1;
end if;
if a0(i) ='1' then
cnt1 := '1';
end if;
end loop;
count0 <= cnt0;
count1 <= '1';
end process;
end;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
image compression using golomb-rice algorithm gokuldeep VHDL 0 03-29-2013 01:46 PM
what is the difference between code inside a <script> tag and code in the code-behind file? keithb ASP .Net 1 03-29-2006 01:00 AM
Fire Code behind code AND Javascript code associated to a Button Click Event =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?= ASP .Net 4 02-11-2004 07:31 AM
Re: C# Equivalent of VB.Net Code -- One line of code, simple Ian ASP .Net 0 06-25-2003 01:14 PM
Re: C# Equivalent of VB.Net Code -- One line of code, simple Ron ASP .Net 1 06-24-2003 07:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57