基于网络编码的多信源组播通信系统,包括源代码,原理图等(四)
it has been decoded,decode the next packet
state_next = GET_SRC_GEN_NUM;
else begin
cmp_data = {src_num_sel,gen_num_sel,12'hfff};
cmp_data_mask_0 = {12'h0,CMP_DATA_MASK};
cmp_data_mask_1 = {12'h0,CMP_DATA_MASK};
cmp_data_mask_2 = {12'h0,CMP_DATA_MASK};
state_next = GET_CMP_RESLT_FIRST;
end
end
GET_CMP_RESLT_FIRST: begin
cam_lookup_reslt_next = {match_2,match_1,match_0};
cmp_data = {12'hfff,src_num_sel,gen_num_sel};
cmp_data_mask_0 = {CMP_DATA_MASK,12'h0};
cmp_data_mask_1 = {CMP_DATA_MASK,12'h0};
cmp_data_mask_2 = {CMP_DATA_MASK,12'h0};
state_next = GET_CMP_RESLT_SEC;
match_addr_temp_2_next = match_addr_2;
match_addr_temp_1_next = match_addr_1;
match_addr_temp_0_next = match_addr_0;
end /* get the address from the cams, if there are two adresses from
* the cams, then outputs the one to the DRAM control and save
*
* the other for later use. If there is no valid address, we could not
* decode, then get out and decode the next one */
GET_CMP_RESLT_SEC: begin
state_next = RD_DRAM_MAIN_STEP;
cam_lookup_reslt_next = cam_lookup_reslt | {match_2,match_1,match_0};
cam_lookup_reslt_pre_next = cam_lookup_reslt | {match_2,match_1,match_0};
cam_lookup_reslt_save_next = cam_lookup_reslt | {match_2,match_1,match_0};
if(match_2) begin
match_addr_temp_2_next = match_addr_2;
end
if(match_1) begin
match_addr_temp_1_next = match_addr_1;
end
if(match_0) begin
match_addr_temp_0_next = match_addr_0;
end
end
/* reads the DRAM accroding to the CAM's address, then updates the look
* up result */
RD_DRAM_MAIN_STEP:
if(rd_idle) begin
if(|cam_lookup_reslt) begin
if(cam_lookup_reslt==3'b101) begin
other_dram_addr_next = match_addr_temp_2;
other_port_num_rd_next = 2'b10;
has_factor2_next = 1;
addr_vld = 1;
block_num_rd = match_addr_temp_0;
port_num_rd = 0;
cam_lookup_reslt_next = 3'b100;
end
else if (cam_lookup_reslt == 3'b011) begin
other_dram_addr_next = match_addr_temp_1;
other_port_num_rd_next = 2'b01;
has_factor2_next = 1;
addr_vld = 1;
block_num_rd = match_addr_temp_0;
port_num_rd = 0;
cam_lookup_reslt_next = 3'b010;
end
else if (cam_lookup_reslt==3'b110) begin
other_dram_addr_next = match_addr_temp_2;
other_port_num_rd_next = 2'b10;
has_factor2_next = 1;
addr_vld = 1;
block_num_rd = match_addr_temp_1;
port_num_rd = 2'b01;
cam_lookup_reslt_next=3'b100;
end
else if (cam_lookup_reslt==3'b001) begin
has_factor2_next = 0;
addr_vld = 1;
block_num_rd = match_addr_0;
port_num_rd = 2'b00;
cam_lookup_reslt_next = 0;
end
else if (cam_lookup_reslt==3'b010) begin
has_factor2_next = 0;
addr_vld = 1;
block_num_rd = match_addr_1;
port_num_rd = 2'b01;
cam_lookup_reslt_next = 0;
end
else if (cam_lookup_reslt==3'b100) begin
has_factor2_next = 0;
addr_vld = 1;
block_num_rd = match_addr_2;
port_num_rd = 2'b10;
cam_lookup_reslt_next = 0;
end
state_next=LUP_DCOD_FACTOR1_FIRST;
pkt_vld = 1;
pkt_dcoding = {src_num_sel,gen_num_sel};
end // end-- if(|cam_lookup_reslt)
else
state_next = GET_SRC_GEN_NUM; //could not find the pkt in cams.
end //end--if(rd_idle)
/* waiting for decoding completion, if needs the decoding factor pkt,
* then look up the factor in the remain cams */
LUP_DCOD_FACTOR1_FIRST: begin
if(decod_com) begin
state_next=GET_SRC_GEN_NUM;
end
if(need_pkt_vld) begin // need other packet to decode current packet
if((cam_lookup_reslt^~cam_lookup_reslt_pre)==3'b110) begin
cmp_data = {pkt_need_src_gen,12'hfff};
cmp_data_mask_2 = {12'h0,CMP_DATA_MASK};
cmp_data_mask_1 = {12'h0,CMP_DATA_MASK};
end
else if((cam_lookup_reslt^~cam_lookup_reslt_pre)==3'b101) begin
cmp_data = {pkt_need_src_gen,12'hfff};
cmp_data_mask_2 = {12'h0,CMP_DATA_MASK};
源代码原理 相关文章:
- 基于网络编码的多信源组播通信系统,包括源代码,原理图等(二)(12-06)
- 基于网络编码的多信源组播通信系统,包括源代码,原理图等(一)(12-06)
- 电源设计小贴士 1:为您的电源选择正确的工作频率(12-25)
- 用于电压或电流调节的新调节器架构(07-19)
- 超低静态电流电源管理IC延长便携应用工作时间(04-14)
- 电源设计小贴士 2:驾驭噪声电源(01-01)