5.5.27 · D4 · HinglishEmbedded Systems & Real-Time Software

ExercisesSpaceWire — high-speed serial link standard for spacecraft

2,465 words11 min read↑ Read in English

5.5.27 · D4 · Coding › Embedded Systems & Real-Time Software › SpaceWire — high-speed serial link standard for spacecraft

Shuru karne se pehle, ek common picture: ek SpaceWire link mein do twisted pairs hoti hain, ek Data (D) carry karti hai aur ek Strobe (S). Yeh drawing poori page ke liye apne dimag mein rakho.

Figure — SpaceWire — high-speed serial link standard for spacecraft

Level 1 — Recognition

Exercise 1.1

SpaceWire ek data line aur ek clock line ki jagah cable mein do signals bhejta hai. Do signals ke naam batao, aur ek sentence mein batao kyun koi alag clock wire nahi hai.

Recall Solution

Do signals hain Data (D) aur Strobe (S). Koi alag clock wire nahi hai kyunki clock ko receiver pe recover kiya jaata hai: jahan ka matlab hai XOR ("output 1 tabhi jab dono inputs alag hon"). Encoding yeh guarantee karta hai ki har bit period mein dono lines mein se exactly ek toggle karti hai, toh unki combined transition activity hi ek clock ban jaati hai. Ek physical clock wire lambi cables pe data ke against drift karti — thermal, radiation damage ki wajah se — is drift ko skew kehte hain, aur DS encoding isse poori tarah bypass kar deta hai. LVDS Signaling dekho yeh samajhne ke liye ki D aur S mein se har ek khud ek differential pair hai.

Exercise 1.2

Har acronym ko uske kaam se match karo: EOP, EEP, FCT.

Recall Solution

Answer ::: EOP = End of Packet (normal, clean end). EEP = Error End of Packet (packet ek detected error ki wajah se beech mein cut off ho gaya). FCT = Flow Control Token (ek control character jo receiver wapas bhejta hai taaki sender ko 8 aur data characters ke buffer space ka credit mile).


Level 2 — Application

Exercise 2.1 (Parity)

Data byte 0x5C ke liye odd-parity bit calculate karo. Bit count dikhao.

Recall Solution

0x5C binary mein hai, yaani . Ones count karo: even number of ones. Equivalently saaton bits ka XOR hai. Odd parity ka matlab hai "ones ki total count odd banao." Hamare paas 4 ones hain (even), toh humein ek aur one add karna hoga: (Check: 4 data-ones + 1 parity-one = 5 ones total, jo odd hai. ✓) Cross-connect: yeh single parity bit ek cosmic ray se flip hue bit ka tripwire hai.

Exercise 2.2 (DS transitions)

Transmitter ko bit sequence bhejna hai, Data, Strobe se start karke. Har 4 bit periods ke liye batao kaunsi line toggle karti hai (D ya S).

Recall Solution

Rule: Data hamesha current bit ke barabar hoti hai. Strobe sirf tab toggle karta hai jab bit pichle bit ke barabar ho (taaki agar Data flat rahe, Strobe phir bhi ek edge de).

period bit same as prev? Data Strobe line that toggled
start 1 0
1 1 yes (prev 1) 1 1 S
2 1 yes 1 0 S
3 1 yes 1 1 S
4 0 no 0 1 D

Har period mein exactly ek line toggle karti hai, isliye RecoveredClock = D XOR S chaar baar tick karta hai. Figure s02 dekho: Data pe teen flat runs ko Strobe edges "rescue" karti hain, aur falling bit Data khud carry karti hai.

Figure — SpaceWire — high-speed serial link standard for spacecraft

Level 3 — Analysis

Exercise 3.1 (Wormhole vs store-and-forward)

Ek 512-byte packet 4 switches cross karta hai, line rate 100 Mbps pe. Per-switch header forwarding delay hai. (a) store-and-forward aur (b) wormhole ke liye total latency calculate karo. Speed-up batao.

Recall Solution

Pehle packet ka transmission time (sabhi bits ek baar wire pe daalne ka time):

(a) Store-and-forward: har switch ko aage bhejna shuru karne se pehle poora packet receive karna padta hai, toh har hop pe ek full cost hoti hai:

(b) Wormhole: header path carve karta hai (4 hops × 1 μs = 4 μs), aur phir body seedha stream through karti hai saare reserved switches mein — tum sirf ek baar pay karte ho kyunki tail already flow kar raha hota hai jab head doosri end tak pahunchta hai:

Speed-up . Core idea Wormhole Routing vs Store-and-Forward se: wormhole transmission ko saare hops pe overlap karta hai; store-and-forward isse serialize karta hai.

