Changes between Version 9 and Version 10 of WARPnet1/BuildClientScripts


Ignore:
Timestamp:
Jun 18, 2010, 3:27:38 PM (14 years ago)
Author:
sgupta
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WARPnet1/BuildClientScripts

    v9 v10  
    55== Building the Client Script ==
    66
     7=== Synchronizing Structs ===
     8
    79There are two files that the user control over as the build their custom scripts to control the boards. The first is `warpnet_client_experiment_structs.py`. This file defines the data structures that are sent back and forth between the FPGA design and the client script. The FPGA design and this file must be in sync for data to be accurately transferred between the two. Let us look at an example to understand how this file is built. The following is the ControlStruct that is used to set basic node parameters. First we see the C struct that is stored in the FPGA.
     10
    811{{{
    912#!c
     
    7073}}}
    7174
    72 The `prepToSend` function creates the raw data that is seen by `warpnet.c`in the FPGA. It creates a byte packed data of 6 bytes (6B), 1 short (H) and 3 ints (3I). This is exactly what the node is expecting. A appropriate response from the node is a `warpnetACK` which `updateFromNode` parses in the python file.
     75The `prepToSend` function creates the raw data that is seen by `warpnet.c` in the FPGA. It creates a byte packed data of 6 bytes (6B), 1 short (H) and 3 ints (3I). This is exactly what the node is expecting. A appropriate response from the node is a `warpnetACK` which `updateFromNode` parses in the python file.
     76
     77For a struct that is requesting data the raw data sent would be a `warpnetRequest` struct and expect a response of the appropriate type.
     78
     79=== Logging Data ===
     80
     81As statistics are received by the client, there is good chance that the data would want to be written to a file. There is a built in method to do this. In the top-level script create a `DataLogger` object like the following.
     82{{{
     83 dataLog = DataLogger('filename.txt', fileRefreshTime)
     84}}}
     85
     86When instantiating a struct pass the `dataLog` object to the it as follows:
     87{{{
     88 statStruct = StatisticsStruct(dataLog)
     89}}}
     90
     91In the StatisticsStruct any received data in `updateFromNode` can be written to the this log file using
     92{{{
     93 self.logData('Data0=%d, Data1=%d" %(dataTuple[0], dataTuple[1]))
     94}}}
    7395
    7496== Running the Client Script ==