English 中文(简体)
更妥善地在Verilog协调一个援助团
原标题:Better way of coding a RAM in Verilog
  • 时间:2011-10-03 03:27:37
  •  标签:
  • verilog
  • vlsi

哪些法典在撰写区域援助团时更好?

  1. 分配<条码>数据,载于<条码>。 页: 1

    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
    
  2. 指定<代码>数据_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
    

任何建议?

最佳回答

这取决于你们的要求。

  1. 这显示了你的记忆。 如果你把这个问题综合到门子里,你会比第2号案件多出8个单体。 这意味着,你使用一个略多的领域。 这还意味着,与时俱进相比,你的产出将减少传播延误。 2. 结 论 此外,在下一个24小时周期之前,无法提供产出数据。

  2. 你的产出数据将在与书面数据相同的24小时内提供,尽管与24小时相比,传播延误时间较长。

你们需要根据你们的要求决定如何使用。

A third option is to use a generated RAM, which is a hard macro. This should have area, power and possibly timing advantages over both case 1 and 2.

问题回答

在工具性回答中添加——如果你使用同步读写法(案例2),那么,它就获得了在联邦货币基金中设置的援助团组的地图,因为所有主要结构中的援助团区块都知道有同步读写。

这两种形式都是有效的,取决于你想要的管道类型。 我总是建议遵循Ximx RAM编码准则——这是确保该守则融入适当全球性别分析结构的良好方法。

例如,你的例子1将合成Xinx BRAM(即专用区Ram),因为它是同步的读物,而你的例子2将合成X射线分发的Ram(因为它是非同步的读物)。

See the coding guidelines in Xilinx document UG901 (Vivado Design Suiteuser Guide), in the RAML Coding Technologies section. 它还很好地描述了用于RAM的同步阅读和同步阅读之间的差异。

In the second program, there would be compilation error as we can not Assign a value to Reg . It will give an error saying: Register is illegal in left-hand side of continuous assignment





相关问题
How to NOT use while() loops in verilog (for synthesis)?

I ve gotten in the habit of developing a lot testbenches and use for() and while() loops for testing purpose. Thats fine. The problem is that I ve taken this habit over to coding for circuits which ...

Displaying the Verilog parameter name

I am using the parameter keyword to define a state, i.e., RESET = 5 b00000. If I want to use $display to print out the state name instead of the binary representation, or display the state name in my ...

verilog modelsim fpga

Sorry for Newbish question. I am trying to learn about FPGA programming. Before I spend $1K on a FPGA board: if I just want to learn Verilog, can I run it entirely in Modelsim? (I realize there are ...

Assigning wires deep in a nested set of modules

I have a wire that is about 4 levels deep and I really don t want the hassle of having to propagate it up the hierarchy. Is there any way to assign the wire using some sort of referencing? I know I ...

schematic for verilog code that adds three inputs

What does the schematic looks like for the following verilog code? module mystery2(s, c, x, y, z); input x, y, z; output s, c; assign {c, s} = x + y + z; endmodule I know that {c, s} means ...

wire equation in verilog [closed]

If say I have the following wire set-ups, is the wire assignment all valid? wire[3:1] w; wire w1; wire [1:0] w2; A) w1 = w[2]; B) w2 = w[1:0]; C) w2 = w[1:2]; I am guessing that everything is ...

How to wire two modules in Verilog?

I have written two modules DLatch and RSLatch and i want to write verilog code to join those two.

热门标签