Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INTRODUCTION
1.1 BACKGROUND
The family of IEEE wireless LAN standards were designed to
extend 802.3 (wired Ethernet). The first 802.11 specifications were introduction
in 1997. It supports 1 and 2Mbps transmission rate at 2.4GHz band with either
frequency hopping spread spectrum (FHSS) or Direct Sequence Spread Spectrum
(DSSS). 802.11a and 802.11b were released in 1999 September. 802.11a
supports 6 to 54 Mbps transmission rate with orthogonal frequency-division
multiplexing (OFDM) at 5 GHz and 802.11b supports 1 to 11Mbps with DSSS at
2.4GHz. The 802.11g was ratified in 2003 June. It operates at 2.4 GHz same as
802.11b but maximum transmission rate is 54 Mbps with OFDM as 802.11a.
1.2 MOTIVATION
and cost high. With Cell-based, it has advantage of design simple, high process
speed and easy to simulation, but design non-flexible and need long developing
time [1]. FPGA has both of advantages of CPU-based and Cell-based, such as
high process speed, design flexible and short developing timeetc. It is popular
implementation way currently. It is also suitable for MAC design and
verification. In this thesis, we proposed a new architecture implemented in FPGA
to perform MAC functions [2] [3] [4].
In the last of the thesis conclusion and future prospects and the list
of references are also included.
CHAPTER 2
IEEE 802.11 OVERVIEW
Figure 2.1: IEEE 802 family and its relation to the OSI model
3
The 802.11 standard focuses on the physical layer (PHY) and the
medium access control layer (MAC). Original design the system transmitted data
at 1 Mbps and 2Mbps over the ISM frequency band. The coming version is
expected to push data rate up to 5.5 Mbps and 11Mbps (802.11b). Until now, the
data rate is up to 54Mbps (802.11g). Compare list is shown in Table 2.1
communicate directly to an AP and all frames between stations are relayed by the
access point. Mobile devices can use network resources on wired network
transparently through AP. The AP may also provide connection to a distribution
system shown as Figure 2.3.
CHAPTER 3
802.11 MAC LAYER
The DCF is the basis of the standard Carrier Sense Multiple Access
with Collision Avoidance (CSMA/CA) access mechanism [8]. It works by a
listen before talk scheme. It means all stations first sense the medium to be idle
before transmitting. To support of contention based DCF make IEEE 802.11
equipment popular choices for different wireless ad hoc networtecks. In this
thesis, we only consider to implement DCF function on Ad Hoc network
topology.
10
11
12
The duration value is the value obtained from the Duration field of
the immediately previous RTS frame, minus the time (RTS - CTS time -one
SIFS) in microseconds, required transmitting the CTS frame and its SIFS interval
[7].
3.1.1.4.3 ACK (Acknowledgment)
14
15
16
18
19
20
From DS
To
Meaning
DS
0
field set to 1 in data type frame exiting the DS, set to 0 in all other frames. The
detail link is shown in Table 3.5.
22
station. The AP can set this field to one to indicate that there are more multicast
frames buffered in multicast frames by the AP.
The Duration/ID field is 16 bits in length. This field has three kind
of usage as follows:
periodically, to ensure that no frames are lost, waking stations incorporate the
association ID (AID). It is used by a station to retrieve frames that are buffered
for it at the AP. The AID is included in PS-Poll frame and may range from 12,007. Only PS-Poll frame contains the AID [5].The encoding of the Duration/ID
field is show in Table 3.6.
There are four address fields in the MAC frame format. The
address fields are numbered because different field are used for different
purposes depend on frame type. The usage of the four address field in frame type
is BSSID (Basic Service Set ID), DA (Destination Address), SA (Source
Address), RA (Receiver Address), and TA (Transmitter Address). In general
usage that Address 1 is used for the receiver, Address 2 for the transmitter, and
Address 3 for filter by receiver.
24
3.2.2.3.1 BSSID
25
The sequence control field is 16 bits in length that is used for both
de-fragmentation and discarding duplicate frames. It consist two subfields:
Sequence Number and Fragment Number, as shown in Figure 3.12.
26
The frame body field is a variable length field that is used in data
or management frames. 802.11 can transmit frames with a maximum payload of
2,304 bytes of higher level data. Actuality it has to support payload of 2,312
bytes with WEP. Because 802.2 LLC headers use 8 bytes, so it can transmit
frames with a maximum network protocol payload of 2,296 bytes.
The FCS field is 32 bits in length that is calculated over all the
fields of MAC header and frame body. The FCS is often referred to as CRC
(Cyclic Redundancy Check). It is an IEEE 802 LAN standards and generated in
the same way as IEEE 802.3
27
CHAPTER 4
DESIGN AND IMPLEMENTATION OF MAC
TRANSMITTER
S Y S T E M (L L C)
MAC Tx
Transmission Control Module
Timer Module
PHY
Figure 4.1 System architecture
28
29
Idle
Need to
count?
Back-off
Time
(Time mode
= 001)
SIFS
(Time mode
= 010)
DIFS
(Time mode =
011)
EIFS
(Time mode =
101)
PIFS
(Time mode =
100)
Count
Finish?
N
Count
Finish?
Y
Generate BackTimer_Count_End
Generate Backoff_Count_End
END
30
In this module, whether the frame, which was received from upper
layer, needed to be fragmented or not was determined by RTS threshold. In
802.11b specification, RTS threshold is set to 2,347 bytes. If network throughput
is slow or there are high numbers of frames retransmissions, enable RTS clearing
by decreasing the RTS threshold.
This module also controls frame retry time. Every station has two
retry limits: long retry limit and short retry limit. If frame is longer than RTS
threshold called long retry limit and retry time is set default value of four, and
shorter than RTS threshold called short retry limit and retry time is set default
value of 7. Once retry time over long/short retry limit setting, the frame will be
discarded and reported to higher-level protocols.
31
Idle
Reset=1
Y
System
Reset?
N
Transmit
ready?
Y
N
Medium Y
Busy?
CCA =1?
N
Fragment
number
>=1?
DCF
Process
DCF
Process
Transmit Frame
Complete
transmit?
N
Request retry
by Rx?
N
Reset Timer, Transmit and Build Frame
Module register etc
Idle
32
Retry limit
is reached
Retry time is
Reached to 7?
Y
Reset Timer,
Transmit and Build
Y
Frame Module
register.etc
N
Idle
Retry
Request?
Retry limit
is reached?
CCA=1?
N
Count Random off
time be interrupted
before?
Medium
Busy?
Y
Restore
Random Bachoff count value
DIFS
Counts
end?
N
Y
CCA=1?
Lock and save
Random back
off time value
Medium
Busy?
Busy
Frame?
Y
N
Idle
Sequence
number =0?
Y
Y
RTS/CTS
Process
33
Y
Idle
Transmit
Process
Multicast
N
N
Y
Tx has been
sent RTS and
successful?
Request
retry by Rx?
N
Sent RTS
Y
Y Receive
ACK and
correct?
Reqest retry
by Rx?
N
DCF
Process
N
N
Timer counts a SIFS
Reset Timer,
Transmit and Build
Frame Module
register .etc
N
Receive CTS
and correct?
Idle
34
All of transmit frames (RTS, CTS, Data and ACK frame) are
generated by Build Frame Module. It is depended on information that provided
from upper layer and be controlled by Transmission Control Module to build
frame and set some values like Retry, To DS/From DSetc. in frame control
field. In this module, it also calculates duration time and FCS value (CRC-32)
then build completely frame. Figure 4.7 shows Build Frame Module flowchart.
Reset = 1
transmit?
Frame Type=011
Y
Calculate RTS
Duration Time
Calculate CTS
Duration Time
Calculate Date
Duration Time
Calculate ACK
Duration Time
Build ACK
Frame
Calculate FCS
=
Out Frame to
Transmit Module
35
37
Figure 4.9 and Table 4.1 show CRC-32 circuit and parallel CRC-32 algorithm.
39
40
CHAPTER 5
INTRODUCTION TO FPGA DESIGN
42
interconnect resources can be seen. There are long lines which can be used to
connect critical CLBs that are physically far from each other on the chip
without inducing much delay. They can also be used as buses within the chip.
There are also short lines which are used to connect individual CLBs which
are located physically close to each other. There are often one or several
switch matrices, like that in a CPLD, to connect these long and short
lines together in specific ways. Programmable switches inside the chip
allow the connection of CLBs to interconnect lines and interconnect lines to
each other and to the switch matrix [25].
Large Granularity
Better utilization
Direct conversion to ASIC
that you will have the best chance of getting backs a working prototype that
functions correctly in your system. The design flow consists of the steps in
Figure 5.5.
Write a Specification
Specification Review
Design
Simulate
Design Review
Synthesize
Place and Route
Resimulate
Final Review
Chip Test
System Integration on Test
Chip Product
48
You must decide at this point which design entry method you
prefer. For smaller chips, schematic entry is often the method of choice,
especially if the design engineer is already familiar with the tools. For larger
designs, however, a hardware description language (HDL) such as Verilog or
VHDL is used because of its portability, flexibility, and readability. When
using a high level language, synthesis software will be required to
synthesize the design. This means that the software creates low level gates
from the high level description.
You must decide at this point which synthesis software you will
be using if you plan to d e s i gn t h e FPGA w i t h a n H D L . This is
i m p o r t a n t s i n c e e a c h synthesis t o o l has recommended or mandatory
methods of designing hardware so that it can correctly perform synthesis. It
will be necessary to know these methods up front so that sections of the chip
will not need to be redesigned later on. At the end of this phase it is very
important to have a design review. All appropriate personnel should review the
decisions to be certain that the specification is correct, and that the correct
technology and design entry method have been chosen.
Top-down design
Use logic that fits well with the architecture of the device you
have chosen
Macros
Synchronous design
Protect against metastability
Avoid floating nodes
Avoid bus contention
5.11.6 Synthesis
If the design was entered using an HDL, the next step is to
synthesize the chip. This involves using synthesis software to optimally
translate your register transfer level (RTL) design into a gate level design
that can be mapped to logic blocks in the FPGA. This may involve
specifying switches and optimization criteria in the HDL code, or playing
with parameters of the synthesis software in order to insure good timing and
utilization.
The next step is to lay out the chip, resulting in a real physical design
for a real chip. This involves using the vendors software tools to optimize
the programming of the chip to implement the design. Then the design is
programmed into the chip.
50
After layout, the chip must be re-simulated with the new timing
numbers produced by the actual layout. If everything has gone well up to this
point, the new simulation results will agree with the predicted results.
Otherwise, there are three possible paths to go in the design flow. If the
problems encountered here are significant, sections of the FPGA may need to
be redesigned. If there are simply some marginal timing paths or the design
is slightly larger than the FPGA, it may be necessary to perform another
synthesis with better constraints or simply another place and route with
better constraints. At this point, a final review is necessary to confirm that
nothing has been overlooked.
5.11.9 Testing
functions are defined first, and the lower level implementation details are
filled in later. A schematic can be viewed as a hierarchical tree as shown in
Figure 5.6. The top-level block represents the entire chip. Each lower level
block represents major functions of the chip. Intermediate level blocks may
contain smaller functionality blocks combined with gate-level logic. The
bottom level contains only gates and macro functions which are vendorsupplied high level functions. Fortunately, schematic capture software and
hardware description languages used for chip design easily allows use of the
top-down design methodology.
52
synchronous solution is shown in Figure 5.8. Here a faster clock is used, and
the flip-flop is reset on the rising edge of the clock. This circuit performs the
same function, but as long as SIG1 and SIG2 are produced synchronously they change only after the rising edge of CLK - there is no race condition.
54
55
5.16 GLITCHES
A glitch can occur due to small delays in a circuit such as that
shown in Figure 5.12. An inverting multiplexer contains a glitch when
56
switching between two signals, both of which are high. Yet due to the delay
in the inverter, the output goes high for a very short time.
5.18 METASTABILITY
One of the great buzzwords, and often misunderstood
concepts, of synchronous design is metastability. Metastability refers to
a condition which arises when an asynchronous signal is clocked into a
synchronous flip-flop. While chip designers would prefer a completely
synchronous world, the unfortunate fact is that signals coming into a chip will
depend on a user pushing a button or an interrupt from a processor, or will be
generated by a clock which is different from the one used by the chip. In these
cases, the asynchronous signal must be synchronized to the chip clock so that
it can be used by the internal circuitry.
signal goes high around the same time as the clock, we have an unavoidable
race condition [25]. The output of the flip-flop can actually go to an undefined
voltage level that is somewhere between a logic 0 and logic 1. This is
because an internal transistor did not have enough time to fully charge to the
correct level. This meta level may remain until the transistor voltage leaks
off or decays, or until the next clock cycle. During the clock cycle, the
gates that are connected to the output of the flip-flop may interpret this level
differently. In the figure, the upper gate sees the level as logic 1 whereas the
lower gate sees it as logic 0. In normal operation, OUT1 and OUT2 should
always be the same value. In this case, they are not and this could send the
logic into an unexpected state from which it may never return. This
metastability can permanently lock up your chip.
60
CHAPTER 6
VERIFICATION AND SIMULATION RESULTS
START
Define Specification
Compile ok
by ISE
Simulate ok
by Model Sim
Hardware
Environment
ok
Implementation
End
61
The Figure 5.3 shows Xilinx FPGA array of design. The Figure
5.4 and Figure 5.5 are shown the floor plane and information about
implementation. From information above, we can find total 6,976 equivalent gate
62
counts used, and the maximum combinational critical path delay of 9.43ns and
the maximum operating frequency of 112.41 MHzetc.
63
64
65
b.
In this simulation: Getting 5 sets pseudorandom and CW
values are 31, 182, 58, 203, and 89.
For first value, 31 x 20us = 620 us; clock is set in 100MHz (10ns
period). Timer should count 62000 then issue Back_off_Count_End if count
finish. Show simulation result in Figure 6.6.
66
67
a. Select Time Mode for SIFS and DIFS: In this design, if Time
mode is set to 000 for Back-off time, set to 001 for SIFS and set to 010 for
DIFS. In 802.11b specification, SIFS is 10 us and DIFS is 50 us.
68
69
70
71
CHAPTER 7
CONCLUSIONS
72
REFERENCES
[1] Bononi L., Conti M. and Gregori E., Design and performance evaluation of
an asymptotically optimal backoff algorithm for IEEE 802.11 Wireless LANs.
Department of Computer Science University of Bologna, Jan. 2000, pp. 1-10.
[2] Cimini J., Leung K., McNair B. and Winters J. ,Outdoor IEEE 802.11
cellular networks: MAC protocol design and performance. AT&T LabsResearch, May 2002, pp. 595-599.
[3] Cali F., Conti M. and Gregori E. ,IEEE 802.11 wireless LAN: capacity
analysis and protocol enhancement. Italian National Council of Research, Apr.
1998, pp. 142-149.
[4] IEEE standard for information technology- telecommunications and
information exchange between systems- local and metropolitan area networksspecific requirements Part II: wireless LAN medium access control (MAC) and
physical layer (PHY) specifications, 1999.
[5] Dirtterle D., Panic G., Stamenkovic Z. and Tittelbach-Helmrich K. A
system-on-chip implementation of IEEE 802.11a MAC layer. Im
Technologiepark 25, Sept. 2003, pp. 319-324.
[6] Hou J. and Hwangnam K. Improving protocol capacity for UDP/TCP traffic
with model-based frame scheduling in IEEE 802.11-operated WLANs. IEEE
journal on selected areas in communications, Dec. 2004. 72, pp. 1987-2003.
[7] Fob C., Lee B. and Tantra J. An efficient scheduling scheme for high speed
IEEE 802.11 WLANs. Centre of Multimedia and Network Technology School of
Computer Engineering Nanyang Technological University, Oct. 2003, pp. 25892593.
[8] Han R. and Sheth A. Adaptive power control and selective radio activation
for low-power infrastructure-mode 802.11 LANs. Department of Computer
Science, University of Colorado, May 2003, pp. 812-818.
73
74
[18] Acharya A., Bansal S. and Misra A. High-performance architectures for IPbased multi-hop 802.11 networks Stanford University, Oct. 2003, pp. 22-28.
[19] McFarland B., Meng T., Su D. and Thomson S. Design and
implementation of an all-CMOS 802.11a wireless LAN chipset. Stanford
University, 2003, pp. 160-168.
[20] Nishida Y. Enhancing 802.11 DCF MAC for TCP/IP Communication. Sony
Computer Science Laboratories, Inc., Mar. 2005, pp. 13-17.
[21] Bruno R., Conti M. and Gregori E. IEEE 802.11 optimal performances:
RTS/CTS mechanism vs. basic access. Italian National Council of Research,
Sept. 2002, pp. 1747-1751.
[22] Liu H. and Wu J. Packet Telephony support for the IEEE 802.11 Wireless
LAN. IEEE communications letters, Sept. 2000, pp. 286-268.
[23] Cho K., Haewon J., Lee, H. and Youjin K. MAC implementation for
IEEE 802.11 Wireless LAN. Router Technology Department, Electronics &
Telecommunications Research Institute, Apr. 2001, pp. 191-195.
75
PROGRAMMING CODE
1. Txtop.vhd
library ieee;
use ieee.std_logic_1164.all;
entity txtop is
port ( mpdu:out std_logic_vector(7 downto 0);
clk,rst,phy_idle,nav_str,probereply,
authreply,assoreply,rtsreply,datareply:in std_logic;
datain,add1:in std_logic_vector(7 downto 0);
data_msdu_in:in std_logic_vector(7 downto 0));
end ;
architecture txtop of txtop is
component assoreq_block
port(clk,rst,asso_req,header_end:in std_logic;
datain:in std_logic_vector(7 downto 0);
crc_stp_ass:out std_logic;
crcout:in std_logic_vector(31 downto 0);
assofrm:out std_logic_vector(7 downto 0);
asso_end:out std_logic);
end component;
component authreq_block
port(clk,rst,auth_req,header_end:in std_logic;
datain:in std_logic_vector(7 downto 0);
crc_stp_auth:out std_logic;
crcout:in std_logic_vector(31 downto 0);
authfrm:out std_logic_vector(7 downto 0);
auth_end:out std_logic);
end component;
component probreq_block
76
port(clk,rst,probe_req:in std_logic;
datain:in std_logic_vector(7 downto 0);
header_end: in std_logic;
crc_stp_prob:out std_logic;
crcout:in std_logic_vector(31 downto 0);
probfrm:out std_logic_vector(7 downto 0);
prob_end:out std_logic);
end component;
component rtsfrmo
port(clk,rst,rts_en:in std_logic;
datain:in std_logic_vector(7 downto 0);
crc_stp_rts:out std_logic;
crcout:in std_logic_vector(31 downto 0);
rtsfrm:out std_logic_vector(7 downto 0);
rts_end:out std_logic);
end component;
component backoff
port(clk_1M,rst,backoff_str,tx_fail,phy_idle:in std_logic;
backoff_end,backoff_hault:out std_logic);
end component;
component framecntrl
port
(rst,tx_fail:in std_logic;
contrl_frame:out std_logic_vector(15 downto 0);
typ:in std_logic_vector(1 downto 0);
subtyp:in std_logic_vector(3 downto 0));
end component;
component frame_enblock
port(rst,probreq,assoreq,authreq,rtsreq,datareq:in std_logic;
typ :out std_logic_vector(1 downto 0);
subtyp :out std_logic_vector(3 downto 0));
end component;
77
component control_state_tx
port(clk,rst,phy_idle,backoff_end,backoff_hault:in std_logic;
nav_str,difs_end,probereply,tx_fail,sifs_end:in std_logic;
authreply,assoreply:in std_logic;
rtsreply,datareply:in std_logic;
prob_end,auth_end,asso_end,rts_end,data_end,header_end:in
std_logic;
difs_str,backoff_str,sifs_str,header_en,mngmnt,data_req,probe_req,aut
h_req,data_en,auth_en,asso_req,asso_en,rts_req,rts_en,crc_en,mach,
probreq,assoreq,authreq,rtsreq,datareq:out std_logic);
end component;
component header2
port(add1:in std_logic_vector(7 downto 0);
clk,rst:in std_logic;
datain:in std_logic_vector(7 downto 0);
header_en:in std_logic;
mngmnt,mach: in std_logic;
header_end : out std_logic;
headerout:out std_logic_vector(7 downto 0);
contrl_frame:in std_logic_vector(15 downto 0));
end component;
component crc
port(clk,rst: in std_logic;
crc_en,crc_stp : in std_logic;
datain : in std_logic_vector(7 downto 0);
crcout: out std_logic_vector(31 downto 0));
--crcout1error: out std_logic;
end component;
component mpdufrm
port(header_end,header_en,probe_req,asso_req,auth_req,rts_en,data_
en:in std_logic;
mpdu:out std_logic_vector(7 downto 0);
78
probfrm,assofrm,authfrm,data_msdu,rtsfrm,headerout:in
std_logic_vector(7 downto 0));
end component;
component data_tx_block
port(data_en,clk,rst:in std_logic;
crc_stp_data,data_end:out std_logic;
data_msdu_in:in std_logic_vector(7 downto 0);
data_msdu:out std_logic_vector(7 downto 0));
end component;
component difs
port(clk_1M,rst,difs_str,sifs_str:in std_logic;
difs_end,sifs_end:out std_logic);
end component;
component clk1M_gen
port(clk,rst:in std_logic;
clk_1M:out std_logic);
end component;
component crc_en_stp_block
port(crc_stp_ass,crc_stp_auth,crc_stp_data,crc_stp_prob,
crc_stp_rts:in std_logic;
crc_stp:out std_logic);
end component;
signal typ:std_logic_vector( 1 downto 0);
signal subtyp:std_logic_vector(3 downto 0);
signal crcout:std_logic_vector(31 downto 0);
signal
asso_req,header_end,crc_stp,asso_end,auth_req,auth_end,crc_stp_ass,
crc_stp_auth,crc_stp_prob,crc_stp_rts,crc_stp_data,
prob_req,prob_end,rts_en,rts_end,clk_1M,backoff_str,tx_fail,backoff_e
nd,backoff_hault,
mngmnt,mach,crc_en,difs_end,sifs_end,data_req,probe_req,data_en,au
th_en,asso_en,rts_req,data_end,
difs_str,sifs_str,header_en,probreq,assoreq,authreq,rtsreq,datareq:std_l
ogic;
79
signal
assofrm,authfrm,probfrm,rtsfrm,headerout,data_msdu,din:std_logic_ve
ctor(7 downto 0);
signal contrl_frame :std_logic_vector(15 downto 0);
begin
association:assoreq_block port
map(clk,rst,asso_req,header_end,datain,crc_stp_ass,
crcout,assofrm,asso_end);
authentication:authreq_block port
map(clk,rst,auth_req,header_end,datain,crc_stp_auth,
crcout,authfrm,auth_end);
probeframe:probreq_block port
map(clk,rst,probe_req,datain,header_end,crc_stp_prob,crcout,probfrm,
prob_end);
rtsframe_block:rtsfrmo port
map(clk,rst,rts_en,datain,crc_stp_rts,crcout,rtsfrm,rts_end);
backoffunit :backoff port map
(clk_1M,rst,backoff_str,tx_fail,phy_idle,backoff_end,backoff_hault);
framecontrol :framecntrl port map(rst,tx_fail,contrl_frame,typ,subtyp);
frameenable :frame_enblock port
map(rst,probreq,assoreq,authreq,rtsreq,datareq,
typ,subtyp);
statemach :control_state_tx port map
(clk,rst,phy_idle,backoff_end,backoff_hault,
nav_str,difs_end,probereply,tx_fail,sifs_end,
authreply,assoreply,rtsreply,datareply,
prob_end,auth_end,asso_end,rts_end,data_end,header_end,
difs_str,backoff_str,sifs_str,header_en,mngmnt,data_req,probe_req,aut
h_req,data_en,auth_en,asso_req,asso_en,rts_req,rts_en,crc_en,mach,
80
probreq,assoreq,authreq,rtsreq,datareq);
2. Assoreg.vhd
library ieee;
use ieee.std_logic_1164.all;
entity assoreq_block is
port(clk,rst,asso_req,header_end:in std_logic;
datain:in std_logic_vector(7 downto 0);
crc_stp_ass:out std_logic;
crcout:in std_logic_vector(31 downto 0);
assofrm:out std_logic_vector(7 downto 0);
asso_end:out std_logic);
end;
architecture assoreq_block of assoreq_block is
type stateasso is (idleasso,sprt_rt,cap_inf,list_int,ssid,fcs);
81
signal st_asso:stateasso;
signal countr: integer;
signal crcsig :std_logic_vector(31 downto 0);
begin
process(clk,rst,datain,asso_req,header_end)
begin
if(rst='1') then
assofrm="00000000";
countr=0;st_asso=idleasso;
crc_stp_ass='Z';
elsif(clk'event and clk='1') then
if(asso_req='1' ) then
case st_asso is
when idleasso=>
-- if(asso_req='1' ) then
asso_end='0';
crc_stp_ass='Z';
st_asso=cap_inf;
countr=24;
--assofrm=datain;
--else
st_asso=cap_inf;
-- end if;
when cap_inf=>
if(countr=25) then
st_asso=list_int;
assofrm=datain;
countr=26;
else
assofrm=datain;
countr=countr+1;
end if;
when list_int=>
if(countr=27) then
st_asso= ssid;
assofrm=datain;
countr=28;
else
assofrm=datain;
countr=countr+1;
82
end if;
when ssid=>
if(countr=59) then
st_asso=sprt_rt ;
assofrm=datain;
countr=60;
else
assofrm=datain;
countr=countr+1;
end if;
when sprt_rt=>
if(countr=67) then
st_asso= fcs;
assofrm=datain;
crc_stp_ass='1';
countr=68;
crcsig=crcout;
else
assofrm=datain;
countr=countr+1;
end if;
when fcs=>
if(countr=71) then
asso_end='1';
st_asso=idleasso;
countr=0;
assofrm=crcsig(31 downto 24);
else
assofrm=crcsig(31 downto 24);
crcsig=crcsig(23 downto 0)&x"00";
countr=countr+1;
end if;
end case;
end if;
end if;
end process;
end assoreq_block;
3. Authreg_block.vhd
library ieee;
use ieee.std_logic_1164.all;
entity authreq_block is
83
port(clk,rst,auth_req,header_end:in std_logic;
datain:in std_logic_vector(7 downto 0);
crc_stp_auth:out std_logic;
crcout:in std_logic_vector(31 downto 0);
authfrm:out std_logic_vector(7 downto 0);
auth_end:out std_logic);
end;
architecture authreq_block of authreq_block is
type stateauth is (idleauth,algno,transeq_no,st_cde,chllg_txt,fcs);
signal st_auth:stateauth;
signal countr: integer;
signal crcsig:std_logic_vector(31 downto 0);
begin
process(clk,rst,datain,auth_req,header_end,countr,st_auth)
begin
if (rst='1') then
authfrm="00000000";
countr=0;
crc_stp_auth='Z';
elsif (clk'event and clk='1') then
if(auth_req='1' ) then
case st_auth is
when idleauth=>
auth_end='0';
st_auth=algno;
countr=24;
authfrm=datain;
crc_stp_auth='Z';
when algno=>
if (countr=25) then
st_auth=transeq_no;
authfrm=datain;
countr= 26;
else
authfrm=datain;
countr=countr+1;
end if;
when transeq_no=>
if(countr= 27) then
st_auth= st_cde;
authfrm=datain;
countr=28;
else
authfrm=datain;
84
countr=countr+1;
end if;
when st_cde=>
if(countr=29) then
authfrm=datain;
st_auth=chllg_txt;
countr=30;
else
authfrm=datain;
countr=countr+1;
end if;
when chllg_txt=>
if(countr=93) then
authfrm=datain;
st_auth= fcs;
crc_stp_auth='1';
countr=94;
crcsig=crcout;
else
authfrm=datain;
countr=countr+1;
end if;
when fcs=>
if(countr=97) then
auth_end='1';
st_auth=idleauth;
countr=0;
authfrm=crcsig(31 downto 24);
else
authfrm=crcsig(31 downto 24);
crcsig=crcsig(23 downto 0)&x"00";
countr=countr+1;
end if;
end case;
end if;
end if;
end process;
end authreq_block;
4. Backoff.vhd
library ieee;
use ieee.std_logic_1164.all;
entity backoff is
port(clk_1M,rst,backoff_str,tx_fail,phy_idle:in std_logic;
85
backoff_end,backoff_hault:out std_logic);
end;
architecture backoff of backoff is
signal random,cnt_back:integer;
signal slot_end:std_logic;
begin
process(clk_1M,rst,backoff_str,tx_fail,random)
begin
if(rst='1') then
backoff_end='0';
backoff_hault='0';
random=31;
elsif(clk_1M='1' and clk_1M'event) then
if(random=0) then
backoff_end='1';
elsif(tx_fail='1') then
random=(random *2);
elsif(phy_idle='0' and backoff_str='1') then
random=random ;
backoff_hault='1';
elsif(phy_idle='1' and backoff_str='1' and slot_end='1') then
random=(random-1);
end if;
end if;
end process;
process(clk_1M,rst,cnt_back,backoff_str)
begin
if(rst='1') then
cnt_back=0;
slot_end='0';
elsif(clk_1M='1' and clk_1M'event) then
if(backoff_str='1') then
if(cnt_back=19) then
cnt_back=0;
slot_end='1';
else
cnt_back=cnt_back+1;
slot_end='0';
end if;end if;end if;
end process;
end backoff;
86
List of publications
[2] Mittal N. and Agarwal N. VHDL Modeling of Wi-Fi MAC Layer for
Transmitter. AICTE Sponsored National Seminar on Recent Trends & Advances
in VLSI Design, Gwalior, December 5-7, 2011, pp-15.
87