-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync_delay_prog_init_xblock.m
More file actions
93 lines (78 loc) · 4.54 KB
/
sync_delay_prog_init_xblock.m
File metadata and controls
93 lines (78 loc) · 4.54 KB
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu %
% Copyright (C) 2011 Hong Chen %
% %
% This program is free software; you can redistribute it and/or modify %
% it under the terms of the GNU General Public License as published by %
% the Free Software Foundation; either version 2 of the License, or %
% (at your option) any later version. %
% %
% This program is distributed in the hope that it will be useful, %
% but WITHOUT ANY WARRANTY; without even the implied warranty of %
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %
% GNU General Public License for more details. %
% %
% You should have received a copy of the GNU General Public License along %
% with this program; if not, write to the Free Software Foundation, Inc., %
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function sync_delay_prog_init_xblock(MaxDelay)
%% inports
xlsub2_sync = xInport('sync');
xlsub2_delay = xInport('delay');
%% outports
xlsub2_sync_out = xOutport('sync_out');
%% diagram
% block: delay_7/sync_delay_prog/Constant
xlsub2_Constant_out1 = xSignal;
xlsub2_Constant = xBlock(struct('source', 'Constant', 'name', 'Constant'), ...
struct('arith_type', 'Unsigned', ...
'n_bits', MaxDelay, ...
'bin_pt', 0, ...
'explicit_period', 'on'), ...
{}, ...
{xlsub2_Constant_out1});
% block: delay_7/sync_delay_prog/Constant1
xlsub2_Constant1_out1 = xSignal;
xlsub2_Constant1 = xBlock(struct('source', 'Constant', 'name', 'Constant1'), ...
struct('arith_type', 'Unsigned', ...
'const', 0, ...
'n_bits', MaxDelay, ...
'bin_pt', 0, ...
'explicit_period', 'on'), ...
{}, ...
{xlsub2_Constant1_out1});
% block: delay_7/sync_delay_prog/Counter
xlsub2_Logical_out1 = xSignal;
xlsub2_Counter_out1 = xSignal;
xlsub2_Counter = xBlock(struct('source', 'Counter', 'name', 'Counter'), ...
struct('operation', 'Down', ...
'n_bits', MaxDelay, ...
'load_pin', 'on', ...
'en', 'on', ...
'use_rpm', 'on'), ...
{xlsub2_sync, xlsub2_delay, xlsub2_Logical_out1}, ...
{xlsub2_Counter_out1});
% block: delay_7/sync_delay_prog/Logical
xlsub2_Relational1_out1 = xSignal;
xlsub2_Logical = xBlock(struct('source', 'Logical', 'name', 'Logical'), ...
struct('logical_function', 'OR', ...
'n_bits', 8, ...
'bin_pt', 2), ...
{xlsub2_sync, xlsub2_Relational1_out1}, ...
{xlsub2_Logical_out1});
% block: delay_7/sync_delay_prog/Relational
xlsub2_Relational = xBlock(struct('source', 'Relational', 'name', 'Relational'), ...
struct('latency', 0), ...
{xlsub2_Constant_out1, xlsub2_Counter_out1}, ...
{xlsub2_sync_out});
% block: delay_7/sync_delay_prog/Relational1
xlsub2_Relational1 = xBlock(struct('source', 'Relational', 'name', 'Relational1'), ...
struct('mode', 'a!=b', ...
'latency', 0), ...
{xlsub2_Counter_out1, xlsub2_Constant1_out1}, ...
{xlsub2_Relational1_out1});
end