| 1 | 8 | eejlny | --This library is free software; you can redistribute it and/or
 | 
      
         | 2 |  |  | --modify it under the terms of the GNU Lesser General Public
 | 
      
         | 3 |  |  | --License as published by the Free Software Foundation; either
 | 
      
         | 4 |  |  | --version 2.1 of the License, or (at your option) any later version.
 | 
      
         | 5 |  |  |  
 | 
      
         | 6 |  |  | --This library is distributed in the hope that it will be useful,
 | 
      
         | 7 |  |  | --but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
      
         | 8 |  |  | --MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
      
         | 9 |  |  | --Lesser General Public License for more details.
 | 
      
         | 10 |  |  |  
 | 
      
         | 11 |  |  | --You should have received a copy of the GNU Lesser General Public
 | 
      
         | 12 |  |  | --License along with this library; if not, write to the Free Software
 | 
      
         | 13 |  |  | --Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 | 
      
         | 14 |  |  |  
 | 
      
         | 15 |  |  | -- e_mail : j.l.nunez-yanez@byacom.co.uk
 | 
      
         | 16 |  |  |  
 | 
      
         | 17 |  |  | -----------------------------------
 | 
      
         | 18 |  |  | --  ENTITY       = CML_ASSEMBLER --
 | 
      
         | 19 |  |  | --  version      = 1.0           --
 | 
      
         | 20 |  |  | --  last update  = 9/09/99      --
 | 
      
         | 21 |  |  | --  author       = Jose Nunez    --
 | 
      
         | 22 |  |  | -----------------------------------
 | 
      
         | 23 |  |  |  
 | 
      
         | 24 |  |  |  
 | 
      
         | 25 |  |  | -- FUNCTION
 | 
      
         | 26 |  |  | -- assembles the match location / match type codes and literal characters into a single word
 | 
      
         | 27 |  |  |  
 | 
      
         | 28 |  |  |  
 | 
      
         | 29 |  |  | -- PIN LIST
 | 
      
         | 30 |  |  | -- CODE_A     = match location/type code (left justified)
 | 
      
         | 31 |  |  | -- LENGTH_A   = match location/type code length
 | 
      
         | 32 |  |  | -- CODE_B     = literal characters (left justified)
 | 
      
         | 33 |  |  | -- LENGTH_B   = length of literal characters
 | 
      
         | 34 |  |  | -- CODE_OUT   = assembled output code
 | 
      
         | 35 |  |  | -- LENGTH_OUT = output code length
 | 
      
         | 36 |  |  |  
 | 
      
         | 37 |  |  |  
 | 
      
         | 38 |  |  | library ieee,dzx;
 | 
      
         | 39 |  |  | use ieee.std_logic_1164.all;
 | 
      
         | 40 |  |  | use dzx.bit_arith.all;
 | 
      
         | 41 |  |  |  
 | 
      
         | 42 |  |  |  
 | 
      
         | 43 |  |  | entity CML_ASSEMBLER is
 | 
      
         | 44 |  |  | port
 | 
      
         | 45 |  |  | (
 | 
      
         | 46 |  |  |         CODE_A : in bit_vector(10 downto 0);
 | 
      
         | 47 |  |  |         LENGTH_A : in bit_vector(3 downto 0);
 | 
      
         | 48 |  |  |         CODE_B : in bit_vector(33 downto 0);
 | 
      
         | 49 |  |  |         LENGTH_B : in bit_vector(5 downto 0);
 | 
      
         | 50 |  |  |         CODE_OUT : out bit_vector(34 downto 0);
 | 
      
         | 51 |  |  |         LENGTH_OUT : out bit_vector(5 downto 0)
 | 
      
         | 52 |  |  | );
 | 
      
         | 53 |  |  |  
 | 
      
         | 54 |  |  |  
 | 
      
         | 55 |  |  |  
 | 
      
         | 56 |  |  |  
 | 
      
         | 57 |  |  | end CML_ASSEMBLER;
 | 
      
         | 58 |  |  |  
 | 
      
         | 59 |  |  |  
 | 
      
         | 60 |  |  | architecture SHIFTER of CML_ASSEMBLER is
 | 
      
         | 61 |  |  |  
 | 
      
         | 62 |  |  | begin
 | 
      
         | 63 |  |  |  
 | 
      
         | 64 |  |  | SHIFT : process ( CODE_A , CODE_B , LENGTH_A )
 | 
      
         | 65 |  |  | begin
 | 
      
         | 66 |  |  | case LENGTH_A is
 | 
      
         | 67 |  |  |     when "0000" => CODE_OUT <= CODE_B & '0';
 | 
      
         | 68 |  |  |     when "0001" => CODE_OUT <= CODE_A(10)           & CODE_B;
 | 
      
         | 69 |  |  |     when "0010" => CODE_OUT <= CODE_A(10 downto 9) & CODE_B(33 downto 1);
 | 
      
         | 70 |  |  |     when "0011" => CODE_OUT <= CODE_A(10 downto 8) & CODE_B(33 downto 2);
 | 
      
         | 71 |  |  |     when "0100" => CODE_OUT <= CODE_A(10 downto 7)  & CODE_B(33 downto 3);
 | 
      
         | 72 |  |  |     when "0101" => CODE_OUT <= CODE_A(10 downto 6)  & CODE_B(33 downto 4);
 | 
      
         | 73 |  |  |     when "0110" => CODE_OUT <= CODE_A(10 downto 5)  & CODE_B(33 downto 5);
 | 
      
         | 74 |  |  |     when "0111" => CODE_OUT <= CODE_A(10 downto 4)  & CODE_B(33 downto 6);
 | 
      
         | 75 |  |  |     when "1000" => CODE_OUT <= CODE_A(10 downto 3)  & CODE_B(33 downto 7);
 | 
      
         | 76 |  |  |     when "1001" => CODE_OUT <= CODE_A(10 downto 2)  & CODE_B(33 downto 8);
 | 
      
         | 77 |  |  |     when "1010" => CODE_OUT <= CODE_A(10 downto 1)  & CODE_B(33 downto 9);
 | 
      
         | 78 |  |  |     when "1011" => CODE_OUT <= CODE_A  & CODE_B(33 downto 10);
 | 
      
         | 79 |  |  |     when others => CODE_OUT <= "00000000000000000000000000000000000";
 | 
      
         | 80 |  |  | end case;
 | 
      
         | 81 |  |  | end process SHIFT;
 | 
      
         | 82 |  |  |  
 | 
      
         | 83 |  |  |  
 | 
      
         | 84 |  |  |  
 | 
      
         | 85 |  |  | LENGTH_OUT <= ("00" & LENGTH_A) + LENGTH_B;
 | 
      
         | 86 |  |  |  
 | 
      
         | 87 |  |  |  
 | 
      
         | 88 |  |  | end SHIFTER; -- end of architecture
 | 
      
         | 89 |  |  |  
 | 
      
         | 90 |  |  |  
 | 
      
         | 91 |  |  |  
 |