Kraklog

[Verilog_LAB1] Part5 본문

[Harman] 하만 반도체 설계/CPU설계

[Verilog_LAB1] Part5

Krakens 2023. 12. 18. 16:25
728x90

프로그램 : Quaturs Prime lite edition 18.1

사용문법 : Verilog 2001

보드 : DE1-SOC

 

 

이전까지 설계한 내용을 7-Segment에 표현하는것이 설계 목표이다.
Segment를 4개를 사용하여 00 state에서는 de1S를, 01 에서는 E1Sd 등 을 표현하는게 목표이다.

 

`define BUS_SIZE 2
`define SL_SIZE 10	//switch LED size
`define SEG7_WD	7

module part5 (
	input		[`SL_SIZE-1:0]		SW		,
	output	[`SL_SIZE-1:0]		LEDR	,
	output	[`SEG7_WD-1:0]		HEX0	,
	output	[`SEG7_WD-1:0]		HEX1	,
	output	[`SEG7_WD-1:0]		HEX2	,
	output	[`SEG7_WD-1:0]		HEX3	
);
	
	wire	[`SEG7_WD-1:0]		Display3;
	wire	[`SEG7_WD-1:0]		Display2;
	wire	[`SEG7_WD-1:0]		Display1;
	wire	[`SEG7_WD-1:0]		Display0;
	
	assign LEDR = SW;
	assign HEX3 = Display3;
	assign HEX2 = Display2;
	assign HEX1 = Display1;
	assign HEX0 = Display0;
	
	wire	[1:0]		S = SW[9:8];
	wire	[1:0]		U = SW[7:6];
	wire	[1:0]		V = SW[5:4];
	wire	[1:0]		W = SW[3:2];
	wire	[1:0]		X = SW[1:0];
	
	wire	[1:0]		M3;
	wire	[1:0]		M2;
	wire	[1:0]		M1;
	wire	[1:0]		M0;
		
	mux_2bit_4x1 uMux_2bit_4x1_3(
		.S( S),
		.U( U),//d
		.V( V),//e
		.W( W),//1
		.X( X),//s
		.M(M3)
	);
	
	mux_2bit_4x1 uMux_2bit_4x1_2(
		.S( S),
		.U( V),
		.V( W),
		.W( X),
		.X( U),
		.M(M2)
	);
	
	mux_2bit_4x1 uMux_2bit_4x1_1(
		.S( S),
		.U( W),//1
		.V( X),//s
		.W( U),//d
		.X( V),//e
		.M(M1)
	);
	
	mux_2bit_4x1 uMux_2bit_4x1_0(
		.S( S),
		.U( X),//s
		.V( U),//d
		.W( V),//e
		.X( W),//1
		.M(M0)
	);
	
	fnd ufnd_3 (
		.C			(M3		),
		.Display	(Display3) 
	);
	
	fnd ufnd_2 (
		.C			(M2		),
		.Display	(Display2) 
	);
	
	fnd ufnd_1 (
		.C			(M1		),
		.Display	(Display1) 
	);
	
	fnd ufnd_0 (
		.C			(M0		),
		.Display	(Display0) 
	);

endmodule

 

 

728x90

'[Harman] 하만 반도체 설계 > CPU설계' 카테고리의 다른 글

[Verilog_LAB2] Part2  (0) 2023.12.19
[Verilog_LAB2] Part1  (0) 2023.12.19
[Verilog_LAB1] Part4  (1) 2023.12.18
[Verilog_LAB1] Part3  (1) 2023.12.18
[Verilog_LAB1] Part2  (1) 2023.12.18