⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acs1.v

📁 Viterbi译码器的FPGA实现代码,来在国外大学论坛.
💻 V
字号:
///////////////////////////////////////////////////// Module acs1.v // Hierarchy: acs4.v// Module function: //  Module acs1.v calculates the surviving metrics for one state. The//  inputs are two path metrics from previous time slot. Each path metric//  is added with associated branch metric which also presents the input to//  the module. The smaller total metric is selected and output as well as the//  decision bit.////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////module acs1(phi1,phi2,path_metric0_s1,path_metric1_s1,branch_metric0_s1,branch_metric1_s1,path_metric_out_s1,decision_s1,sel_initial_s1,initial_metric_s1);///////////////////////////////////////////////////////////////////////////////input         phi1,phi2;input  [3:0]  path_metric0_s1,	      path_metric1_s1;input  [1:0]  branch_metric0_s1,              branch_metric1_s1;input         sel_initial_s1; // 1 selects the initial state to be loaded input  [3:0]  initial_metric_s1;output        decision_s1; output [3:0]  path_metric_out_s1;reg    [3:0]  path_metric_out_s1;wire   [4:0]  total_metric0_s1,              total_metric1_s1;wire   [3:0]  new_path_metric_s1,      // smaller of the two total metrics               selected_path_metric_s1; // path metric selected after//                                        checking the initial statereg    [3:0]  path_metric_out_s2;////////////////////////////////////////////////////////////////////////////////////////////// Add, Compare, Select logic ////////////////////////////////////assign total_metric0_s1 = path_metric0_s1 + branch_metric0_s1;assign total_metric1_s1 = path_metric1_s1 + branch_metric1_s1;assign decision_s1= total_metric0_s1 >= total_metric1_s1;assign new_path_metric_s1= decision_s1 ? total_metric1_s1[3:0] : total_metric0_s1[3:0];assign selected_path_metric_s1 = sel_initial_s1 ? initial_metric_s1 :new_path_metric_s1;//////////// Latch at phi1 ////////////////////////////////////////////////////always @(phi1 or selected_path_metric_s1) if (phi1)     path_metric_out_s2 = selected_path_metric_s1;//////////// Latch at phi2 ////////////////////////////////////////////////////always @(phi2 or path_metric_out_s2) if (phi2)     path_metric_out_s1 = path_metric_out_s2;//////////////////////////////////////////////////////////////////////////////endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -