반응형
  • 숨쉬는 공부방
    • Security
      • SHA
    • Hardware Security
    • Verilog HDL
    • ─── ✿ ───
      • IT
      • 이것저것

블로그 메뉴

  • 홈
  • 모든 글
  • 방명록

인기 글

최근 글

태그

  • C코드
  • 순차회로
  • FSM
  • SHA256
  • 조합회로
  • 설계
  • SHA-256
  • KISA
  • Verilog
  • Modelsim

hELLO · Designed By 정상우.
숨.

후하후하

RR(Rotate Right)
Hardware Security

RR(Rotate Right)

2022. 2. 4. 11:16

Transform() 함수 내부에서 동작하는 여러 모듈 중 하나.

 

 


* RTL

// rotate right
module calc_RR(
	input 	wire 	[8*8-1:0] 	x,
	input 	wire 	[4:0]		n,
	output 	wire 	[8*8-1:0] 	calc_x
);

	assign calc_x = (x>>n) | (x<<(64-n)); // 64bit

endmodule

(x>>13) | (x<<(64-13))

= (x>>13) | (x<<51)

 

* TestBench

`timescale 1ns/1ps

module tb_define;
	reg 	[8*8-1:0]	i_msg;
	reg 	[4:0]		i_cnt;
	wire 	[8*8-1:0]	o_result;

	calc_RR U0_RR	(
		.x	(	i_msg		),
		.n	(	i_cnt		),
		.calc_x	(	o_result	)
	);

	// Generate inputs
	initial begin
		i_msg = 'b1100_1100;
		i_cnt = 'd13;

		#(50);
		$finish;
	end

endmodule

 

 

 


출력 결과

이건..(32-n)햇을 때
64bit Roate Right 출력 결과

13회 오른쪽으로 회전 이동을 한 결과이다.

입력값: 0000_0000_0000_0000__0000_0000_0000_0000__0000_0000_0000_0000_0000_0000_1100_1100

출력값: 0000_0110_0110_0000__0000_0000_0000_0000__0000_0000_0000_0000__0000_0000_0000_0000

 

 

x>>13 : 0000_0000_0000_0000__0000_0000_0000_0000__0000_0000_0000_0000__0000_0000_0000_0000

x<<51 : 0000_0110_0110_0000__0000_0000_0000_0000__0000_0000_0000_0000__0000_0000_0000_0000

---------------------------------------------------------------------------------------------------------------------

or연산 : 0000_0110_0110_0000__0000_0000_0000_0000__0000_0000_0000_0000__0000_0000_0000_0000

 

 


 

'Hardware Security' 카테고리의 다른 글

[SHA256] FF 모듈  (0) 2022.02.23
FF 구성 모듈  (0) 2022.02.17
[SHA256] FF() 구성 모듈 - (1): RR, Sigma0, Sigma1  (0) 2022.02.04
[SHA256][Verilog HDL] 코드 만들기  (0) 2021.11.18
    'Hardware Security' 카테고리의 다른 글
    • [SHA256] FF 모듈
    • FF 구성 모듈
    • [SHA256] FF() 구성 모듈 - (1): RR, Sigma0, Sigma1
    • [SHA256][Verilog HDL] 코드 만들기
    숨.
    숨.

    티스토리툴바