正如我們所知,“bit”是無符號(hào)的,而“byte”是有符號(hào)的。那么,你認(rèn)為下面兩個(gè)聲明是等價(jià)的嗎?
bit [7:0] aBit; // Note ‘bit’ is 2-state, unsigned byte bByte; // Note ‘byte’ is 2-state, 8-bit signed integer
答案是不等價(jià),因?yàn)椋?/p>
bit [7:0] aBit; // = 0 to 255 byte bByte; // = -128 to 127
所以,你需要小心混合bit和字byte數(shù)據(jù)類型的計(jì)算。
同樣,你認(rèn)為以下兩種說法等價(jià)嗎?
byte MEM_BYTES [256]; bit signed [7:0] MY_MEM_BYTES [256];
答案是等價(jià)。我們可以簡單理解為
bit signed [7:0] 等價(jià)為 byte。
審核編輯:劉清
-
Verilog
+關(guān)注
關(guān)注
29文章
1366瀏覽量
111854
原文標(biāo)題:System Verilog當(dāng)中的Bits vs Bytes
文章出處:【微信號(hào):芯片驗(yàn)證工程師,微信公眾號(hào):芯片驗(yàn)證工程師】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
Modelsim XE是否支持System Verilog
System Verilog常見問題及語言參考手冊(cè)規(guī)范
System Verilog問題和語言參考手冊(cè)規(guī)范
求大佬分享一些System Verilog的學(xué)習(xí)經(jīng)驗(yàn)
淺析System Verilog當(dāng)中的Bits vs Bytes
SpinalHDL中Bundle與普通數(shù)據(jù)類型之間的連接賦值轉(zhuǎn)換
UART0想使用64 Bytes FIFO該如何設(shè)定?
Verilog Digital System Design

VHDL,Verilog,System verilog比較
學(xué)會(huì)這些System Verilog方法,芯片驗(yàn)證入門沒問題
淺談System Verilog的DPI機(jī)制

談?wù)?b class='flag-5'>Verilog/System Verilog和C的幾種交互模式

評(píng)論