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

Subversion Repositories myhdl_lfsr

[/] [myhdl_lfsr/] [trunk/] [sample_modules/] [VHDL/] [pck_myhdl_090.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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