日常記錄(83)vim整理
阿新 • • 發佈:2022-05-07
斷言的onehot
taa:
vcs -sverilog -R taa.sv
程式碼檔案
- onehot、onehot0是斷言的語法,不是sv的系統函式,因此只能在property等斷言程式碼中使用。
- property需要新增clk,需要模擬時間,才能測試效果。
- onehot檢查是否為只有一位為1,onehot檢查是否最多隻有一個1.
module taa (); logic clk; property p1; @(posedge clk) $onehot(8'b0001_0000); endproperty property p2; @(posedge clk) $onehot(8'b0011_0000); endproperty property p3; @(posedge clk) $onehot0(8'b1100_0000); endproperty property p4; @(posedge clk) $onehot0(8'b0000_0000); endproperty initial begin assert property(p1); assert property(p2); assert property(p3); assert property(p4); end initial begin clk = 0; forever begin #10 clk = ~clk; end end initial begin #100; $finish; end endmodule
輸出
"taa.sv", 23: taa.unnamed$$_1: started at 10s failed at 10s
Offending '$onehot(8'b00110000)'
"taa.sv", 24: taa.unnamed$$_2: started at 10s failed at 10s
Offending '$onehot0(8'b11000000)'
$finish called from file "taa.sv", line 37.
$finish at simulation time 100
強制轉換
使用單引號,靜態轉換,可綜合
https://blog.csdn.net/I_learn_code/article/details/121915477
程式碼
module tbb ();
initial begin
logic[5:0] a = 4'b1100;
$display("logic a is %p", logic'(a));
a = 4'b1101;
$display("logic a is %p", logic'(a));
end
endmodule
輸出
logic a is 0
logic a is 1
git恢復檔案
https://blog.csdn.net/qq_39505245/article/details/119877928
檔案已經提交(commit)
從庫恢復到工作區
git reset --hard <lable>
檔案提交到暫存區(add)
從庫恢復到工作區
git reset --hard HEAD
檔案未提交
- 恢復所有,重置工作區、暫存區
- 單獨恢復某一檔案(需要高版本的git)
git reset --hard HEAD
git restore <filename>
git檢視差異
- 不指定diff的引數,則是和暫存區相比
- 指定diff的HEAD,則是和庫相比
- --cached則是預設HEAD和暫存區相比
當前工作區與暫存區
git diff <filename>
暫存區與庫
git diff --cached <filename>
工作區與庫
- HEAD是提交
git diff HEAD <filename>
https://blog.csdn.net/bianliuzhu/article/details/81907367
如果是新建的檔案
則git add
如果是修改的檔案
則git add
如果是刪除的檔案
則 git rm
covergroup帶引數
- with function sample固定,只能是sample
covergroup fun_name() with function sample(xxx xxx)
module tcc ();
covergroup cvg() with function sample(logic [3:0] a);
coverpoint a;
endgroup: cvg
initial begin
cvg cvg_inst = new();
cvg_inst.sample(1);
end
endmodule
vim命令
gd命令,檢視定義:go define
:help 檢視幫助
gq+action格式化行寬,根據textwidth
如gqap,對一個段落格式化
g<ctrl+g>顯示統計資訊(如視覺化模式中的選中行數)
!!變成:.!外部命令執行,並在當前本文輸出
:ls檢視緩衝區列表
:ls!檢視包括未列入的緩衝區列表
:args和:argsdo配合,使得後者在多文字中對args指定的檔案執行argsdo
對映模式
omap掛起操作
imap插入模式
cmap命令模式
nmap正常模式
xmap可視模式
nnoremap用於非遞迴(防止命令連鎖,常用)
暫存器
0最近賦值
1-9最近刪除
a-zA-Z使用者定義
:最近的命令
.新增的文字
%檔名
/需要匹配的文字
如:! cat %,呼叫外部列印文字內容
:let @/='\<<cword>\>',是*
命令範圍(命令模式)
. 當前
1 第一行
$ 最後一行
% 等價於1,$
+n向後n行
-n向前n行
命令範圍以,或者;分隔,
正則表示式:
匹配開頭:\<
匹配結尾:\>
使用*按鍵,對暫存器/的內容獲取<cword>,並新增匹配開頭結尾,用於在當前文字中查詢關鍵字
\s空格
\+一個或多個
$行尾
去掉文字內所有行末尾的空格 :%s/\s\+$//g
在當前段落中的內容被外部命令ls替代。
:?^$?+1,/^$/-1!ls
標記
m標註標記
`或者'跳轉標記,前者跳轉到標記點,後者是標記行。
a-z檔案內標記
A-Z檔案間標記
[]、<>、()、{}
分別為修改複製塊的頭尾、視覺化的頭尾、句子的頭尾、段落的頭尾。
將視覺化選中的文字替換為外部命令ls的執行結果。
:'<,'>!ls