;

연암과 다산 사이

블로그 이미지
문패 달고 보니까 넘 커다란 이름이네요 ^^; 행여 고래 등 사이에 끼인 새우가 되지 않기를 ㅎㅎ 연암은 고미숙님의 '열하일기, 웃음과 역설의 유쾌한 시공간'에서, 다산은 '다산연구소' (http://www.edasan.org)에서 삘 받았슴다. 잼난 놀이터가 되었으면... ^^
by 명랑만화
  • Total hit
  • Today hit
  • Yesterday hit
02-08 00:04

< Data Types >
https://www.doulos.com/knowhow/sysverilog/tutorial/datatypes/ 

 

* Integer and Real Types
- 4-state logic(0,1,x,z) @verilog : reg[unser-defined], logic[user-defined], integer(32b, signed)
  cf. 'logic' can be used instead of 'wire' or 'reg'
- 2-state logic(0,1) introduced by System Verilog : bit[user-defined], byte(8b), shortint(16b), int(32b), longint(64b)

 

- Non-integer type : time(64b, unsinged), shortreal(=float in C), real(=double in C), realtime(=real)

 

 

* Arrays
- may have either packed or unpacked dimensions, or both, e.g.
reg [3:0][7:0] register [0:9];  // packed [3:0][7:0], unpacked [0:9]
 -> Packed dimensions : laid out contiguously in memory, cab be sliced, restricted to "bit" types or some types with fixed-size(e.g. int)
 -> Unpacked dimensions : arranged in memory in any way, can be copied on to another array of the same type(for different types, a cast must be used ), any type

 

 

* Queue : a variable-size, ordered collection of homogeneous elements
https://www.verificationguide.com/p/systemverilog-queues.html 

 

- Declaration
data_type queue_name[$];  // specifying $ as the array size ( '$' is also used as the last index of Queue )
 // data_type : data type of the queue elements (e.g. bit, int, byte, string, etc.)
 // queue_name : name of the queue
 // e.g. byte  queue_a[$:255];  // max entry size = 256
 // e.g. string  queue_b[$];

 

- Initialization :
Queue_Name = {element0, element2, ... };  // for string : "element"

 

- Queue Methods
  size()       --> returns the number of items in the queue  // queue_a.size()
  insert()     --> inserts the given item at the specified index position
     // queue_a.insert(1,100) // Insert the element of '100' into #1 position
     // the previous elements with the index equal to and larger than the specified index have the index which is increased by 1
  delete()     --> deletes the item at the specified index position.
     // queue_a.delete(5) // delete the element in #5 position
     // the previous elements with the index equal to and larger than the specified index have the index which is decreased by 1
  push_front() --> inserts the given element at the front of the queue  // same as 'insert(0,element)'
  push_back()  --> inserts the given element at the end of the queue    // same as 'insert($+1,element)'
  pop_front()  --> removes and returns the first element of the queue
    // same as '$display(Queue_Name[0]) + Queue_Name.delete[0]'
  pop_back()   --> removes and returns the last element of the queue
    // same as '$display(Queue_Name[$]) + Queue_Name.delete[$]'

 

 

* enum : a set of named values
% syntax : enum {element_0, ..., elelement_n} enum_variable;  // 'enum_variable' can store one of enum elements

 

% example
enum {RED, YELLOW, GREEN} light_1;  // int type; RED = 0, YELLOW = 1, GREEN = 2 
enum bit[1:0] {RED, YELLOW, GREEN} light_2;  // bit type; RED = 0, YELLOW = 1, GREEN = 2

enum {RED = 4, YELLOW = 9, GREEN} light_4;   // RED = 4, YELLOW = 9, GREEN = 10 (automatically assigned)

 

* Typedef :
typedef reg [7:0] Octet;
typedef Octet [3:0] QuadOctet;
QuadOctet qByptes [0:10];  // same as 'reg [3:0][7:0] qBytes [0:10];

AND

ARTICLE CATEGORY

분류 전체보기 (4477)
올드Boy다이어리 (532)
올드Boy@Jeju (83)
올드Boy@Road (131)
올드Boy@Book (58)
숨은길찾기 (14)
스펙트럼 (105)
우물밖엿보기 (32)
교회에말걸기 (226)
이어지는글들 (52)
하하호호히히 (75)
어?...아하! (126)
대한늬우스 (1673)
세계는지금 (268)
차한잔의여유 (64)
La Vita E Bella (230)
좋은나라만들기 (92)
트위터세상 (67)
사람&말 (625)
호모파베르 (20)

RECENT ARTICLE

RECENT COMMENT

RECENT TRACKBACK

CALENDAR

«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28

ARCHIVE