| Line 19... | Line 19... | 
      
        |   Usage:
 |   Usage:
 | 
      
        |     PERIPHERAL AXI4_Lite_Master                                 \\
 |     PERIPHERAL AXI4_Lite_Master                                 \\
 | 
      
        |                                 basePortName=<name>             \\
 |                                 basePortName=<name>             \\
 | 
      
        |                                 address=<O_address>             \\
 |                                 address=<O_address>             \\
 | 
      
        |                                 data=<O_data>                   \\
 |                                 data=<O_data>                   \\
 | 
      
        |                                 write_enable=<O_write_enable>   \\
 |   | 
      
        |                                 command_read=<O_command_read>   \\
 |                                 command_read=<O_command_read>   \\
 | 
      
        |                                 command_write=<O_command_write> \\
 |                                 command_write=<O_command_write> \\
 | 
      
        |                                 busy=<I_busy>                   \\
 |                                 busy=<I_busy>                   \\
 | 
      
        |                                 error=<I_error>                 \\
 |                                 error=<I_error>                 \\
 | 
      
        |                                 read=<I_read>                   \\
 |                                 read=<I_read>                   \\
 | 
      
        |                                 address_width=<N>               \\
 |                                 address_width=<N>               \\
 | 
      
        |                                 synchronous={True|False}
 |                                 synchronous={True|False}                \\
 | 
      
        |   |                                 write_enable=<O_write_enable>|noWSTRB\n
 | 
      
        |   Where:
 |   Where:
 | 
      
        |     basePortName=<name>
 |     basePortName=<name>
 | 
      
        |       specifies the name used to construct the multiple AXI4-Lite signals
 |       specifies the name used to construct the multiple AXI4-Lite signals
 | 
      
        |     address=<O_address>
 |     address=<O_address>
 | 
      
        |       specifies the symbol used to set the address used for read and write
 |       specifies the symbol used to set the address used for read and write
 | 
      
        | Line 45... | Line 45... | 
      
        |     data=<O_data>
 |     data=<O_data>
 | 
      
        |       specifies the symbol used to set the 32-bit data for write operations
 |       specifies the symbol used to set the 32-bit data for write operations
 | 
      
        |       Note:  Four outputs to this address are required, starting with the MSB of
 |       Note:  Four outputs to this address are required, starting with the MSB of
 | 
      
        |              the 32-bit value,  See the examples for illustrations of how this
 |              the 32-bit value,  See the examples for illustrations of how this
 | 
      
        |              works.
 |              works.
 | 
      
        |     write_enable=<O_write_enable>
 |   | 
      
        |       specifies the symbol used to set the 4 write enable bits
 |   | 
      
        |     command_read=<O_command_read>
 |     command_read=<O_command_read>
 | 
      
        |       specifies the symbol used to start the AXI4-Lite master core to issue a
 |       specifies the symbol used to start the AXI4-Lite master core to issue a
 | 
      
        |       read and store the received data
 |       read and store the received data
 | 
      
        |     command_write=<O_command_write>
 |     command_write=<O_command_write>
 | 
      
        |       specifies the symbol used to start the AXI4-Lite master core to issue a
 |       specifies the symbol used to start the AXI4-Lite master core to issue a
 | 
      
        | Line 70... | Line 68... | 
      
        |     address_width=<N>
 |     address_width=<N>
 | 
      
        |       specifies the width of the 8-bit aligned address\n
 |       specifies the width of the 8-bit aligned address\n
 | 
      
        |     synchronous={True|False}
 |     synchronous={True|False}
 | 
      
        |       indicates whether or not he micro controller clock and the AXI4-Lite bus
 |       indicates whether or not he micro controller clock and the AXI4-Lite bus
 | 
      
        |       are synchronous
 |       are synchronous
 | 
      
        |   |     write_enable=<O_write_enable>
 | 
      
        |   |       optionally specify the symbol used to set the 4 write enable bits
 | 
      
        |   |       Note:  This must be used if one or more of the slaves includes the
 | 
      
        |   |       optional WSTRB      signals.
 | 
      
        |   |     noWSTRB
 | 
      
        |   |       indicates that the optional WSTRB signal should not be included
 | 
      
        |   |       Note:  This must be specified if write_enable is not specified.\n
 | 
      
        |   |   Vivado Users:
 | 
      
        |   |     The peripheral creates a TCL script to facilitate turning the micro
 | 
      
        |   |     controller into an IP core.  Look for a file with the name
 | 
      
        |   |     "vivado_<basePortName>.tcl".\n
 | 
      
        |   Example:  Xilinx' AXI_DMA core has a 7-bit address range for its register
 |   Example:  Xilinx' AXI_DMA core has a 7-bit address range for its register
 | 
      
        |     address map.  The PERIPHERAL configuration statement to interface to this
 |     address map.  The PERIPHERAL configuration statement to interface to this
 | 
      
        |     core would be:\n
 |     core would be:\n
 | 
      
        |       PERIPHERAL AXI4_Lite_Master                                       \
 |       PERIPHERAL AXI4_Lite_Master                                       \
 | 
      
        |                         basePortName=myAxiDmaDevice                     \
 |                         basePortName=myAxiDmaDevice                     \
 | 
      
        |                         address=O_myAxiDmaDevice_address                \
 |                         address=O_myAxiDmaDevice_address                \
 | 
      
        |                         data=O_myAxiDmaDevice_data                      \
 |                         data=O_myAxiDmaDevice_data                      \
 | 
      
        |                         write_enable=O_myAxiDmaDevice_wen               \
 |   | 
      
        |                         command_read=O_myAxiDmaDevice_cmd_read          \
 |                         command_read=O_myAxiDmaDevice_cmd_read          \
 | 
      
        |                         command_write=O_myAxiDmaDevice_cmd_write        \
 |                         command_write=O_myAxiDmaDevice_cmd_write        \
 | 
      
        |                         busy=I_myAxiDmaDevice_busy                      \
 |                         busy=I_myAxiDmaDevice_busy                      \
 | 
      
        |                         error=I_myAxiDmaDevice_error                    \
 |                         error=I_myAxiDmaDevice_error                    \
 | 
      
        |                         read=I_myAxiDmaDevice_read                      \
 |                         read=I_myAxiDmaDevice_read                      \
 | 
      
        |                         address_width=7                                 \
 |                         address_width=7                                 \
 | 
      
        |                         synchronous=True\n
 |                         synchronous=True                                \\
 | 
      
        |   |                         write_enable=O_myAxiDmaDevice_wen\n
 | 
      
        |     To write to the memory master to slave start address, use the
 |     To write to the memory master to slave start address, use the
 | 
      
        |     following, where "start_address" is a 4-byte variable set elsewhere in the
 |     following, where "start_address" is a 4-byte variable set elsewhere in the
 | 
      
        |     program:\n
 |     program:\n
 | 
      
        |       ; Set the 7-bit register address.
 |       ; Set the 7-bit register address.
 | 
      
        |       0x18 .outport(O_myAxiDmaDevice_address)
 |       0x18 .outport(O_myAxiDmaDevice_address)
 | 
      
        | Line 164... | Line 173... | 
      
        |       ('command_write', r'O_\w+$',              None,           ),
 |       ('command_write', r'O_\w+$',              None,           ),
 | 
      
        |       ('data',          r'O_\w+$',              None,           ),
 |       ('data',          r'O_\w+$',              None,           ),
 | 
      
        |       ('read',          r'I_\w+$',              None,           ),
 |       ('read',          r'I_\w+$',              None,           ),
 | 
      
        |       ('busy',          r'I_\w+$',              None,           ),
 |       ('busy',          r'I_\w+$',              None,           ),
 | 
      
        |       ('error',         r'I_\w+$',              None,           ),
 |       ('error',         r'I_\w+$',              None,           ),
 | 
      
        |   |       ('noWSTRB',       None,                   None,           ),
 | 
      
        |       ('synchronous',   r'(True|False)$',       bool,           ),
 |       ('synchronous',   r'(True|False)$',       bool,           ),
 | 
      
        |       ('write_enable',  r'O_\w+$',              None,           ),
 |       ('write_enable',  r'O_\w+$',              None,           ),
 | 
      
        |     );
 |     );
 | 
      
        |     names = [a[0] for a in allowables];
 |     names = [a[0] for a in allowables];
 | 
      
        |     for param_tuple in param_list:
 |     for param_tuple in param_list:
 | 
      
        |       param = param_tuple[0];
 |       param = param_tuple[0];
 | 
      
        |       if param not in names:
 |       if param not in names:
 | 
      
        |         raise SSBCCException('Unrecognized parameter "%s" at %s' % (param,loc,));
 |         raise SSBCCException('Unrecognized parameter "%s" at %s' % (param,loc,));
 | 
      
        |       param_test = allowables[names.index(param)];
 |       param_test = allowables[names.index(param)];
 | 
      
        |       self.AddAttr(config,param,param_tuple[1],param_test[1],loc,param_test[2]);
 |       self.AddAttr(config,param,param_tuple[1],param_test[1],loc,param_test[2]);
 | 
      
        |     # Ensure the required parameters are provided (all parameters are required).
 |     # Ensure the required parameters are provided.
 | 
      
        |     for paramname in names:
 |     for paramname in (
 | 
      
        |   |       'address',
 | 
      
        |   |       'address_width',
 | 
      
        |   |       'basePortName',
 | 
      
        |   |       'command_read',
 | 
      
        |   |       'command_write',
 | 
      
        |   |       'data',
 | 
      
        |   |       'read',
 | 
      
        |   |       'busy',
 | 
      
        |   |       'error',
 | 
      
        |   |       'synchronous',
 | 
      
        |   |     ):
 | 
      
        |       if not hasattr(self,paramname):
 |       if not hasattr(self,paramname):
 | 
      
        |         raise SSBCCException('Required parameter "%s" is missing at %s' % (paramname,loc,));
 |         raise SSBCCException('Required parameter "%s" is missing at %s' % (paramname,loc,));
 | 
      
        |     # There are no optional parameters.
 |     # Ensure one and only one of the complementary optional values are set.
 | 
      
        |   |     if not hasattr(self,'write_enable') and not hasattr(self,'noWSTRB'):
 | 
      
        |   |       raise SSBCCException('One of "write_enable" or "noWSTRB" must be set at %s' % loc);
 | 
      
        |   |     if hasattr(self,'write_enable') and hasattr(self,'noWSTRB'):
 | 
      
        |   |       raise SSBCCException('Only one of "write_enable" or "noWSTRB" can be set at %s' % loc);
 | 
      
        |   |     self.noWSTRB = hasattr(self,'noWSTRB');
 | 
      
        |     # Temporary:  Warning message
 |     # Temporary:  Warning message
 | 
      
        |     if not self.synchronous:
 |     if not self.synchronous:
 | 
      
        |       raise SSBCCException('synchronous=False has not been validated yet');
 |       raise SSBCCException('synchronous=False has not been validated yet');
 | 
      
        |     # Add the I/O port, internal signals, and the INPORT and OUTPORT symbols for this peripheral.
 |     # Add the I/O port, internal signals, and the INPORT and OUTPORT symbols for this peripheral.
 | 
      
        |     for signal in (
 |     for signal in (
 | 
      
        | Line 192... | Line 218... | 
      
        |       ( 'i_%s_awready',         1,                      'input',        ),
 |       ( 'i_%s_awready',         1,                      'input',        ),
 | 
      
        |       ( 'o_%s_awaddr',          self.address_width,     'output',       ),
 |       ( 'o_%s_awaddr',          self.address_width,     'output',       ),
 | 
      
        |       ( 'o_%s_wvalid',          1,                      'output',       ),
 |       ( 'o_%s_wvalid',          1,                      'output',       ),
 | 
      
        |       ( 'i_%s_wready',          1,                      'input',        ),
 |       ( 'i_%s_wready',          1,                      'input',        ),
 | 
      
        |       ( 'o_%s_wdata',           32,                     'output',       ),
 |       ( 'o_%s_wdata',           32,                     'output',       ),
 | 
      
        |       ( 'o_%s_wstrb',           4,                      'output',       ),
 |       ( 'o_%s_wstrb',           4,                      'output',       ) if not self.noWSTRB else None,
 | 
      
        |       ( 'i_%s_bresp',           2,                      'input',        ),
 |       ( 'i_%s_bresp',           2,                      'input',        ),
 | 
      
        |       ( 'i_%s_bvalid',          1,                      'input',        ),
 |       ( 'i_%s_bvalid',          1,                      'input',        ),
 | 
      
        |       ( 'o_%s_bready',          1,                      'output',       ),
 |       ( 'o_%s_bready',          1,                      'output',       ),
 | 
      
        |       ( 'o_%s_arvalid',         1,                      'output',       ),
 |       ( 'o_%s_arvalid',         1,                      'output',       ),
 | 
      
        |       ( 'i_%s_arready',         1,                      'input',        ),
 |       ( 'i_%s_arready',         1,                      'input',        ),
 | 
      
        | Line 204... | Line 230... | 
      
        |       ( 'i_%s_rvalid',          1,                      'input',        ),
 |       ( 'i_%s_rvalid',          1,                      'input',        ),
 | 
      
        |       ( 'o_%s_rready',          1,                      'output',       ),
 |       ( 'o_%s_rready',          1,                      'output',       ),
 | 
      
        |       ( 'i_%s_rdata',           32,                     'input',        ),
 |       ( 'i_%s_rdata',           32,                     'input',        ),
 | 
      
        |       ( 'i_%s_rresp',           2,                      'input',        ),
 |       ( 'i_%s_rresp',           2,                      'input',        ),
 | 
      
        |     ):
 |     ):
 | 
      
        |   |       if not signal:
 | 
      
        |   |         continue
 | 
      
        |       thisName = signal[0] % self.basePortName;
 |       thisName = signal[0] % self.basePortName;
 | 
      
        |       config.AddIO(thisName,signal[1],signal[2],loc);
 |       config.AddIO(thisName,signal[1],signal[2],loc);
 | 
      
        |     config.AddSignal('s__%s__address' % self.basePortName, self.address_width, loc);
 |     config.AddSignal('s__%s__address' % self.basePortName, self.address_width, loc);
 | 
      
        |     config.AddSignal('s__%s__rd' % self.basePortName, 1, loc);
 |     config.AddSignal('s__%s__rd' % self.basePortName, 1, loc);
 | 
      
        |     config.AddSignal('s__%s__wr' % self.basePortName, 1, loc);
 |     config.AddSignal('s__%s__wr' % self.basePortName, 1, loc);
 | 
      
        | Line 220... | Line 248... | 
      
        |                       ),loc);
 |                       ),loc);
 | 
      
        |     self.ix_data = config.NOutports();
 |     self.ix_data = config.NOutports();
 | 
      
        |     config.AddOutport((self.data,False,
 |     config.AddOutport((self.data,False,
 | 
      
        |                       # empty list -- disable normal output port signal generation
 |                       # empty list -- disable normal output port signal generation
 | 
      
        |                       ),loc);
 |                       ),loc);
 | 
      
        |   |     if not self.noWSTRB:
 | 
      
        |     config.AddOutport((self.write_enable,False,
 |     config.AddOutport((self.write_enable,False,
 | 
      
        |                       ('o_%s_wstrb' % self.basePortName, 4, 'data', ),
 |                       ('o_%s_wstrb' % self.basePortName, 4, 'data', ),
 | 
      
        |                       ),loc);
 |                       ),loc);
 | 
      
        |     config.AddOutport((self.command_read,True,
 |     config.AddOutport((self.command_read,True,
 | 
      
        |                       ('s__%s__rd' % self.basePortName, 1, 'strobe', ),
 |                       ('s__%s__rd' % self.basePortName, 1, 'strobe', ),
 | 
      
        | Line 265... | Line 294... | 
      
        |     ):
 |     ):
 | 
      
        |       body = re.sub(subpair[0],subpair[1],body);
 |       body = re.sub(subpair[0],subpair[1],body);
 | 
      
        |     body = self.GenVerilogFinal(config,body);
 |     body = self.GenVerilogFinal(config,body);
 | 
      
        |     fp.write(body);
 |     fp.write(body);
 | 
      
        |  
 |  
 | 
      
        |  No newline at end of file
 |  No newline at end of file
 | 
      
        |   |     # Write the TCL script to facilitate creating Vivado IP for the port.
 | 
      
        |   |     vivadoFile = os.path.join(os.path.dirname(self.peripheralFile),'vivado_AXI4_Lite_Bus.py');
 | 
      
        |   |     execfile(vivadoFile,globals());
 | 
      
        |   |     WriteTclScript('master',self.basePortName,self.address_width,noWSTRB=self.noWSTRB);
 | 
      
        |   |  
 | 
      
        |  No newline at end of file
 |  No newline at end of file
 |