Diary/2013-6-29
続・VHDLでの除算について
パス遅延65.6ns,つまり最大動作周波数が15MHzくらいになる,というのは
受け入れ難いな,とは思うけど,
ちゃんと合成可能なライブラリが用意されているのは素晴しい.
VHDLでの除算
VHDLでは,除算で商と剰余を求めるには,それぞれ/とmodという演算子が
あることは知っていたけど,シミュレーション用であって,
合成できないと信じていた.
@kibayosさんに尋ねられたので,エラーメッセージを見てもらおうと合成してみると...
合成できるのね.使ったツールはISE 14.4.
HDLのソースコードは,素直に↓の通り.
singedじゃなくてunsingedでも合成できる.
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity arith is port ( a : in signed(31 downto 0); b : in signed(31 downto 0); q : out signed(31 downto 0); r : out signed(31 downto 0) ); end arith; architecture RTL of arith is begin -- RTL process (a, b) begin -- process q <= a / b; r <= a mod b; end process; end RTL;
対象をXC7K325T-2とした時のログからの抜粋ですが,
パス遅延は,
Maximum combinational path delay: 65.661ns
で,合成レポートは↓のような感じ.
P&Rまで行ったときの占有スライス数は958でした.
合成したモジュールのSchematicを見ようとしたのですが,
VMWare上のWindowsで動かしているISEには荷が重いようで,断念.
========================================================================= Advanced HDL Synthesis Report Macro Statistics # Adders/Subtractors : 72 32-bit adder : 1 32-bit adder carry in : 66 32-bit subtractor : 4 33-bit adder : 1 # Comparators : 66 32-bit comparator greater : 1 32-bit comparator lessequal : 1 33-bit comparator greater : 1 33-bit comparator lessequal : 1 34-bit comparator greater : 1 34-bit comparator lessequal : 1 35-bit comparator greater : 1 35-bit comparator lessequal : 1 36-bit comparator greater : 1 36-bit comparator lessequal : 1 37-bit comparator greater : 1 37-bit comparator lessequal : 1 38-bit comparator greater : 1 38-bit comparator lessequal : 1 39-bit comparator greater : 1 39-bit comparator lessequal : 1 40-bit comparator greater : 1 40-bit comparator lessequal : 1 41-bit comparator greater : 1 41-bit comparator lessequal : 1 42-bit comparator greater : 1 42-bit comparator lessequal : 1 43-bit comparator greater : 1 43-bit comparator lessequal : 1 44-bit comparator greater : 1 44-bit comparator lessequal : 1 45-bit comparator greater : 1 45-bit comparator lessequal : 1 46-bit comparator greater : 1 46-bit comparator lessequal : 1 47-bit comparator greater : 1 47-bit comparator lessequal : 1 48-bit comparator greater : 1 48-bit comparator lessequal : 1 49-bit comparator greater : 1 49-bit comparator lessequal : 1 50-bit comparator greater : 1 50-bit comparator lessequal : 1 51-bit comparator greater : 1 51-bit comparator lessequal : 1 52-bit comparator greater : 1 52-bit comparator lessequal : 1 53-bit comparator greater : 1 53-bit comparator lessequal : 1 54-bit comparator greater : 1 54-bit comparator lessequal : 1 55-bit comparator greater : 1 55-bit comparator lessequal : 1 56-bit comparator greater : 1 56-bit comparator lessequal : 1 57-bit comparator greater : 1 57-bit comparator lessequal : 1 58-bit comparator greater : 1 58-bit comparator lessequal : 1 59-bit comparator greater : 1 59-bit comparator lessequal : 1 60-bit comparator greater : 1 60-bit comparator lessequal : 1 61-bit comparator greater : 1 61-bit comparator lessequal : 1 62-bit comparator greater : 1 62-bit comparator lessequal : 1 63-bit comparator greater : 1 63-bit comparator lessequal : 1 64-bit comparator greater : 1 64-bit comparator lessequal : 1 # Multiplexers : 2087 1-bit 2-to-1 multiplexer : 2080 32-bit 2-to-1 multiplexer : 6 33-bit 2-to-1 multiplexer : 1 # Xors : 2 1-bit xor2 : 2 =========================================================================