Exercise 3.2 (Credit / RTT sizing)

Ek link 200 Mbps pe 20 m cable par run karta hai, signal velocity m/s ke saath. Har data character 8 bits ka hai. (a) Round-trip time (RTT) nikalo. (b) Ek RTT mein kitne data characters "in flight" hain? (c) Pipe full rakhne ke liye kitne FCTs (har ek 8 characters grant karta hai) outstanding hone chahiye?

Recall Solution

(a) One-way delay s ns. RTT ns .

(b) Ek RTT mein bheje gaye bits bits. Characters mein: data characters in flight.

(c) Har FCT 8 characters grant karta hai, toh credits needed FCT. Ek outstanding FCT (8 characters ka granted credit) RTT ke 5 characters se pehle se zyada hai — toh yeh short, fast link aaram se cover ho jaati hai. Yahi deep reason hai parent note se: RTT — line rate nahi — decide karta hai ki kitna buffered credit chahiye. Lambi cables ⇒ bada RTT ⇒ zyada outstanding FCTs. Real-Time Determinism se connected: buffer bound pehle se analytically known hota hai.


Level 4 — Synthesis

Exercise 4.1 (End-to-end frame budget)

Ek imaging instrument har 2 ms mein ek 4096-byte frame produce karta hai (ek 500 fps sensor). Link hai 200 Mbps, 6 hops mein, , wormhole routing. (a) Ek frame ki delivery latency kya hai? (b) 2 ms frame period ka kitna fraction ek frame ki transmission occupy karti hai (yaani duty)? (c) Kya link pace rakh sakta hai?

Recall Solution

(a) Packet transmission time: Latency (wormhole) .

(b) Duty of the frame period spent transmitting.

(c) Haan: , aur poori delivery latency bhi ek 2 ms period ke andar fit ho jaati hai margin ke saath. Link bottleneck nahi hai; RMAP Protocol read/write overhead aur single-event upset ke baad retransmission ke liye headroom hai.

Exercise 4.2 (Effective payload throughput)

Har 8 data bits ko 1 parity bit se protect kiya jaata hai ( ratio), aur practice mein, control characters (FCTs, EOPs) roughly 5% aur overhead add karte hain. 400 Mbps raw line ke liye, useful payload throughput Mbps mein estimate karo.

Recall Solution

Step 1 — parity: parity ke baad usable fraction . Step 2 — control overhead: se multiply karo. Toh ek 400 Mbps SpaceWire link ≈ 338 Mbps actual instrument bytes deliver karta hai. Yeh gap on-wire error detection aur flow control ki price hai — radiation ke against sasti insurance, aur yehi wajah hai ki SpaceWire ek heavier legacy bus jaise MIL-STD-1553 se behtar hai.


Level 5 — Mastery

Tumhe ek radar processor ko ek downlink buffer se connect karna hai ek hard rule ke saath: har packet 250 μs ke andar deliver hona chahiye (hard real-time). Packets 8192 bytes ke hain, path 5 hops ka hai (), wormhole. (a) Deadline meet karne ke liye minimum line rate nikalo. (b) {2, 10, 100, 200, 400} Mbps mein se nearest standard rate pe round up karo aur achieved latency report karo.

Recall Solution

(a) Deadline budget header reservation aur body streaming mein split hoti hai: Toh body mein fit honi chahiye: Minimum line rate ≈ 267.5 Mbps.

(b) 267.5 Mbps se upar ka sabse chhota standard rate 400 Mbps hai. Achieved latency: Margin — ek EEP-triggered retransmission absorb karne ki jagah hai deadline threaten hone se pehle.

Exercise 5.2 (Why not just add a clock wire?)

Do ya teen sentences mein, DS invariant se argue karo ki ek shared clock wire lambe spacecraft harness pe kyun fail hoti hai, aur DS failure mode ko kaise disappear karta hai. Skew aur XOR words use karo.

Recall Solution

Answer ::: Ek shared clock wire aur data wire thode alag physical paths se travel karti hain; thermal expansion aur radiation damage unhe alag times pe pahunchata hai — yeh timing mismatch skew hai, aur jab skew half a bit period se zyada badh jaaye toh receiver galat bit sample karta hai. DS mein koi clock wire hoti hi nahi: kyunki {Data, Strobe} mein se exactly ek har bit mein toggle karta hai, receiver clock ko locally (XOR) ke roop mein rebuild karta hai. Kyunki D aur S dono same twisted-pair harness se chalta hain aur ek doosre ke against compare hote hain na ki ek door clock ke against, koi alag reference nahi hai jiske against skew ho sake — failure mode ko design out kar diya gaya hai.