home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / verilog / 483 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.0 KB  |  64 lines

  1. Newsgroups: comp.lang.verilog
  2. Path: sparky!uunet!uchdcc!uconce!renoir!llagos
  3. From: llagos@renoir.die.udec.cl (Leonardo LAGOS M)
  4. Subject: Re: execution of always blocks
  5. Sender: usenet@halcon.dpi.udec.cl
  6. Message-ID: <Dec19.124345.50968@halcon.dpi.udec.cl>
  7. Date: Sat, 19 Dec 92 12:43:45 GMT
  8. References: <ABAIR.92Dec18020726@parsons.sps.mot.com>
  9. Organization: Universidad de Concepcion, Concepcion - Chile
  10. X-Newsreader: TIN [version 1.1 PL7]
  11. Lines: 51
  12.  
  13. Alan Bair (abair@parsons.sps.mot.com) wrote:
  14. : In article <13665@optilink.COM> manley@optilink.COM (Terry Manley) writes:
  15. :>   More specifically why doesn't the following work:
  16. :>
  17. :>   reg a,b,c;
  18. :>
  19. :>   always @(posedge Clk) c = b;
  20. :>   always @(posedge Clk) b = a;
  21. :>
  22. :>    always @(posedge Clk)
  23. :>      fork
  24. :>        c = b;
  25. :>        b = a;
  26. :>      join
  27. :>
  28. : However, this has the same problem as the two always blocks, there is no
  29. : control over which will take place first. I can't remember the exact syntax,
  30. : but there is a way to specify that the values of b & a are first saved and
  31. : then the assignments take place. This allows them to occur in any order, but
  32. : get the results you are after.
  33.  What you want to do is something like this :
  34.     always @(posedge Clk) c <= #1 b;
  35.     always @(posedge Clk) b <= #1 a;
  36.  
  37.  This code means " evaluate b at posedge of Clk, save this value, and assign
  38.  it to c 1 time later."
  39.  This syntax is also called "non-blocking assignment" (or similar).
  40.  Idem for the second always.
  41.  
  42. :>   --
  43. :>   dave
  44. :>   manley@optilink.com
  45. :>
  46. : --
  47. : Alan Bair                     AMCU DSCS
  48. : Motorola, Inc.                    (Design Software &
  49. : Mail Stop OE-320             Computer Services)
  50. : 6501 William Cannon Dr. West    
  51. : Austin, TX  78735-8598          abair@parsons.sps.mot.com
  52.  
  53. Hope this can help you,
  54.  
  55. Leo
  56.  
  57. --
  58.             .                  e-mail : llagos@renoir.die.udec.cl
  59.          |\ | /                cc     : llagos@halcon.dpi.udec.cl
  60.      ----| >|<-----
  61.          |/ | \               Departamento de Ingenieria Electrica
  62.          '     `                   Universidad de Concepcion
  63.