Controls.bsv
上传用户:aoptech
上传日期:2014-09-22
资源大小:784k
文件大小:3k
源码类别:

3G开发

开发平台:

Others

  1. //----------------------------------------------------------------------//
  2. // The MIT License 
  3. // 
  4. // Copyright (c) 2007 Alfred Man Cheuk Ng, mcn02@mit.edu 
  5. // 
  6. // Permission is hereby granted, free of charge, to any person 
  7. // obtaining a copy of this software and associated documentation 
  8. // files (the "Software"), to deal in the Software without 
  9. // restriction, including without limitation the rights to use,
  10. // copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the
  12. // Software is furnished to do so, subject to the following conditions:
  13. // 
  14. // The above copyright notice and this permission notice shall be
  15. // included in all copies or substantial portions of the Software.
  16. // 
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  19. // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  20. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  21. // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  22. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  23. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  24. // OTHER DEALINGS IN THE SOFTWARE.
  25. //----------------------------------------------------------------------//
  26. // Controls Definitions for Generic OFDM Designs
  27. typedef struct {
  28.     Bit#(n) bypass; // bypass mask, scrambling state still go on
  29.     Maybe#(Bit#(ssz)) seed; // set new seed if valid
  30. } ScramblerCtrl#(numeric type n, numeric type ssz) deriving(Eq, Bits);
  31. typedef struct {
  32.     Bit#(sz) in;    // input size (in bytes)
  33.     Bit#(sz) out;   // output size (in bytes)
  34. } ReedSolomonCtrl#(numeric type sz);
  35. // Modulation Schemes // used as control for mapper, demapper, interleaver and deinterleaver
  36. typedef enum{ 
  37.    BPSK = 1, 
  38.    QPSK = 2, 
  39.    QAM_16 = 4,
  40.    QAM_64 = 8 
  41. } Modulation deriving (Eq, Bits);
  42. // Descrambler Controls
  43. typedef enum{ Bypass, FixRst, DynRst, Norm } DescramblerCtrl deriving (Eq, Bits);
  44. // Puncturer Controls  
  45. typedef enum{
  46. //   Same        = 1, // control same as last data    
  47.    Half        = 1,     // set to rate 1/2
  48.    TwoThird    = 2,     // set to rate 2/3
  49.    ThreeFourth = 4,     // set to rate 3/4
  50.    FiveSixth   = 8      // set to rate 5/6
  51. } PuncturerCtrl deriving(Eq, Bits);
  52. typedef enum{
  53.    CP0 = 1,     // cp size = 1/4
  54.    CP1 = 2,     // cp size = 1/8
  55.    CP2 = 4,     // cp size = 1/16
  56.    CP3 = 8      // cp size = 1/32
  57. } CPSizeCtrl deriving(Eq, Bits);
  58. typedef enum{
  59.    SendNone = 1, // do not send preamble
  60.    SendBoth = 2, // send both short and long preamble
  61.    SendLong = 4  // send long preamble only
  62. } PreCtrl deriving(Eq, Bits);  
  63. typedef Tuple2#(PreCtrl, CPSizeCtrl) CPInsertCtrl; // first specify addPremable? 
  64. typedef enum{
  65.    PilotRst,  // reset pilot
  66.    PilotNorm  // normal operation
  67. } PilotInsertCtrl deriving (Bits, Eq); 
  68.      
  69. // not used
  70. typedef struct{
  71.    Bool        isNewPacket;
  72.    CPSizeCtrl  cpSize;
  73. } SyncCtrl deriving (Eq, Bits);