본문 바로가기
HW Design/2. Verilog Practice

[full_subtractor] 3. Behavioral Modeling

by 한PU 2024. 3. 11.
728x90
반응형

간단한 구조라서 Dataflow Modeling과 거의 비슷합니다. always block을 쓴다는 점이 좀 다르네요.

Dataflow Modeling도 같은 schematic이 나왔으므로 작동할 것 같습니다.

 

Code:

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date: 2024/03/11 13:47:11
// Design Name: 
// Module Name: full_subtractor_3
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//////////////////////////////////////////////////////////////////////////////////


module full_subtractor_3(x, y, b_in, b_out, d);
// I/O port declarations
input   x, y, b_in  ;
output  b_out, d    ;
reg     b_out, d    ;

// specify the function of a full adder
always @(x, y, b_in) begin
    #5
    {b_out, d} = x - y - b_in;
end
endmodule
728x90
반응형