문제

나는 an을 올렸다 대답 에게 또 다른 stackoverflow 질문 FPGA로 프로그래밍 할 수 있도록 Verilog 또는 VHDL에서 일부 디지털 로직을 구현해야합니다.

Verilog, VHDL 또는 기타 하드웨어 설명 언어에서 다음 로직 다이어그램을 어떻게 구현 하시겠습니까?

번호가 매겨진 상자는 필드에서 비트를 나타냅니다. 각 필드에는 있습니다 케이 비트 및 비트 현재의 그리고 마스크 컴퓨터 시스템 (래치 레지스터 또는 동등한 등급 사용)에 의해 제공됩니다. 비트 다음 동일한 컴퓨터 시스템으로 다시 읽을 것입니다.

대체 텍스트 http://img145.imageshack.us/img145/5125/bithifterlogicdiagramkn7.jpg

또한보십시오: 이 stackoverflow 질문

도움이 되었습니까?

해결책

이 같은?

module scheduler
 #( parameter K = 10 )
  (
   input wire [K:1] current,
   input wire [K:1] mask,
   output reg [K:1] next
   );

   reg [K:1] a;
   reg [K:1] b;

   //'[i+1]' busses that wrap.
   // eg, for a 4-bit bus...
   // a[i]:        a[4],a[3],a[2],a[1] (obviously...)
   // a_wrap[i]:   a[1],a[4],a[3],a[2] 
   wire [K:1] mask_wrap    = { mask[1],mask[K:2] };
   wire [K:1] a_wrap       = { a[1], a[K:2] };
   wire [K:1] current_wrap = { current[1], current[K:2] };

   integer i;
   always @( * ) begin
      for( i=1; i<=K; i=i+1 ) begin
         a[i] = ~current_wrap[i] && b[i];
         b[i] = a_wrap[i] || mask_wrap[i];
         next[i] = ~a[i] && mask_wrap[i];
      end
   end


endmodule

(면책 조항 : 보풀이지만 시뮬레이션되지 않음)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top