MyFPGA Forum

 找回密码
 注册
搜索
查看: 6496|回复: 5
打印 上一主题 下一主题

LPM/ram-2-ports的使用问题

[复制链接]
跳转到指定楼层
1#
发表于 2010-5-17 08:40:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 jiayanfu 于 2010-5-17 09:39 编辑

我试图了解一下,ram-2-ports的使用,是否如我所想,可以任意地址读,任意地址写,却发现。。。。。读不出来。。。如图:
第一个rdclock上升沿:

第二个rdclock上升沿:

其实ram-2-ports的参数如下所示:
// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
module Img_RAM (
        data,
        rdaddress,
        rdclock,
        wraddress,
        wrclock,
        wren,
        q);

        input        [0:0]  data;
        input        [15:0]  rdaddress;
        input          rdclock;
        input        [18:0]  wraddress;
        input          wrclock;
        input          wren;
        output        [7:0]  q;
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_off
`endif
        tri1          wren;
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_on
`endif

        wire [7:0] sub_wire0;
        wire [7:0] q = sub_wire0[7:0];

        altsyncram        altsyncram_component (
                                .wren_a (wren),
                                .clock0 (wrclock),
                                .clock1 (rdclock),
                                .address_a (wraddress),
                                .address_b (rdaddress),
                                .data_a (data),
                                .q_b (sub_wire0),
                                .aclr0 (1'b0),
                                .aclr1 (1'b0),
                                .addressstall_a (1'b0),
                                .addressstall_b (1'b0),
                                .byteena_a (1'b1),
                                .byteena_b (1'b1),
                                .clocken0 (1'b1),
                                .clocken1 (1'b1),
                                .clocken2 (1'b1),
                                .clocken3 (1'b1),
                                .data_b ({8{1'b1}}),
                                .eccstatus (),
                                .q_a (),
                                .rden_a (1'b1),
                                .rden_b (1'b1),
                                .wren_b (1'b0));
        defparam
                altsyncram_component.address_reg_b = "CLOCK1",
                altsyncram_component.clock_enable_input_a = "BYPASS",
                altsyncram_component.clock_enable_input_b = "BYPASS",
                altsyncram_component.clock_enable_output_a = "BYPASS",
                altsyncram_component.clock_enable_output_b = "BYPASS",
                altsyncram_component.intended_device_family = "Cyclone II",
                altsyncram_component.lpm_type = "altsyncram",
                altsyncram_component.numwords_a = 307200,
                altsyncram_component.numwords_b = 38400,
                altsyncram_component.operation_mode = "DUAL_PORT",
                altsyncram_component.outdata_aclr_b = "NONE",
                altsyncram_component.outdata_reg_b = "CLOCK1",
                altsyncram_component.power_up_uninitialized = "FALSE",
                altsyncram_component.widthad_a = 19,
                altsyncram_component.widthad_b = 16,
                altsyncram_component.width_a = 1,
                altsyncram_component.width_b = 8,
                altsyncram_component.width_byteena_a = 1;


endmodule
2#
 楼主| 发表于 2010-5-17 08:46:30 | 只看该作者
本帖最后由 jiayanfu 于 2010-5-17 08:47 编辑

数据是按地址顺序不停地往里边随机写进去的。
可以看到,写的数据宽度是1,读的数据宽度是8。
我认为在rdclock上升沿的时候,应该根据rdaddress的值,顺序读处以rdaddress开始的八个bit的值,也就是q【7:0】的值。可是,仿真结果,大牛们看到了。。。。这样子。。不理解!!!
3#
 楼主| 发表于 2010-5-17 09:06:57 | 只看该作者
本帖最后由 jiayanfu 于 2010-5-17 09:14 编辑

第一个上升沿为什么没有值啊,按说,从地址0--7对应的值来看,不都是0呀。第二个上升沿,是有值了,可是也不是00011101(0x1D)
我对应写入的数据检查过了,写进去的数据应该是“10111000”,数据正好是倒过来的。
也就是说,出口处的数据应该和写进去的数据正好是倒过来的?大牛们,是这样吗?
我*,这玩意搞得我腰疼了。。。。
那第一个上升沿为什么没有数据呢?还是有些不明白?
4#
发表于 2010-5-17 16:51:25 | 只看该作者
你的wirte data 看起来震荡的太严重...   在wrclock的 setup 跟 hold time的时候,write data都需要是稳定的... 虽然目前不知道你的setup & hold time的时间,但是光看图就会发现 这样的写入是会有问题的

你要不要在write data 写入RAM之前再透过一个D flip flop ,再进入RAM
5#
 楼主| 发表于 2010-5-17 18:44:20 | 只看该作者
哦,好的,谢谢了,我试试
6#
 楼主| 发表于 2010-5-17 18:45:09 | 只看该作者
回复 4# Steady_Chou


    哦,谢谢,我再试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|MyFPGA

GMT+8, 2025-5-1 03:30 , Processed in 0.044138 second(s), 18 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表