課題1.4.1(自由課題)課題1.2を元に1ビットのセレクト信号を追加し、信号が0なら加算、1なら減算を行うような回路を設計してください。課題1.4.2 (自由課題)Verilog 2001スタイル、for文を用いると課題1.3のモジュールは下記のように書くこともできます。 /*!
Queue2 #( */ module Queue2 #( parameter WIDTH = 8, parameter INIT = 8'b0, parameter DEPTH = 16 ) ( output reg [WIDTH - 1: 0] out, input [WIDTH - 1: 0] in, input reset, clock ); parameter WIDTH_QUEUE = WIDTH * (DEPTH - 1); integer i; // キューの本体 reg [WIDTH_QUEUE - 1: 0] queue; always @(posedge clock) begin if(reset) begin for(i = 0; i < WIDTH_QUEUE; i = i + WIDTH) begin queue[i +: WIDTH] <= INIT; end out <= INIT; end else begin out <= queue[0 +: WIDTH]; queue <= {in, queue[WIDTH_QUEUE - 1: WIDTH]}; end end endmodule 上記モジュールを課題1.3のテストベンチへ接続し、動作を確認してください。 |