Altera Stratix GX Transceiver User Manual

Page 194

Advertising
background image

6–40

Altera Corporation

Stratix GX Transceiver User Guide

January 2005

Design Example

if(kcntr==4'd11 || reset==1'b1)

kcntr<=4'b0;

else

kcntr<=kcntr+1;

//data counter
always@(posedge clk or posedge reset)

if(reset==1'b1)

datacntr<=1'b0;

else

datacntr<=datacntr+1;

//control character decode
always@(kcntr)
case (kcntr)

0:

kdata=8'h1c; //k28.0

1:

kdata=8'h3c; //k28.1

2:

kdata=8'h5c; //k28.2

3:

kdata=8'h7c; //k28.3

4:

kdata=8'h9c; //k28.4

5:

kdata=8'hbc; //k28.5

6:

kdata=8'hdc; //k28.6

7:

kdata=8'hfc; //k28.7

8:

kdata=8'hf7; //k23.7

9:

kdata=8'hfb; //k27.7

10: kdata=8'hfd; //k29.7
11: kdata=8'hfe; //k30.7

//

12: kdata=8'hff; //invalid code
default:kdata=8'hbc;

endcase
always@(globalcntr or curst)
case(globalcntr)

0:

nextst=`reset;//resets receiver

1:

nextst=`sync; //sends out 3 idle ordered sets

8:

nextst=`count; //sending counter values

40:

nextst=`txk; //sending control characters

52:

nextst=`count; //sending counter values

60:

nextst=`tx_err; //sending 4 illegal codes

64:

nextst=`donothing; //do nothing until resync

default:

nextst= curst;

endcase
always @(posedge clk)

curst<=nextst;

always@(posedge clk)
case(curst)

`reset: //resets receiver

Advertising