1  Memories 

 Memories file format is shown below, the address is specified as @ <address> in hexadecimal.

          @003
   00000011
   00000100
   00000101
  00000110
   00000111
   00001000
   00001001

 With the above file it can be seen if the memory is large it would become very tedious to work out the address of a specific byte, so it is normally a good idea to use milestones along the memory file, so a larger file may look something like the following:

          @003
   00000011
   00000100
   00000101
   @006
   00000110
   00000111
   @008
   00001000
  00001001

 or if the data is contiguous, omit the address entirely.

2  Syntax:

 $readmemb ("<file_name>", <memory_name>"); 
 $readmemb ("<file_name>", <memory_name>, memory_start"); 
 $readmemb ("<file_name>", <memory_name>, memory_start, memory_finish");

 The memory_start and memory_finish are optional.

3   Example

 Now that a memory file exists to access it, it has to be initialised for memory reading.

 module testmemory;
reg [:] memory [:];
integer index; initial
   begin
$readmemb("mem.dat", memory); for(index = ; index < ; index = index + )
$display("memory[%d] = %b", index[:], memory[index]);
end
endmodule // testmemory

  with the file mem.data as

        1000_0001
1000_0010
0000_0000
0000_0001
0000_0010
0000_0011
0000_0100
0000_0101
0000_0110
0000_0000

Verilog之$sreadmemb的更多相关文章

  1. Verilog学习笔记简单功能实现(二)...............全加器

    先以一位全加器为例:Xi.Yi代表两个加数,Cin是地位进位信号,Cout是向高位的进位信号.列表有:   Xi     Yi    Cin Sum Cout 0 0 0 0 0 0 0 1 1 0 ...

  2. Verilog HDL模型的不同抽象级别

    所谓不同的抽象类别,实际上是指同一个物理电路,可以在不同层次上用Verilog语言来描述.如果只从行为功能的角度来描述某一电路模块,就称作行为模块.如果从电路结构的角度来描述该电路模块,就称作结构模块 ...

  3. Verilog学习笔记基本语法篇(十二)········ 编译预处理

    h Verilog HDL语言和C语言一样也提供编译预处理的功能.在Verilog中为了和一般的语句相区别,这些预处理语句以符号"`"开头,注意,这个字符位于主键盘的左上角,其对应 ...

  4. Verilog学习笔记基本语法篇(十一)········ 常用系统函数

    1)系统任务:$monitor   格式: $monitor(p1,p2,p3...pn); $monitor; $monitoron; $monitoroff; 任务$monitor提供了监控输出列 ...

  5. FPGA作为从机与STM32进行SPI协议通信---Verilog实现 [转]

    一.SPI协议简要介绍 SPI,是英语Serial Peripheral Interface的缩写,顾名思义就是串行外围设备接口.SPI,是一种高速的,全双工,同步的通信总线,并且在芯片的管脚上只占用 ...

  6. 基于Verilog HDL整数乘法器设计与仿真验证

    基于Verilog HDL整数乘法器设计与仿真验证 1.预备知识 整数分为短整数,中整数,长整数,本文只涉及到短整数.短整数:占用一个字节空间,8位,其中最高位为符号位(最高位为1表示为负数,最高位为 ...

  7. system verilog中的跳转操作

    在verilog中,使用disable声明来从执行流程中的某一点跳转到另一点.特别地,disable声明使执行流程跳转到标注名字的声明组末尾,或者一个任务的末尾. verilog中的disable命令 ...

  8. system verilog中的类型转换(type casting)、位宽转换(size casting)和符号转换(sign casting)

    类型转换 verilog中,任何类型的任何数值都用来给任何类型赋值.verilog使用赋值语句自动将一种类型的数值转换为另一种类型. 例如,当一个wire类型赋值给一个reg类型的变量时,wire类型 ...

  9. 一段比较有意思的代码——介绍system verilog中的新增幅值语句

    system verilog中新加了很多幅值语句,虽然都只适用于阻塞幅值,但是在某些场合中非常实用. 下面是一段有意思的代码,覆盖了一些用法. package definitions; typedef ...

随机推荐

  1. 【剑指Offer】29、最小的K个数

      题目描述:   输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4.   解题思路:   本题最直观的解法就是将输入的n个整数排 ...

  2. 减小数据库Log文件大小 1MB 为自定义大小

    --减小数据库Log文件大小 1MB 为自定义大小USE [master]GOALTER DATABASE DataBaeName SET RECOVERY SIMPLE WITH NO_WAITGO ...

  3. 如何解决windows docker共享目录不支持符号链接(do not support symlinks)?

    windows使用docker toolbox,搭建前端开发环境时,在共享目录使用npm安装前端依赖时,发现报错,无法使用符号连接. 这里有一个帖子专门讨论这个问题,感兴趣可以看一下: https:/ ...

  4. 记一次惊心的网站 TCP 队列问题排查经历

    https://blog.csdn.net/chenlycly/article/details/80868990 http://www.mytju.com/classcode/news_readnew ...

  5. Linux学习笔记之1——文件和目录管理(硬连接和软连接)(连结档,相当于快捷方式)

    在这节将要学习linux的连接档,在之前用"ls -l" 查看文件属性的命令时, 其中第二个属性是连接数.那么这个连接数是干什么的?这就要理解inode. 先说一下文件是怎么存储的 ...

  6. Basic Memory Structures

    Basic Memory Structures The basic memory structures associated with Oracle Database include: System ...

  7. 转载 - Tarjan算法(求SCC)

    出处:http://blog.csdn.net/xinghongduo/article/details/6195337 说到以Tarjan命名的算法,我们经常提到的有3个,其中就包括本文所介绍的求强连 ...

  8. DJANGO里让用户自助修改密码

    参考了网上的实现,最终实现的各代码如下: changepwd.html模板文件: {% extends "Prism/index.html" %} {% load staticfi ...

  9. Java 代理学习笔记

    http://blog.csdn.net/mr_seaturtle_/article/details/52686516

  10. Yarn的工作流程

    http://study.163.com/course/courseLearn.htm?courseId=1002887002#/learn/video?lessonId=1003346099& ...