OSDN Git Service

add dct hardware with device driver
[fpga-leon-mjpeg/leon-mjpeg.git] / grlib-gpl-1.0.22-b4095 / lib / kuri / mjpeg / yccambaif.vhd
index 31390aa..be3c4e3 100644 (file)
@@ -29,16 +29,18 @@ entity yccambaif is
       apbo  : out apb_slv_out_type;
       kready : in std_logic;
       kstrobe : out std_logic;
-      kdata   : out std_logic_vector(7 downto 0);
+      kdata   : out std_logic_vector(11 downto 0);
       samp_fact : out std_logic;
-      error : in std_logic;
+      error : in std_logic_vector(2 downto 0);
       xmcumax : out std_logic_vector(5 downto 0);
       ymcumax : out std_logic_vector(4 downto 0);
       incaddy  : out std_logic_vector(15 downto 0);
       incaddmcux : out std_logic_vector(15 downto 0);
       incaddmcuy : out std_logic_vector(10 downto 0);
       fbstartadd : out std_logic_vector(31 downto 0);
-      startgen : out std_logic
+      startgen : out std_logic;
+      kstrobeq : out std_logic;
+      kdataq : out std_logic_vector(7 downto 0)
    );
 end;
 
@@ -55,8 +57,11 @@ constant pconfig : apb_config_type := (
  
 type ahbs_reg is record
    get : std_logic;
-   hdata    : std_logic_vector(7 downto 0);
+   hdata    : std_logic_vector(11 downto 0);
    written : std_ulogic;
+   getq : std_logic;
+   hdataq : std_logic_vector(7 downto 0);
+   writtenq : std_ulogic;
 end record;
 
 type apbs_reg is record
@@ -90,6 +95,7 @@ comb : process (r, rst, ahbsi, apbi, kready, error)
    vprdata := (others => '0'); 
    virq := (others => '0');
    v.hreg.written := '0';
+   v.hreg.writtenq := '0';
    vstartgen := '0';
    
 -- apb controle part
@@ -120,9 +126,9 @@ comb : process (r, rst, ahbsi, apbi, kready, error)
           if  apbi.pwdata(31) = '1' then
               vstartgen := '1'; 
           end if;        
-          v.preg.error_reg(2) := apbi.pwdata(31);
+--          v.preg.error_reg(2) := apbi.pwdata(31);
       end if;
-      vprdata := r.preg.error_reg(2) & "00000000000000000000000000000" & r.preg.error_reg(1 downto 0);
+      vprdata := r.preg.error_reg(2) & "0000000000000000000000000000" & r.preg.error_reg(2 downto 0);
    when others =>
    end case;  
 
@@ -134,17 +140,45 @@ comb : process (r, rst, ahbsi, apbi, kready, error)
        end if;
    end if;
    if r.hreg.get = '1' then
-        v.hreg.hdata(7 downto 0) := ahbsi.hwdata(7 downto 0);
+        v.hreg.hdata(11 downto 0) := ahbsi.hwdata(11 downto 0);
         v.hreg.written := '1';            
    end if;
-  
+   
+-- quant value input
+    v.hreg.getq := '0';
+    if (ahbsi.hready = '1') and (ahbsi.hsel(shindex) = '1') then
+        if (ahbsi.haddr(15 downto 0) = "0000000000000100") and (ahbsi.hwrite = '1') and (ahbsi.htrans = HTRANS_NONSEQ) then
+            v.hreg.getq := '1';
+        end if;
+    end if;
+    if r.hreg.getq = '1' then
+         v.hreg.hdataq(7 downto 0) := ahbsi.hwdata(7 downto 0);
+         v.hreg.writtenq := '1';            
+    end if; 
+
+-- error reg
+   if error(0) = '1' then
+       v.preg.error_reg(0) := '1';
+   end if;
+   if error(1) = '1' then
+       v.preg.error_reg(1) := '1';
+   end if;
+   if error(2) = '1' then
+       v.preg.error_reg(2) := '1';
+   end if;
+
+
 -- reset part
    if rst = '0' then
          v.hreg.hdata := (others => '0');
          v.hreg.written := '0';
          v.hreg.get := '0';
+         v.hreg.getq := '0';
+         v.hreg.writtenq := '0';
          v.preg.xmcumax := (others => '0');
          v.preg.ymcumax := (others => '0');
+         v.preg.incaddy := (others => '0');
+         v.preg.incaddmcux := (others => '0');
          v.preg.incaddmcuy := (others => '0');
          v.preg.error_reg := (others => '0');
    end if;
@@ -153,7 +187,7 @@ comb : process (r, rst, ahbsi, apbi, kready, error)
    rin <= v;   
    apbo.prdata <= vprdata;
    ahbso.hirq <= virq;
-   ahbso.hrdata <= kready & "00000000000000000000000" & r.hreg.hdata;
+   ahbso.hrdata <= kready & "0000000000000000000" & r.hreg.hdata;
    startgen <= vstartgen;
    kstrobe <= r.hreg.written;
    kdata <= r.hreg.hdata;
@@ -164,6 +198,8 @@ comb : process (r, rst, ahbsi, apbi, kready, error)
    incaddmcuy <= r.preg.incaddmcuy;
    fbstartadd <= r.preg.fbstartadd;
    samp_fact <= r.preg.sampf;
+   kstrobeq <= r.hreg.writtenq;
+   kdataq <= r.hreg.hdataq;
 end process;
 
    apbo.pirq <= (others => '0');