Transcript 系統晶片設計
Advisor:Chau-Lieh Chen
Student:張君睿
林聖凱
Packet進入時間
Packet離開時間
packet
IFS
IFS
Transmission time
Time
yes
start
Packet delay
是否大於
delay_bound
no
沒有packet時先傳此
qsta的packet
mac_delay=0
flow_txop = 0取得新
的flow作傳輸
Txop剩餘時
間是否小於
傳輸時間
no
計算剩餘的
TXOP
利用動態調
整依照
packet傳輸
時間下去調
整txop
Return 排程
資料和排程
傳送
yes
返回NO_PKT和
移動到下一個
TXOP
deque:
// get the head of line packet. If the queue is empty
// return NO_PKT and move to the next TXOP.
queue[schedTx_.tid_][schedTx_.dst_]->top (p, h);
if(!p) {
//沒有packet
//先傳此qsta的packet mac_delay=0
//flow_txop = 0
//在取得新的flow作傳輸
//=============================================
total_delay=0;
if (schedTx_.dst_ == 6) {
flow_txop=111;
now_qsta=6;
}
if (schedTx_.dst_ == 7) {
flow_txop=174;
now_qsta=7;
}
if (schedTx_.dst_ == 8) {
flow_txop=209;
now_qsta=8;
}
// 判斷Packet delay是否大於delay_bound
if(time + transmit_time - HDR_CMN(p)->timestamp() > desc->db + 0.0001 &&
mac_->drop (p, "DBN");
queue[schedTx_.tid_][schedTx_.dst_]->pop();
goto deque;
}
//Txop剩餘時間是否小於傳輸時間
if(time_left + phymib_.getPIFS() < transmit_time) {
//此為txop剩下的時間不夠傳輸一筆packet
//所以取得新的flow作傳輸。
schedTx_.subtype_ = NO_PKT;
first_deque = 1;
map_builder_->next_txop(next_qsta);
continue;
}
discard) {
transmit_time = mac_->txtime(HDR_CMN(p)->size()
+ phymib_.getHdrLen11e(),mac_->getDataRate())
+ phymib_.getSIFS()
+ mac_->txtime(phymib_.getHdrLen11e(), mac_>getDataRate())
+ phymib_.getSIFS();
total_delay =int((Scheduler::instance().clock()-HDR_CMN(p)>timestamp()+transmit_time)/20e-6);
//計算packet的delay為packet離開的時間(Scheduler::instance().clock())減掉packet進入的時間(HDR_CMN(p)->timestamp())加上
packet傳輸的時間
(transmit_time)最後除以slot time
total_delay =int((Scheduler::instance().clock()-HDR_CMN(p)->timestamp()+transmit_time)/20e-6);
//將此flow的總txop時間傳給matlab
//flow_txop=uplink txop + dnlink txop
//以下的數值在檔案mac-hccasched_map_ref.cc內副程式createMap()計算單位為slot time
if (schedTx_.dst_ == 6) {
if (total_delay > transmit_time){
flow_txop = (double)((total_delay/transmit_time)/1000);
now_qsta=6;
}
else {
flow_txop = (double)(transmit_time);
now_qsta=6;
}
}
if (schedTx_.dst_ == 7) {
if (total_delay > transmit_time){
flow_txop = (double)((total_delay/transmit_time)/1000);
now_qsta=7;
}
else {
flow_txop = (double)(transmit_time);
now_qsta=7;
}
}
if (schedTx_.dst_ == 8) {
if (total_delay > transmit_time){
flow_txop = (double)((total_delay/transmit_time)/1000);
now_qsta=8;
}
else {
flow_txop = (double)(transmit_time);
now_qsta=8;
}
}