OSDN Git Service

works
[fpga-leon-mjpeg/leon-mjpeg.git] / grlib-gpl-1.0.22-b4095 / lib / kuri / mjpeg / huff.vhd
index fe7f16c..c8b4e3b 100644 (file)
@@ -196,7 +196,6 @@ type ahbs_reg is record
    hreadyff : std_logic;
    hselff : std_logic;
    haddkeep : std_logic_vector(15 downto 0);
---   hwriteff :std_logic;
 end record;
 
 type apbs_reg is record
@@ -207,7 +206,6 @@ type apbs_reg is record
    incaddmcux : std_logic_vector(15 downto 0);
    incaddmcuy : std_logic_vector(10 downto 0);
    fbstartadd : std_logic_vector(31 downto 0);
---   error_reg : std_logic_vector(2 downto 0);
    through_bit : std_logic;
    hardonly : std_logic;
 end record;
@@ -631,9 +629,8 @@ end if;
         virq(hirq) := '1';
     end if;
 
-
 -- Through bit & skip counter calculation
--- This part is for "motion"-JPEG.
+-- This part is for "motion"-JPEG".
 -- It's not beautiful implementation, but.....
     if(r.fetch_state = ffcheck and r.preg.through_bit = '1' and  vbytedata = "11011010")then
         v.cntdown := '1';
@@ -743,6 +740,8 @@ end if;
    end if;
 
     v.valuebit := std_logic_vector(to_unsigned((to_integer(unsigned(r.valuebit)) + vint_plusv - vint_minusv), 6));
+  
+  -- Padding bit for Markers
    if(r.fetch_state =  markermode or r.preg.through_bit = '1') then
        if((r.valuebit = "000001" and r.fetch_reg(0) = '1')
            or (r.valuebit = "000010" and r.fetch_reg(1 downto 0) = "11")
@@ -790,11 +789,13 @@ end if;
    elsif(r.dec_state = serialwait)then
        vintshift := 1 + vint_valuebit - vint_sercnt;
    end if;
-   vshiftnum :=  std_logic_vector(to_unsigned(vintshift,5));    
+   vshiftnum :=  std_logic_vector(to_unsigned(vintshift,5)); 
+      
 -- shifter instantiation
 debug_shiftnum <= vshiftnum;
    vtmpshiftout := std_logic_vector(shift_right(unsigned(r.fetch_reg), vintshift));
    vshiftout := vtmpshiftout(15 downto 0);
+   
 -- write memory address generation
    if (r.dec_state = symcheck and unsigned(vcache_symbit) <= unsigned(r.valuebit) and vcache_symbit /= "00000")then
        va := '1';
@@ -984,11 +985,24 @@ end if;
 
 -- Decord part state-machine
 -- state = symreq, symcheck, valout, symng, symokvalng, serialwait, serialcheck, serialfinish, standby
-   vint_csymbit := to_integer(unsigned(vcache_symbit));
-   vint_reqbitkp := to_integer(unsigned(r.reqbit_keep));
-   vint_cvalbit := to_integer(unsigned(vcache_valbit));
-   vint_sersym := to_integer(unsigned(vserial_symbit));
-   vint_serval := to_integer(unsigned(vserial_valbit));
+   vint_csymbit := 0; vint_reqbitkp := 0; vint_cvalbit := 0;
+   vint_sersym := 0; vint_serval := 0;
+
+   if notx(vcache_symbit) then 
+       vint_csymbit := to_integer(unsigned(vcache_symbit)); 
+   end if;
+   if notx(r.reqbit_keep) then
+       vint_reqbitkp := to_integer(unsigned(r.reqbit_keep));
+   end if;
+   if notx(vcache_valbit) then
+       vint_cvalbit := to_integer(unsigned(vcache_valbit));
+   end if;
+   if notx(vserial_symbit) then
+       vint_sersym := to_integer(unsigned(vserial_symbit));
+   end if;
+   if notx(vserial_valbit) then
+       vint_serval := to_integer(unsigned(vserial_valbit));
+   end if;
    
    case r.dec_state is
    when  standby =>