2011年3月23日

memory pattern file

摘要: $readmemh(“file_name”,mem_array,start_addr,end_addr);其中要求file_name是memory_pattern file。例如:…initial begin $readmemh(“memory.list”,my_mem);endmemory.list的内容大概是这样子:1100_1100 //this is the first addr,i.e 8’h001010_1010 //this is the second addr, i.e 8’h01@ 55 //jump to new address 8’h550101_0101 //this 阅读全文

posted @ 2011-03-23 13:39 freshair_cn 阅读(167) 评论(0) 推荐(0) 编辑

for better control

摘要: 为了防止仿真进入不必要的死循环,可通过触发某事件结束仿真。例如:event terminate-sim;initial begin @(terminate-sim) #5 $finish;end这是很好的仿真风格。 阅读全文

posted @ 2011-03-23 12:01 freshair_cn 阅读(144) 评论(0) 推荐(0) 编辑

Modelsim中改变模块参数

摘要: 引用一个模块的时候,上层模块可以改变下层模块中parameter的值,方法一般有两种:1、用defparam重新定义。 形式:defparam inst_name.para = value; 例如: module sub(…); parameter param1 = 1; … endmodule module top(…); defparam sub_inst.param1 = 2;/////// sub sub_inst(…); endmodule2、实例化时重新传递。 实例化时把参数传递过去,有多个参数时有逗号隔开。例如: … sub #(2) sub_inst(…); … 有多个参数时, 阅读全文

posted @ 2011-03-23 11:30 freshair_cn 阅读(672) 评论(0) 推荐(0) 编辑

事件event与任务task的区别

摘要: 事件可以作为敏感信号量激活一个语句块的操作,事件由’->’触发。例如: event trigger; always @ (trigger) begin … end initial begin ->trigger; end 事件与任务的区别是,触发事件后主程序可以继续往下执行,不受触发的事件何 时结束的影响;而调用一个任务后,必须等任务执行完毕,才可继续往下执行。 阅读全文

posted @ 2011-03-23 09:51 freshair_cn 阅读(3340) 评论(0) 推荐(1) 编辑

导航