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

Subversion Repositories wb_lcd

[/] [wb_lcd/] [trunk/] [myhdl/] [wb_lcd_workspace/] [workspace/] [lcd_display/] [src/] [pck_myhdl_06.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jvillar
-- File: pck_myhdl_06.vhd
2
-- Generated by MyHDL 0.6
3
-- Date: Wed Apr 15 12:32:15 2009
4
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
use ieee.numeric_std.all;
8
 
9
package pck_myhdl_06 is
10
 
11
    attribute enum_encoding: string;
12
 
13
    function to_std_logic (arg: boolean) return std_logic;
14
 
15
    function to_unsigned (arg: boolean; size: natural) return unsigned;
16
 
17
    function to_signed (arg: boolean; size: natural) return signed;
18
 
19
    function to_integer(arg: boolean) return integer;
20
 
21
    function to_integer(arg: std_logic) return integer;
22
 
23
    function to_unsigned (arg: std_logic; size: natural) return unsigned;
24
 
25
    function to_signed (arg: std_logic; size: natural) return signed;
26
 
27
    function to_boolean (arg: std_logic) return boolean;
28
 
29
    function to_boolean (arg: unsigned) return boolean;
30
 
31
    function to_boolean (arg: signed) return boolean;
32
 
33
    function to_boolean (arg: integer) return boolean;
34
 
35
    function "-" (arg: unsigned) return signed;
36
 
37
end pck_myhdl_06;
38
 
39
 
40
package body pck_myhdl_06 is
41
 
42
    function to_std_logic (arg: boolean) return std_logic is
43
    begin
44
        if arg then
45
            return '1';
46
        else
47
            return '0';
48
        end if;
49
    end function to_std_logic;
50
 
51
    function to_unsigned (arg: boolean; size: natural) return unsigned is
52
        variable res: unsigned(size-1 downto 0) := (others => '0');
53
    begin
54
        if arg then
55
            res(0):= '1';
56
        end if;
57
        return res;
58
    end function to_unsigned;
59
 
60
    function to_signed (arg: boolean; size: natural) return signed is
61
        variable res: signed(size-1 downto 0) := (others => '0');
62
    begin
63
        if arg then
64
            res(0) := '1';
65
        end if;
66
        return res;
67
    end function to_signed;
68
 
69
    function to_integer(arg: boolean) return integer is
70
    begin
71
        if arg then
72
            return 1;
73
        else
74
            return 0;
75
        end if;
76
    end function to_integer;
77
 
78
    function to_integer(arg: std_logic) return integer is
79
    begin
80
        if arg = '1' then
81
            return 1;
82
        else
83
            return 0;
84
        end if;
85
    end function to_integer;
86
 
87
    function to_unsigned (arg: std_logic; size: natural) return unsigned is
88
        variable res: unsigned(size-1 downto 0) := (others => '0');
89
    begin
90
        res(0):= arg;
91
        return res;
92
    end function to_unsigned;
93
 
94
    function to_signed (arg: std_logic; size: natural) return signed is
95
        variable res: signed(size-1 downto 0) := (others => '0');
96
    begin
97
        res(0) := arg;
98
        return res;
99
    end function to_signed;
100
 
101
    function to_boolean (arg: std_logic) return boolean is
102
    begin
103
        return arg = '1';
104
    end function to_boolean;
105
 
106
    function to_boolean (arg: unsigned) return boolean is
107
    begin
108
        return arg /= 0;
109
    end function to_boolean;
110
 
111
    function to_boolean (arg: signed) return boolean is
112
    begin
113
        return arg /= 0;
114
    end function to_boolean;
115
 
116
    function to_boolean (arg: integer) return boolean is
117
    begin
118
        return arg /= 0;
119
    end function to_boolean;
120
 
121
    function "-" (arg: unsigned) return signed is
122
    begin
123
        return - signed(resize(arg, arg'length+1));
124
    end function "-";
125
 
126
end pck_myhdl_06;
127
 
128
 

powered by: WebSVN 2.1.0

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