Project

General

Profile

Download (3.08 KB) Statistics
| Branch: | Tag: | Revision:
1
-- This file has been generated by CoCoSim2.
2

    
3
-- Compiler: Lustre compiler 2 (ToLustre.m)
4
-- Time: 03-Dec-2018 22:20:27
5
node  abs_int(x : int;)
6
returns(y : int;);
7
let
8
	y = if (x >= 0) then
9
		x
10
	    else (- x);
11
tel
12

    
13
node  _NOT_Bitwise_Unsigned_8(x : int;)
14
returns(y : int;);
15
let
16
	y = (255 - x);
17
tel
18

    
19
node  rem_int_int(x : int;
20
	y : int;)
21
returns(z : int;);
22
let
23
	z = if ((y = 0) or (x = 0)) then
24
		0
25
	    else ((x mod y) - (if (((x mod y) <> 0) and (x <= 0)) then abs_int(y) else 0));
26
tel
27

    
28
node  int_to_int8(x : int;)
29
returns(y : int;);
30
let
31
	y = if (x > 127) then
32
		(-128 + rem_int_int(( x - 127 - 1 ), 256))
33
	    else if (x < -128) then
34
		(127 + rem_int_int(( x + 128 + 1 ), 256))
35
	    else x;
36
tel
37

    
38
node  _AND_Bitwise_Unsigned_8(x : int;
39
	y : int;)
40
returns(z : int;);
41
let
42
	z = ( ((x mod 2) * (y mod 2)) + ( 2 * ((x / 2) mod 2) * ((y / 2) mod 2) ) + ( 4 * ((x / 4) mod 2) * ((y / 4) mod 2) ) + ( 8 * ((x / 8) mod 2) * ((y / 8) mod 2) ) + ( 16 * ((x / 16) mod 2) * ((y / 16) mod 2) ) + ( 32 * ((x / 32) mod 2) * ((y / 32) mod 2) ) + ( 64 * ((x / 64) mod 2) * ((y / 64) mod 2) ) + ( 128 * ((x / 128) mod 2) * ((y / 128) mod 2) ) );
43
tel
44

    
45
node  _NAND_Bitwise_Unsigned_8(x : int;
46
	y : int;)
47
returns(z : int;);
48
let
49
	z = _NOT_Bitwise_Unsigned_8(_AND_Bitwise_Unsigned_8(x, y));
50
tel
51

    
52
node  _AND_Bitwise_Signed_8(x : int;
53
	y : int;)
54
returns(z : int;);
55
var x2 : int;
56
	y2 : int;
57
let
58
	x2 = if (x < 0) then
59
		(256 + x)
60
	    else x;
61
	y2 = if (y < 0) then
62
		(256 + y)
63
	    else y;
64
	z = int_to_int8(_AND_Bitwise_Unsigned_8(x2, y2));
65
tel
66

    
67
node  _NAND_Bitwise_Signed_8(x : int;
68
	y : int;)
69
returns(z : int;);
70
var x2 : int;
71
	y2 : int;
72
let
73
	x2 = if (x < 0) then
74
		(256 + x)
75
	    else x;
76
	y2 = if (y < 0) then
77
		(256 + y)
78
	    else y;
79
	z = int_to_int8(_NAND_Bitwise_Unsigned_8(x2, y2));
80
tel
81

    
82
node  _NOT_Bitwise_Signed(x : int;)
83
returns(y : int;);
84
let
85
	y = ((- x) - 1);
86
tel
87

    
88
(*
89
Original block name: BitwiseNAND_int8
90
*)
91
node  BitwiseNAND_int8(In1_1 : int;
92
	In2_1 : int;
93
	In3_1 : int;
94
	In4_1 : int;
95
	In4_2 : int;
96
	In4_3 : int;
97
	In5_1 : int;
98
	In5_2 : int;
99
	In5_3 : int;
100
	In6_1 : int;
101
	In6_2 : int;
102
	In6_3 : int;)
103
returns(Out1_1 : int;
104
	Out2_1 : int;
105
	Out2_2 : int;
106
	Out2_3 : int;
107
	Out3_1 : int;
108
	Out3_2 : int;
109
	Out3_3 : int;
110
	Out4_1 : int;);
111
var Bitwise_1 : int;
112
	Bitwise1_1 : int;
113
	Bitwise1_2 : int;
114
	Bitwise1_3 : int;
115
	Bitwise2_1 : int;
116
	Bitwise2_2 : int;
117
	Bitwise2_3 : int;
118
	Bitwise3_1 : int;
119
	__time_step : real;
120
	__nb_step : int;
121
let
122
	Bitwise_1 = _NAND_Bitwise_Signed_8(In1_1, In2_1);
123
	Bitwise1_1 = _NAND_Bitwise_Signed_8(In3_1, In4_1);
124
	Bitwise1_2 = _NAND_Bitwise_Signed_8(In3_1, In4_2);
125
	Bitwise1_3 = _NAND_Bitwise_Signed_8(In3_1, In4_3);
126
	Bitwise2_1 = _NAND_Bitwise_Signed_8(In5_1, 217);
127
	Bitwise2_2 = _NAND_Bitwise_Signed_8(In5_2, 217);
128
	Bitwise2_3 = _NAND_Bitwise_Signed_8(In5_3, 217);
129
	Bitwise3_1 = _NOT_Bitwise_Signed(_AND_Bitwise_Signed_8(In6_1, _AND_Bitwise_Signed_8(In6_2, In6_3)));
130
	Out1_1 = Bitwise_1;
131
	Out2_1 = Bitwise1_1;
132
	Out2_2 = Bitwise1_2;
133
	Out2_3 = Bitwise1_3;
134
	Out3_1 = Bitwise2_1;
135
	Out3_2 = Bitwise2_2;
136
	Out3_3 = Bitwise2_3;
137
	Out4_1 = Bitwise3_1;
138
	__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
139
	__nb_step = (0 -> ((pre __nb_step) + 1));
140
tel
141

    
(151-151/1153)