Quality control (2)/Digital System Design

DSD - Structural Modeling(3) / Unfamiliar data type / Hierarchical modeling / Gate delay / hazards

빈그레 2023. 4. 5. 23:23

 

 


Unfamiliar Data type

 

 

 

 

 

 

Example Code

 

// Data selector – 2-to-1 mux
module two_to_one_mux_tristate (x, y, s, f);
input x, y, s;
output f; 
// internal declaration
tri f;
// data selector body
bufif0 b1 (f, x, s); // enable if s = 0
bufif1 b2 (f, y, s); // enable if s = 1
endmodule

2:1mux는 복잡하니까 tristate-buffer를 사용하여 x,y중 selector에 의해 하나의 값만 f로 나오도록 구현한 코드이다.

 

 

 

 

Unfamiliar data type

 

Data type in Verilog

 

- Net type

 : wire, tri, wand, wor,,,,,,,,

  // wire와 tri의 차이점은 tri는 z상태를 지원하는 wire라는 것이다.

 

- Variable type

 : reg, integer, real, time, realtime

 

 *** net type, variable type 이 두가지만 쓰는 게 가장 general하다.

 

 

 

 

 

wand, wor 예시

 

 

wired and인 wand는 and역할을 한다. 따라서 assign으로 a,b,c,d,e,,,,,를 x에 모두 넣어주면 x는 a~i를 and시켜주는 것이다.

위에서 x는 and처럼 동작을 하고, y는 or처럼 동작을 하는 것이다.

 

위와 같이 표현가능하지만 synthesis가 잘 되지 않아 short날 위험이 있기 때문에 권장하지 않는 data type이다.

 

 

 

 

 

 


 

 

 

 

 

 


Hierarchical Modeling

 

 

 

 

 

 

 

Structural Modeling은 사실 잘 쓰이지 않으나, 아래와 같이 사용자가 만든 module을 이어 붙여서 사용할 때는 Structural Modeling을 사용하곤 한다.

 

module을 이어붙이는 structural modeling은 다음과 같이 진행된다.

실질적인 function은 gate level(structural modeling)으로 하면 비효율적이라서 dataflow나 behavioral modeling을 쓴다.

여기에 box를 하나 씌우면 (module로서 만들면) primitive gate가 아닌 우리가 만든 module이 되는 것이다.

// 우리가 일종의 큰 gate를 만드는 셈

 

이후 사용자가 만든 module을 structural modeling으로 이어 붙이는 것이다.

 

 

4개의 Module을 Structural Modeling으로 이어 붙여 만든 것이다. Gate로 선언해서 사용하던 것을 module instance로 대체하여 사용한 것이다. 위와 같이 gate연결하듯 module을 연결한 것이  structural modeling이 가장 자주 쓰이는 용도이다.

 

 

 

4 bit adder 

 

( hierarchy + glue logic ) 아 귀찮아ㅡㅡ

나중에 정리,,, 별로 안 중요해 보여,,,,

 

 

 

 

 

 

 

 


 

 

 

 

 

 


Gate Delay and Hazards

 

 

 

다음 시간에,,,, 알아보자,,!