Non deterministic FPGA - MCU interface (data bus)?

Hello,
   Working on a learner project. ..  Using a Digilent Spartan 3A dev board where I have implimented counters for rotary encoder signals.  The counters seem correct as they are accurate for measuring displacement (distance/rotations).  The counters are presente to my MCU (LPC1769 Cortex M3) via GPIO...  16bit "data bus and 4bit "address bus".
   On a 1Khz interrupt, the MCU will write the address lines, delay 1us, and read the 16 bits data (GPIO) connected to the FPGA.  For testing, a function gereator is providing a consistent  signals to the FPGA with no physical encoders ,so I know the what the counter data shoud be.  However, the counter data being read from the FPGA has too much inconsistency and smells like a classic determinism problem.  
   I'm thinking the problem is in my verilog implimentation of the bus, shown here:
module FPGA_Interface(
input [3:0] Signals,
input CLK_50M,
input [3:0] Addr,
output Valid,
output wire [15:0] Data
//Use of 'Valid' for handshaking is TBD
assign Valid = 1'b0;
wire [15:0] CountData0;
wire [15:0] CountData1;
//create two counters for the rotary encoders
QuadratureCounter counter0(.EncSig(Signals[1:0]),.CLK_50M(CLK_50M),.CountData(CountData0) );
QuadratureCounter
counter1(.EncSig(Signals[3:2]),.CLK_50M(CLK_50M),.CountData(CountData1) );
assign Data = (Addr == 4'b0000)? ~CountData0:
(Addr == 4'b0001)? ~CountData1:
(Addr == 4'b0010)? ~16'b0000000000000010:
(Addr == 4'b0011)? ~16'b0000000000000011:
16'b0000000000000111;
endmodule
      Perhaps I should "latch" the data  to eliminate the potential of the data changing at read time? Any feedback on the design of the "data bus" would be grealy appreciated. Thanks,

aszeghy wrote:
Thank you bassman59 for the explanation.  Understood, now at least, this is a design problem. Although, I originally wanted to gate or "latch" the counter data so that it can be reliably ready by the MCU.  I thought I was getting that by latching the count data when the address lines changed state...  Apparently not.  This further confuses me.
Looking at this academic mux example I see:
always @ (posedge clk )
if (reset == 0) begin
y <= 0;
end else if (sel == 0) begin
y <= a;
end else begin
y <= b;
end
Now in this synthesised mux module y is updated on the positive edge of clk. Is y updated on a change to a or b?   If y is not updated then the sensitivity list has not been ignored.
Is this because my code's sensitivity list suggested a change of state (combinational) and the text book example suggests a rising edge (sequential)?
Thanks again for the education,
Andrei
In the code above you used the template for a register (flip-flop). 
To answer your question, y is updated only on the event in the sensitivity list. Now, that statement is true for all always blocks. It was true for your initial address-decoder example, too, because as you discovered in simulation, the Data output did not change when the counter value changed, it changed only when there was an event on Addr (when the address changed).
Now, please note my use of the word "template" above. At its core, synthesis is all about template matching, meaning that the synthesizer looks for specific patterns in your code when deciding what sort of logic to infer. And for the case where you would like to infer registers, the template demands that you put only the clock edge detector on the sensitivity list. Why? Because in a real flip-flop, what happens on the D input isn't interesting until a clock edge occurs.
And that is what happens here. In simuation, everything on the right-hand-side of the assignments are ignored until there is an event which matches what is on the sensitivity list. In this case, the event of interest is the rising edge of the clock. At that moment, all right-hand-sides (which include the conditionals like if, case, etc) are evaluated and then the y output is assigned.
In the real flipflop inferred by the synthesizer, that too is what happens. This is why for a synchronous block where you are inferring a register there is no simulation/synthesis mismatch when only the clock is on the sensitivity list.

Similar Messages

  • Using a 2-D array Single Process Shared Variable w/ RT FIFO for comm between a Deterministic and non-deterministic loop on an RT Target

    Our problem is that we currently use a 2D array to store CAN data on a Real-time Target. The array is 20 elements of 3 byte elements as so:
                    0              1              2
    0              [byte]   [byte]   [byte]
    19           [byte]   [byte]   [byte]
    These values are passed between a Deterministic Timed (DT) loop where they are set and a Non-Deterministic Timed (NDT) loop where they are read and passed into a Network Published Shared Variable (NPSV) for communication across the network to a Host PC. I have insrted an image for illustration, pardon the size.
    Currently to pass the data between the DT and NDT loop we are using a Global Variable (GV). To improve the system we have attempted to replace these GVs with Single Process Shared Variables (SPSV) with an RT FIFO enabled.
    To create the shared variable I simply right clicked the GV of interest and selected create Shared Variable Node form the drop downs. At this point LabVIEW presented me with a 2D NPSV within a new Library hosted on the RT Target. I then selected this new NPSV from the Project, changed it to a SPSV, and enabled a single element FIFO. This variable was initialized with a default value for the size described above and then used in our code for the DT to NDT communication, and conversion to a corresponding NPSV for sending to the Host.
    When I went to run the code I noticed that the variable was in fact 2D, however its size was only 2 elements of three bytes each, in other words only two of the row indices were populated and the other appeared as uninitialized. in addition, this data had no resemblance to the set initilazation value. This was also how the variable was presented on the host side of the network after tranfer into a NPSV.
    The peculiar part is that If I change this SPSV to a NPSV and then try to change it back, I receive an error saying the type is not supported for SPSV with an RT FIFO enabled. I have to disable the FIFO (which defeats the entire purpose) in order to successfully compile! I am unclear as to what is the bug in this case. Should I not be allowed to create the original 2D SPSV with a single element RT FIFO enabled without receiving an error? Or if this is okay how do I fix the problems associated with the variable after being allowed to create it?
    I have found the following discussion in which a user states “The only limitations for custom controls is the ability to use it with RT FIFO enabled on a network-published shared variable”. Is this also true for SPSV? I have not found any documentation explicitely stating this for SPSV, though it is stated for the NPSVs.

    Martin,
    RT FIFOs don't support Multi-Dimensional Arrays, which would corroborate the issues you're seeing.  You can break up the 2D array into 1D arrays by reshaping the array, then you'll be able to use the RT FIFO enabled variable, just set the array size to the total number of elements (20*3 = 60).
    You can also pass the 2D array via pre-allocated queue, or using a Functional Global.  We have a reference example for a circular buffer using Functional Globals here.

  • Is an FPGA Host Interface a blocking shared resource?

    I'm curious to know if the FPGA Host Interface node is a shared resource. Meaning, if I have a Timed Loop on a LabVIEW Real-Time target (e.g. cRIO) that is reading and writing from the FPGA using the Host Interface. Will the determinism of that loop be adversley affected if I access other signls on the FPGA using the Host Interface in a separate loop (either a Timed loop or a normal while loop).
    Said more tersely, is the FPGA Host Interface a shared resource that can cause a priority inversion if called from two seperate loops?
    Thanks.
    Solved!
    Go to Solution.

    Hi Southern_Cross
    According to our documentation, you should be able to have more than one reference to the FPGA open at the same time ( as long as all the references access the same VI in the FPGA), and use them all in different places in your code from the same target. Since you can only have 1 main VI in the FPGA, accessing the reference of the FPGA behaves more like an I/O than like a non reentrant VI. 
    Using Multiple FPGA VI References for the Same Target (FPGA Interface)   
    As long as you are not writing the same variables in both loops (which could cause a race condition) you should be fine.
    WenR

  • HKONG: Material Transaction Interface 의 data를 처리 Process들에 대한 정의

    PURPOSE
    Material Transaction Interface 의 data를 처리 Process들에 대해 정의하고자 함.
    Explanation
    관련된 정보는 다음과 같습니다.
    Material Transaction Interface 의 data를 처리하기 위해서는 다음의 2개의 Process가 수행됩니다.
    - INCTCM (Process transaction Interface)
    - INCTCW (Inventory transactions worker)
    (1)
    Records are processed into this table by the INCTCM - Process Transactions Interface from the Interface tables :
         MTL_TRANSACTIONS_INTERFACE     to MTL_MATERIAL_TRANSACTIONS_TEMP
         MTL_TRANSACTION_LOTS_INTERFACE     to MTL_TRANSACTION_LOTS_TEMP (Lot 사용시)
         MTL_SERIAL_NUMBERS_INTERFACE     to MTL_SERIAL_NUMBERS_TEMP (serial 사용시)
    ==> INCTCM 에 의해 interface table의 data가 validation후, temp table로 옮겨집니다.
    (2)
    After the records are processed from the MTL_TRANSACTIONS_INTERFACE into the MTL_MATERIAL_TRANSACTIONS_TEMP
    by the INCTCM - Process Transactions Interface,
    a worker will be launched to process the record from MTL_MATERIAL_TRANSACTIONS_TEMP into MTL_MATERIAL_TRANSACTIONS.
    The worker is called INCTCW - Inventory Transaction Worker.
    The INCTCM - Process Transactions Interface will launch a single INCTCW - Inventory Transaction Worker for all rows
    that meet the criteria in MTL_MATERIAL_TRANSACTIONS_TEMP :
         TRANSACTION_MODE     = 3
         LOCK_FLAG          = N
         PROCESS_FLAG          = Y
    Once the process is complete the records will be moved into the corresponding
    transaction table :
         MTL_MATERIAL_TRANSACTIONS_TEMP     to MTL_MATERIAL_TRANSACTIONS
         MTL_TRANSACTION_LOTS_TEMP     to MTL_TRANSACTION_LOT_NUMBERS
         MTL_SERIAL_NUMBERS_TEMP          to MTL_UNIT_TRANSACTIONS
    ==> INCTCM은 INCTCW를 call하게 되고, 이 Process에 의해 TEMP table로부터 MMT table과 Inventory table에
    DATA가 Insert됩니다.
    The rows in mtl_transactions_interface are processed in 5 phases.
    1. Derives dependant columns, eg:acct_period_id, primary_quantity etc..
    2. Detailed validation performed on the records
    3. On hand qty check for negative qty's etc..
    4. Reservations Relieved if demand was created in order entry
    5. Rows are moved to mtl_material_transactions_temp where the
    transaction processor is called to process these rows and update the inventory levels etc..
    Reference Documents
    -------------------

  • Error in using BAPI_CONFEC_CREATE : Interface data contains Errors

    Hi,
    I am using this BAPI BAPI_CONFEC_CREATE to create confirmations locally in SRM for a PO. I am following Documentation available for this BAPI.  But when I excuted with below data getting error " INTERFACE DATA CONTAINS ERRORS"
    I am passing these data:
    Hedaer: Ref_doc_no - PO Number
                  Description:
                 Process Type: "CONF"
    Header_cust:  parent_guid : PO GUID
    Item: Parent: PO Header GUID
            PO Number: PO number
            PO GUID: PO HEDAER GUD
            PO ITEM Number: PO item Number
           PO_ITEM_GUID: po item guid
    Account:
                   Parent_GUID : PO Item GUID
                   G/L acct : Po G/l acct
                   cost center : PO cost center
    what are the data sholud be passed to this BAPI?
    Am I missing any input data to this BAPI? Please let me know.
    Am I using correct Function Module to create a confirmation for a PO in Stand alone scenario?
    Thanks.
    Shears
    Edited by: Shears80 on Sep 10, 2010 1:39 AM

    Hi Matt
    I'm using the same FM but it's not working. Can you please share what data you are passing in the FM.
    After debugging I found that my confirmation is getting created but it's not getting saved.
    Please enlighten me.
    Thanks
    Ankit

  • Read EDI-856 interface data in ABAP program

    HI Experts,
    I have a requirement to read the incomming EDI-856 interface data from ABAP program and generate an IDOC.  I have gone through few EDI-856 documents and theformat in which to read the data .
    Request you to let me know the code logic , function module to use or if  you have any document which can help me in the development.
    Thanks in advance
    Regards
    Santosh

    Please help regarding
    First could you please help me regarding the SCN search option?
    please always try to attempt from your side if not able to solve than search in SDN finally you may land on SDN with thread.

  • BBPCF02 - BBP_PD002 Interface data contains errors

    Hi all,
    I need your help.
    We have a problem when the user confirm a purchase order from transaction BBPCF02.
    During the creation of confirmation the system returns the pop-up with message "Interface data contains errors".
    I have SRM 5.0 classic scenario.
    Thanks in advance.
    Davide

    refer to note 805965. Although this note is not exactly for the problem you are stating but it should be close enough to solve your problem.

  • Interface data contains errors

    Dear all,
    We are on SRM 7.0. When trying to create a purchase order from an accepted bid the following error appears:
    "interface data contains error", no more details shown.
    It happens with both buttons: "Create Purchase Order" and "Simulate and create purchase order".
    Any ideas to solve it?
    Thanks
    Ezequiel

    Hi Eze
    purely no range issue
    create purchase order from bid invitation
    Standard process for PO creation from Bid Invitation or Bid
    double confirmed. revisit your Bid invitation , bid and Po number ranges.
    br
    muthu

  • Interface data contains error

    Hi Expert,
    We're facing error 'interface data contains error' when generate Purchase Order for bid submitted by bidder.
    anyone has experience with this error?
    Thanks,
    Yusup

    Hi
    Please refer this note 1042490 - Interface Data contains Errors in the sourcing cockpit.
    This note might be useful for you.
    Muthu

  • How to Create Rule in Interface Data Transformer.

    Hi,
    If any one know how to Create Rule in Interface Data Transformer(IDT) Super user by using Lookup(Oracle R12 Version) Please help me on this.
    I have one value in GL Interface table, while loding data into base tables (GL_JE_BATCHES, GL_JE_HEADERS, GL_JE_LINES) that values replace with another value.
    For that purpose we have to use Interface Data Transformer.
    If any one how to create rule in IDT, Please give me a example how to create rule by using Lookup.
    Thanks in Advance.
    Regards
    Varma.

    Hi;
    Please check below note which could be helpful for your issue:
    Setup Checklist for the Interface Data Transformer - Global Consolidations System [ID 277875.1]
    Regard
    Helios

  • External transfer of PR ( PDP Scenario ) : Interface data contains errors

    Dear All,
    We are in SRM Server 5.5, Extended Classic.
    Scenario >> Plan driven procurement
    We have  a purchase requisition generated via Plant Maintenence order. The PR is created for services and also has limits maintained ( overall and expected value ).
    The PR is not getting transfered to the SRM.   However in SRM SLG1 we see error log :
    Interface data contains errors
    Message no. BBP_PD002
    Please advice if you have faced similar issue.
    Regards,
    Anil Rajpal

    Hello,
    You can debug the PR transfer to find out why this error is coming.
    1. Go to table EPRTRANS -> take the PREQ number.                                       
    2. Go to SE38 -> BBP_EXTREQ_TRANSFER -> F8 -> provide PREQ -> /h -> F8.                
    3. Go inside FM BBP_EXTREQ_TRANSFER ->                                                
    4. Go inside perform transfer_package ->                                              
    5. Go inside Perfrorm Send_pr_to_procsystem ->                                        
    6. Clear lv_qrfc = '' -> goto inside FM BBP_BC_EXTREQ_INB ->  Here SRM will be called (maintain the RFC connection with dialog user. Then it will be able to debug onto SRM side).
    Once logged onto SRM, put a breakpoint at FM BBP_PD_MSG_ADD. Here error will be triggered. If you go back some steps via call stack, you can see why this error appears.
    Regards,
    Ricardo

  • EPMA 11.1.2.3 Interface Data Source

    While configuring EPMA, I did not have the option to "Configure Interface Data Source" in my new 11.1.2.3 installation.
    I installed "PFMA Java Web Application" and PFMA Data Synchronizer Java Web Application" on my Foundation Server. And I installed "PFMA Dimension Server Service" on my Server 02.
    Did I miss anything. Or things have changed for 11.1.2.3?
    Any help is appreciated.

    In 11.1.2.3 the data source configuration should be available in Workspace, have a read of Configuring Interface Data Sources
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Interface data contains errors while submitting the Bid by vendor

    Hi
    This is with regard to strategic sourcing. Purchaser carried out a sourcing with start date 05.03.2010 and end date as 10.03.2010. Now the vendor is trying to create his bid by selecting "Process Bid" option. Vendor is getting Bid invitation no, to create a Bid. Here while submitting he is getting the error as " End date has been reached. The submission deadline has passed", eventhough the end date is 10.03.2010. And getting a message "Interface data contains errors". So he is not able to submit the bid. For all the bid invitation vendor is getting this problem.
    How to resolve this?
    Thanks

    Hi Muthu
    Thanks for ur response. It was a no range problem which I found & rectified.
    Regds

  • JSON.parse: unexpected non-whitespace character after JSON data

    I am having problem using cold fusion and jquery.ajax it will throw error
    JSON.parse: unexpected non-whitespace character after JSON data
    this is the response in firebug {"EMPCODE":"E-00001"}
    child.cfm
      <cfif IsDefined("empmycode")>
             <cfset  myarray= getempCode(#mycode#)>
             <cfoutput>#myarray#</cfoutput>
      </cfif>
    <cffunction name="getempCode">
           <cfargument name="empcode">
             <cfquery  name="empQuery" datasource="#datasource#">
                   Select empcode from employee where empcode = '#empcode#'
             </cfquery>
                <cfset mystruct = StructNew()>  
                <cfset mystruct.empcode=#empQuery.empcode#>
            <cfreturn   SerializeJSON(mystruct)>
      </cffunction>
    parent.cfm
    $.ajax({
        type: 'post',
            data: {empmycode:empcode}, 
        url: 'child.cfm',
        success:function(data){
        var myobjc = jQuery.parseJSON(data);
        console.log(myobj.empcode);
    Thank you in advance

    jemz wrote:
      <cfif IsDefined("empmycode")>
             <cfset  myarray= getempCode(#mycode#)>
             <cfoutput>#myarray#</cfoutput>
      </cfif>
      <cffunction name="getempCode">
           <cfargument name="empcode">
             <cfquery  name="empQuery" datasource="#datasource#">
                   Select empcode from employee where empcode = '#empcode#'
             </cfquery>
                <cfset mystruct = StructNew()>  
                <cfset mystruct.empcode=#empQuery.empcode#>
            <cfreturn   SerializeJSON(mystruct)>
      </cffunction>
    The above code is confusing. You test for the existence of empmycode, yet you actually use mycode instead. In addition, what you call an array isn't, and you fail to 'var' the method's local variables.
    You could modify the code, by scoping, as well as bearing in mind what Carl has said:
    <cfif IsDefined("form.empmycode")>
        <cfset  code= getempCode(form.empmycode)>
        <cfoutput>#code#</cfoutput>
    </cfif>
    <cffunction name="getempCode">
    <cfargument name="empcode">
    <cfset var mystruct = StructNew()>
    <!--- Alternative:  <cfqueryparam cfsqltype="cf_sql_varchar" value="'#arguments.empcode#"> --->
             <cfquery  name="empQuery" datasource="#datasource#">
                   Select empcode from employee where empcode = <cfqueryparam cfsqltype="cf_sql_integer" value="'#arguments.empcode#">
             </cfquery>
    <cfset mystruct.empcode=empQuery.empcode>
    <cfreturn   SerializeJSON(mystruct)>
    </cffunction>

  • Sending any non-POST-type request with data to CFC

    In CF 11 (Developer Edition), non-POST-type requests with data to CFC files seem to get stuck in ColdFusion. I don't believe I've changed anything in CF administration that could affect this, and as far as I can tell I haven't done anything to IIS that would break it either. The issue occurs with both of the CF applications that I'm working on.
    Requests to CFMs that contain data work using any of the CRUD methods (GET, POST, PUT, DELETE), and the IIS handlers are setup to accept all methods for both CFMs and CFCs.
    Can anyone else verify whether this issue with requests to CFCs exists in their environment?
    Example curl requests:
    # Requests to CFC with data
    curl -d 'test=123' -X 'GET' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT)
    curl -d 'test=123' -X 'PUT' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT)
    curl -d 'test=123' -X 'DELETE' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT)
    curl -d 'test=123' -X 'POST' 'http://localhost/myapplication/component.cfc?method=test' # Works fine
    # Requests to CFM with data
    curl -d 'test=123' -X 'GET' 'http://localhost/myapplication/component.cfm' # Works fine
    curl -d 'test=123' -X 'PUT' 'http://localhost/myapplication/component.cfm' # Works fine
    curl -d 'test=123' -X 'DELETE' 'http://localhost/myapplication/component.cfm' # Works fine
    curl -d 'test=123' -X 'POST' 'http://localhost/myapplication/component.cfm' # Works fine
    # Requests without data
    curl -X 'GET' 'http://localhost/myapplication/component.cfc?method=test' # Works fine
    curl -X 'PUT' 'http://localhost/myapplication/component.cfc?method=test' # Works fine
    curl -X 'DELETE' 'http://localhost/myapplication/component.cfc?method=test' # Works fine
    curl -X 'POST' 'http://localhost/myapplication/component.cfc?method=test' # Works fine

    mike124897 wrote:
    In CF 11 (Developer Edition), non-POST-type requests with data to CFC files seem to get stuck in ColdFusion. I don't believe I've changed anything in CF administration that could affect this, and as far as I can tell I haven't done anything to IIS that would break it either. The issue occurs with both of the CF applications that I'm working on.
    Requests to CFMs that contain data work using any of the CRUD methods (GET, POST, PUT, DELETE), and the IIS handlers are setup to accept all methods for both CFMs and CFCs.
    Can anyone else verify whether this issue with requests to CFCs exists in their environment?
    Example curl requests:
    # Requests to CFC with data 
    curl -d 'test=123' -X 'GET' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT) 
    curl -d 'test=123' -X 'PUT' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT) 
    curl -d 'test=123' -X 'DELETE' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT) 
    curl -d 'test=123' -X 'POST' 'http://localhost/myapplication/component.cfc?method=test' # Works fine 
    You complicate things with too many flags. You could just do something like
    Get
    curl "http://localhost/myapplication/component.cfc?method=test&myArg=123"
    Post
    curl --data "myData=someData" "http://localhost/myapplication/component.cfc?method=test&myArg=123"

Maybe you are looking for