OpenCores
URL https://opencores.org/ocsvn/modbus/modbus/trunk

Subversion Repositories modbus

[/] [modbus/] [trunk/] [enlace/] [bin2ascii_pkg.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 guanucolui
--      Package File Template
2
--
3
--      Purpose: This package defines supplemental types, subtypes, 
4
--               constants, and functions 
5
 
6
 
7
library IEEE;
8
use IEEE.STD_LOGIC_1164.all;
9
 
10
package bin2ascii_pkg is
11
 
12
 
13
  type <new_type> is
14
    record
15
        <type_name>        : std_logic_vector( 7 downto 0);
16
        <type_name>        : std_logic;
17
    end record;
18
 
19
-- Declare constants
20
 
21
  constant <constant_name>              : time := <time_unit> ns;
22
  constant <constant_name>              : integer := <value>;
23
 
24
-- Declare functions and procedure
25
 
26
  function <function_name>  (signal <signal_name> : in <type_declaration>) return <type_declaration>;
27
  procedure <procedure_name>    (<type_declaration> <constant_name>     : in <type_declaration>);
28
 
29
end bin2ascii_pkg;
30
 
31
 
32
package body <Package_Name> is
33
 
34
-- Example 1
35
  function <function_name>  (signal <signal_name> : in <type_declaration>  ) return <type_declaration> is
36
    variable <variable_name>     : <type_declaration>;
37
  begin
38
    <variable_name> := <signal_name> xor <signal_name>);
39
    return <variable_name>;
40
  end <function_name>;
41
 
42
 
43
-- Example 2
44
  function <function_name>  (signal <signal_name> : in <type_declaration>;
45
                         signal <signal_name>   : in <type_declaration>  ) return <type_declaration> is
46
  begin
47
    if (<signal_name> = '1') then
48
      return <signal_name>;
49
    else
50
      return 'Z';
51
    end if;
52
  end <function_name>;
53
 
54
-- Procedure Example
55
  procedure <procedure_name>  (<type_declaration> <constant_name>  : in <type_declaration>) is
56
 
57
  begin
58
 
59
  end <procedure_name>;
60
 
61
end bin2ascii_pkg;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.