|  | 
 
| 
请问这段代码的问题在哪,为什么会引入flipflop? DEFAULT branch of CASE statement cannot be reached是怎么造成的?
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册  
 
 Inferred memory devices in process
 
 in routine accum line 153 in file
 
 '/home/IC/project/cpu_test/risc_cpu_new.v'.
 ===============================================================================
 |    Register Name    |   Type    | Width | Bus | MB | AR | AS | SR | SS | ST |
 ===============================================================================
 |      accum_reg      | Flip-flop |   8   |  Y  | N  | N  | N  | N  | N  | N  |
 ===============================================================================
 Presto compilation completed successfully.
 Information: Building the design 'alu'. (HDL-193)
 Warning:  /home/IC/project/cpu_test/risc_cpu_new.v:188: DEFAULT branch of CASE statement cannot be reached. (ELAB-311)
 
 
 
 
 
 
 
    
        复制代码
 module alu(
       input wire alu_clk,
       input wire [7:0] data,
       input wire [7:0] accum,
       input wire [2:0] opcode,
       output reg [7:0] alu_out,
       output wire zero );
       
       parameter HLT  = 3'b000,
                                SKZ  = 3'b001,
                                ADD  = 3'b010,
                                ANDD = 3'b011,
                                XORR = 3'b100,
                                LDA  = 3'b101,
                                STO  = 3'b110,
                                JMP  = 3'b111;
       
       assign zero = !accum;
       
       always @( posedge alu_clk ) begin
               casex( opcode )
                       HLT:
                               alu_out <= accum;
                       SKZ:
                               alu_out <= accum;
                       ADD:
                               alu_out <= data + accum;
                       ANDD:
                               alu_out <= data & accum;
                       XORR:
                               alu_out <= data ^ accum;
                       LDA:
                               alu_out <= data;
                       STO:
                               alu_out <= accum;
                       JMP:
                               alu_out <= accum;
                       default:
                               alu_out <= 8'hxx;
               endcase
        end
 
 
 endmodule
 | 
 |