-
Notifications
You must be signed in to change notification settings - Fork 2
/
Std.pm
140 lines (102 loc) · 3.35 KB
/
Std.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# See copyright, etc in below POD section.
######################################################################
package Verilog::Std;
use Config;
use IO::File;
use File::Path;
use Verilog::Language;
use Carp;
use strict;
use vars qw ($VERSION);
######################################################################
#### Configuration Section
$VERSION = '3.408';
#######################################################################
# ACCESSORS
our %_Std_Data;
sub std {
my $std = shift || Verilog::Language::language_standard();
if (!$_Std_Data{$std}) {
my @out;
foreach (<DATA>) {
last if $_ =~ /^__END__/;
last if $std !~ /^1800/; # Non system verilog, ie 1364 has no std package
push @out, $_;
}
$_Std_Data{$std} = join('',@out);
}
return $_Std_Data{$std};
}
#######################################################################
# It's a PITRA to have pure datafiles get installed properly,
# so we just paste our text into this package.
1;
__DATA__
`line 1 "Perl_Verilog::Std_module" 0
// Verilog-Perl Verilog::Std
// The basis for this package is described in IEEE 1800-2012 Annex G
package std;
class semaphore;
extern function new(int keyCount = 0);
extern function void put(int keyCount = 1);
extern task get(int keyCount = 1);
extern function int try_get(int keyCount = 1);
endclass
class mailbox #(type T = dynamic_singular_type) ;
extern function new(int bound = 0);
extern function int num();
extern task put( T message);
extern function int try_put( T message);
extern task get( ref T message );
extern function int try_get( ref T message );
extern task peek( ref T message );
extern function int try_peek( ref T message );
endclass
class process;
typedef enum { FINISHED, RUNNING, WAITING, SUSPENDED, KILLED } state;
extern static function process self();
extern function state status();
extern function void kill();
extern task await();
extern function void suspend();
extern function void resume();
endclass
// randomize is here, however the parsing rules are special,
// For example there is "(null)", variable arguments, and "with {...}"
// randomize really should be a language keyword.
function int randomize();
endfunction
endpackage : std
import std::*;
__END__
=pod
=head1 NAME
Verilog::Std - SystemVerilog Built-in std Package Definition
=head1 SYNOPSIS
Internally used by Verilog::SigParser, etc.
use Verilog::Std;
print Verilog::Std::std;
=head1 DESCRIPTION
Verilog::Std contains the built-in "std" package required by the
SystemVerilog standard.
=head1 FUNCTIONS
=over 4
=item std ({I<standard>})
Return the definition of the std package. Optionally pass the language
standard, defaulting to what Verilog::Language::language_standard returns if
unspecified.
=back
=head1 DISTRIBUTION
Verilog-Perl is part of the L<http://www.veripool.org/> free Verilog EDA
software tool suite. The latest version is available from CPAN and from
L<http://www.veripool.org/verilog-perl>.
Copyright 2009-2014 by Wilson Snyder. This package is free software; you
can redistribute it and/or modify it under the terms of either the GNU
Lesser General Public License Version 3 or the Perl Artistic License
Version 2.0.
=head1 AUTHORS
Wilson Snyder <[email protected]>
=head1 SEE ALSO
L<Verilog-Perl>
=cut
######################################################################