RAM の書き込みに適したコードはどれですか?
ブロック
data_out
内の割り当て:always
module memory( output reg [7:0] data_out, input [7:0] address, input [7:0] data_in, input write_enable, input clk ); reg [7:0] memory [0:255]; always @(posedge clk) begin if (write_enable) begin memory[address] <= data_in; end data_out <= memory[address]; end endmodule
ステートメントを
data_out
使用して割り当て:assign
module memory( output [7:0] data_out, input [7:0] address, input [7:0] data_in, input write_enable, input clk ); reg [7:0] memory [0:255]; always @(posedge clk) begin if (write_enable) begin memory[address] <= data_in; end end assign data_out = memory[address]; endmodule
推奨事項はありますか?