日常记录(24)方法
数组方法,用于非填充数组:固定数组,固定数组,动态数组,队列,联合数组。
sum求和
product求积
and,or,xor,与或,异或等方法
max,min,unique的最大最小,唯一化
reverse,shuffle,sort,rsort的翻转、打乱、升序、降序
find,find_first,find_first_with_index的与with item配合,获取数组子集,过滤。with的判断结果为1bit宽度。
https://blog.csdn.net/Holden_Liu/article/details/100727957
联合数组:
first、next、prev、delete、exists等
队列:
push_front、pop_back、push_back、pop_front、insert、delete【无参数则整个队列删除】等
队列和联合数组用于fifo/stack,稀疏矩阵/内存/字符串索引等。非连续,固定数组和动态数组连续,固定数组可多维,动态数组单维度。
字符串类型变量string的函数
$psprintf()生成字符串
==,!=,compare(),icompare()
itoa、atoi、atohex、toupper、tolower
len、getc、putc、substr等
function和task
function无延时,在Verilog需要一个返回值。task则可以有延时。#, @, wait等。
sv的function可以没有返回值,可以有return语句。begin。。。end默认存。task的声明中默认参数输入为logic类型。
function的默认返回值类型,默认缺省值为 1 比特的寄存器数据,
Verilog中的比较。最后一条在sv中明显不成立。
以下为function的ref和strobe的显示
module taa (); function void func1(); input int a; input int b; a=10; b=5; endfunction: func1 function void func2(ref int a,ref int b); a=10; b=5; endfunction: func2 initial begin int a; int b; a=5; b=2; func1(a, b); $display("value a=%d, b=%d", a, b); $strobe("st1 value a=%d, b=%d", a, b); func2(a, b); $display("value a=%d, b=%d", a, b); $strobe("st2 value a=%d, b=%d", a, b); end endmodule
输出内容:
value a= 5, b= 2 value a= 10, b= 5 st2 value a= 10, b= 5 st1 value a= 10, b= 5
+:
module tbb (); reg [7:0] mem[64]; initial begin for(int i=0;i<8;i++) mem[i*8+:8]='{8{'1}}; foreach(mem[i]) $display("the mem content: %b", mem[i]); end endmodule
输出

1 the mem content: 11111111 2 the mem content: 11111111 3 the mem content: 11111111 4 the mem content: 11111111 5 the mem content: 11111111 6 the mem content: 11111111 7 the mem content: 11111111 8 the mem content: 11111111 9 the mem content: 11111111 10 the mem content: 11111111 11 the mem content: 11111111 12 the mem content: 11111111 13 the mem content: 11111111 14 the mem content: 11111111 15 the mem content: 11111111 16 the mem content: 11111111 17 the mem content: 11111111 18 the mem content: 11111111 19 the mem content: 11111111 20 the mem content: 11111111 21 the mem content: 11111111 22 the mem content: 11111111 23 the mem content: 11111111 24 the mem content: 11111111 25 the mem content: 11111111 26 the mem content: 11111111 27 the mem content: 11111111 28 the mem content: 11111111 29 the mem content: 11111111 30 the mem content: 11111111 31 the mem content: 11111111 32 the mem content: 11111111 33 the mem content: 11111111 34 the mem content: 11111111 35 the mem content: 11111111 36 the mem content: 11111111 37 the mem content: 11111111 38 the mem content: 11111111 39 the mem content: 11111111 40 the mem content: 11111111 41 the mem content: 11111111 42 the mem content: 11111111 43 the mem content: 11111111 44 the mem content: 11111111 45 the mem content: 11111111 46 the mem content: 11111111 47 the mem content: 11111111 48 the mem content: 11111111 49 the mem content: 11111111 50 the mem content: 11111111 51 the mem content: 11111111 52 the mem content: 11111111 53 the mem content: 11111111 54 the mem content: 11111111 55 the mem content: 11111111 56 the mem content: 11111111 57 the mem content: 11111111 58 the mem content: 11111111 59 the mem content: 11111111 60 the mem content: 11111111 61 the mem content: 11111111 62 the mem content: 11111111 63 the mem content: 11111111 64 the mem content: 11111111
NERATree的m命令
删除文件、修改等,
Le vent se lève! . . . il faut tenter de vivre!
Le vent se lève! . . . il faut tenter de vivre!