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

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [examples/] [full_adder.h] - Blame information for rev 38

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 jcastillo
// File: full_adder.h
2
 
3
#include "half_adder.h"
4
 
5
SC_MODULE (full_adder) {
6
  sc_in<bool> a, b, carry_in;
7
 
8
  sc_out<bool> sum, carry_out;
9
 
10
  sc_signal<bool> c1, s1, c2;
11
 
12
  void prc_or ();
13
 
14
  half_adder *ha1_ptr, *ha2_ptr,*ha2_ptr; // not supported by sc2v_0.4 ?
15
 
16
  SC_CTOR (full_adder) {
17
    ha1_ptr = new half_adder ("ha1");
18
 
19
    // Named association:
20
    ha1_ptr->a (a);
21
    ha1_ptr->b (b);
22
    ha1_ptr->sum (s1);
23
    ha1_ptr->carry (c1);
24
 
25
    ha2_ptr = new half_adder ("ha2");
26
 
27
    // Positional association:
28
//    (*ha2_ptr) (s1, carry_in, sum, c2); // not supported by scv_0.4 ?
29
    ha2_ptr->a (s1);
30
    ha2_ptr->b (carry_in);
31
    ha2_ptr->sum (sum);
32
    ha2_ptr->carry (c2);
33
 
34
 
35
    SC_METHOD (prc_or);
36
    sensitive << c1 << c2;
37
  }
38
//#ifndef SYNTHESIS
39
// Destructors not supported by sc2v _0.4 ?
40
//~full_adder() {
41
//  delete ha1_ptr;
42
//  delete ha2_ptr;
43
//}
44
//#endif
45
};

powered by: WebSVN 2.1.0

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