0
0

More than 3 years have passed since last update.

vistaでquartus その29

Posted at

概要

vistaでquartusやってみた。
cpu作ってみた。
aluを拡張してみた。

サンプルコード

加算、減算、乗算、除算、剰余、大きい、小さいを実装。

module alu(input [15:0] a, input [15:0] b, input [4:0] f, output reg [15:0] s);
    always @(a or b or f)
    begin
        case (f)
        0:
            s = b + a;
        1:
            s = b > a;
        2:
            s = b < a;
        3:
            s = b - a;
        4:
            s = b * a;
        5:
            s = b / a;
        6:
        begin
            s = b / a;
            s = b - s * a;
        end
        default:
            s = 16'hxxxx;
        endcase
    end
endmodule

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0