source: ResearchApps/PHY/WARPLAB/WARPLab7/Sysgen_Reference/w3/warplab_trigger_proc/trig_odelays_config.m

Last change on this file was 4830, checked in by welsh, 8 years ago

Version 1.07.g - Output delays are now 16 bit for all outputs. Moved trigger input enables to register in IOB.

File size: 4.2 KB
RevLine 
[4747]1
2function trig_odelays_config(this_block)
3
4  % Revision History:
5  %
6  %   22-Oct-2015  (17:35 hours):
7  %     Original code was machine generated by Xilinx's System Generator after parsing
8  %     C:\work\svn_work\WARP\ResearchApps\PHY\WARPLAB\WARPLab7\Sysgen_Reference\w3\warplab_trigger_proc\trig_odelays.v
9  %
10  %
11
12  this_block.setTopLevelLanguage('Verilog');
13
14  this_block.setEntityName('trig_odelays');
15
16  % System Generator has to assume that your entity  has a combinational feed through;
17  %   if it  doesn't, then comment out the following line:
18  this_block.tagAsCombinational;
19
[4830]20  this_block.addSimulinkInport('trigs_disable');
[4747]21  this_block.addSimulinkInport('trigs_in');
22  this_block.addSimulinkInport('trig0_dly');
23  this_block.addSimulinkInport('trig1_dly');
24  this_block.addSimulinkInport('trig2_dly');
25  this_block.addSimulinkInport('trig3_dly');
26  this_block.addSimulinkInport('update_delays');
27
28  this_block.addSimulinkOutport('trigs_out_pins');
29
30  trigs_out_pins_port = this_block.port('trigs_out_pins');
31  trigs_out_pins_port.setType('UFix_4_0');
32
33  % -----------------------------
34  if (this_block.inputTypesKnown)
35    % do input type checking, dynamic output type and generic setup in this code block.
36
[4830]37    if (this_block.port('trigs_disable').width ~= 1);
38      this_block.setError('Input data type for port "trigs_disable" must have width=1.');
39    end
40
[4747]41    if (this_block.port('trigs_in').width ~= 4);
42      this_block.setError('Input data type for port "trigs_in" must have width=4.');
43    end
44
45    if (this_block.port('trig0_dly').width ~= 5);
46      this_block.setError('Input data type for port "trig0_dly" must have width=5.');
47    end
48
49    if (this_block.port('trig1_dly').width ~= 5);
50      this_block.setError('Input data type for port "trig1_dly" must have width=5.');
51    end
52
53    if (this_block.port('trig2_dly').width ~= 5);
54      this_block.setError('Input data type for port "trig2_dly" must have width=5.');
55    end
56
57    if (this_block.port('trig3_dly').width ~= 5);
58      this_block.setError('Input data type for port "trig3_dly" must have width=5.');
59    end
60
61    if (this_block.port('update_delays').width ~= 1);
62      this_block.setError('Input data type for port "update_delays" must have width=1.');
63    end
64
[4830]65    this_block.port('trigs_disable').useHDLVector(false);
[4747]66    this_block.port('update_delays').useHDLVector(false);
67
68  end  % if(inputTypesKnown)
69  % -----------------------------
70
71  % -----------------------------
72   if (this_block.inputRatesKnown)
73     setup_as_single_rate(this_block,'clk','ce')
74   end  % if(inputRatesKnown)
75  % -----------------------------
76
77    % (!) Set the inout port rate to be the same as the first input
78    %     rate. Change the following code if this is untrue.
79    uniqueInputRates = unique(this_block.getInputRates);
80
81
82  % Add addtional source files as needed.
83  %  |-------------
84  %  | Add files in the order in which they should be compiled.
85  %  | If two files "a.vhd" and "b.vhd" contain the entities
86  %  | entity_a and entity_b, and entity_a contains a
87  %  | component of type entity_b, the correct sequence of
88  %  | addFile() calls would be:
89  %  |    this_block.addFile('b.vhd');
90  %  |    this_block.addFile('a.vhd');
91  %  |-------------
92
93  %    this_block.addFile('');
94  %    this_block.addFile('');
[4751]95  this_block.addFile('trig_odelay.v');
[4747]96  this_block.addFile('trig_odelays.v');
97
98return;
99
100
101% ------------------------------------------------------------
102
103function setup_as_single_rate(block,clkname,cename) 
104  inputRates = block.inputRates; 
105  uniqueInputRates = unique(inputRates); 
106  if (length(uniqueInputRates)==1 & uniqueInputRates(1)==Inf) 
107    block.addError('The inputs to this block cannot all be constant.'); 
108    return; 
109  end 
110  if (uniqueInputRates(end) == Inf) 
111     hasConstantInput = true; 
112     uniqueInputRates = uniqueInputRates(1:end-1); 
113  end 
114  if (length(uniqueInputRates) ~= 1) 
115    block.addError('The inputs to this block must run at a single rate.'); 
116    return; 
117  end 
118  theInputRate = uniqueInputRates(1); 
119  for i = 1:block.numSimulinkOutports
120     block.outport(i).setRate(theInputRate); 
121  end 
122  block.addClkCEPair(clkname,cename,theInputRate); 
123  return; 
124
125% ------------------------------------------------------------
126
Note: See TracBrowser for help on using the repository browser.