Home > Community > Forums > Functional Verification > serial transmission of structures

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 serial transmission of structures 

Last post Fri, Jul 21 2006 6:46 AM by archive. 1 replies.
Started by archive 21 Jul 2006 06:46 AM. Topic has 1 replies and 1010 views
Page 1 of 1 (2 items)
Sort Posts:
  • Fri, Jul 21 2006 6:46 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    serial transmission of structures Reply

    hi there
    I am looking for a 'proper' way to serially send data on a line (my application is ISO7816 but it could be any serial p[rotocol modeling)
    Data are defined by

    typedef enum byte {direct = 8'h3b, inverse = 8'h3f} t_InitChar;
    typedef struct packed {
      bit td;
      bit tc;
      bit tb;
      bit ta;
      bit [3:0] nr_hist;
    } t_FormatChar;

    Which define the 7816 ATR patter

    typedef struct packed {
      t_InitChar ts;
      t_FormatChar t0;
    } t_atr;

    I  can to send this patter by a s2p converter using the following

    module p2s (in_array, out1, clk, reset, en);
    parameter LE = 8;
       input clk, reset, en;
       input [LE-1:0] in_array;
       output      out1; 
       reg [LE:0]   par;
       reg         out1; 
       always @(posedge clk) begin
          if (reset)
              par <= 'b0;
          else if (en)
              par <= in_array;
          else
              {out1,par} <= {par,1'b0};
       end // always @ (posedge clk)
    endmodule // p2s

    and compose a pre-filled array by the structure members: still, I feel this is not the proper 'SystemVerolog'  way

    Srry for this newbie question by a Verilog user which is moving into System verilog :-)

    thanks


    Originally posted in cdnusers.org by marco.stanzani
    • Post Points: 0
  • Fri, Jul 21 2006 11:18 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: serial transmission of structures Reply

    Hello Marco,

    Since you defined your t_FormatChar type as a packed structure, you can treat it as a vector or access the individual fields. So your p2s module should be fine.  If you don't need to synthesize the p2s module you can use a task to do the parallel to serial transmission.  I have attached an example to this response in case you are interested.

    I hope that helps!

    Kathleen


    Originally posted in cdnusers.org by kameade
    • Post Points: 0
Page 1 of 1 (2 items)
Sort Posts:
Started by archive at 21 Jul 2006 06:46 AM. Topic has 1 replies.