Skip to content
This repository
Newer
Older
100644 84 lines (66 sloc) 2.374 kb
13aaaab7 »
2008-11-06 Bring analog contribution statements to the ivl_target API.
1 /*
1993bf6f » caryr
2010-05-31 Remove malloc.h support and for C++ files use <c...> include files.
2 * Copyright (c) 2008-2010 Stephen Williams (steve@icarus.com)
13aaaab7 »
2008-11-06 Bring analog contribution statements to the ivl_target API.
3 *
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.will need a Picture Elements Binary Software
9 * License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
f5aafc32 » arunpersaud
2012-08-28 updated FSF-address
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
13aaaab7 »
2008-11-06 Bring analog contribution statements to the ivl_target API.
19 */
20
21 # include "config.h"
22
23 # include <iostream>
24
25 # include <cstring>
26 # include "target.h"
27 # include "ivl_target.h"
28 # include "compiler.h"
29 # include "t-dll.h"
1993bf6f » caryr
2010-05-31 Remove malloc.h support and for C++ files use <c...> include files.
30 # include <cstdlib>
a4a7b0a0 » caryr
2010-10-23 Make ivl_alloc.h the last include so it doesn't effect any system inc…
31 # include "ivl_alloc.h"
13aaaab7 »
2008-11-06 Bring analog contribution statements to the ivl_target API.
32
33 bool dll_target::process(const NetAnalogTop*net)
34 {
35 bool rc_flag = true;
36
37 ivl_process_t obj = (struct ivl_process_s*)
38 calloc(1, sizeof(struct ivl_process_s));
39
40 obj->type_ = net->type();
41 obj->analog_flag = 1;
42
43 FILE_NAME(obj, net);
44
45 /* Save the scope of the process. */
46 obj->scope_ = lookup_scope_(net->scope());
47
48 obj->nattr = net->attr_cnt();
49 obj->attr = fill_in_attributes(net);
50
51 assert(stmt_cur_ == 0);
52 stmt_cur_ = (struct ivl_statement_s*)calloc(1, sizeof*stmt_cur_);
53 rc_flag = net->statement()->emit_proc(this) && rc_flag;
54
55 assert(stmt_cur_);
56 obj->stmt_ = stmt_cur_;
57 stmt_cur_ = 0;
58
59 /* Save the process in the design. */
60 obj->next_ = des_.threads_;
61 des_.threads_ = obj;
62
63 return rc_flag;
64 }
65
66 bool dll_target::proc_contribution(const NetContribution*net)
67 {
68 assert(stmt_cur_);
69 assert(stmt_cur_->type_ == IVL_ST_NONE);
70 FILE_NAME(stmt_cur_, net);
71
72 stmt_cur_->type_ = IVL_ST_CONTRIB;
73
74 assert(expr_ == 0);
75 net->lval()->expr_scan(this);
76 stmt_cur_->u_.contrib_.lval = expr_;
77 expr_ = 0;
78
79 net->rval()->expr_scan(this);
80 stmt_cur_->u_.contrib_.rval = expr_;
81 expr_ = 0;
82
83 return true;
84 }
Something went wrong with that request. Please try again.