0

I have made this VHDL code for writing to a USB-chip.

It all runs inside a case statement, where each operation (write, read, ect.) is implemented.

The two write register sections below are equal, only different by the address and data.

Can this be simplified using a procedure or something?

            -------- WRITE REGISTER ---------
            when s10 =>
                -- Txd Cmd
                txdata(7 downto 6) <=  "10";        -- CMD = register write
                txdata(5 downto 0) <=  "000100";    -- address
                state := s11;
            when s11 => 
                -- write reg
                if nxt = '1' then
                    txdata <= X"45";    -- output on clock rising edge when nxt is high
                    stp <= '1';                     
                    state := s12;
                end if;
            when s12 =>
                stp <= '0';                             
                txdata <= "00000000";       -- idle                 
                state := s20;

            -------- WRITE REGISTER ---------
            when s20 =>
                -- Txd Cmd
                txdata(7 downto 6) <=  "10";        -- CMD = register write
                txdata(5 downto 0) <=  "110101";    -- address
                state := s21;
            when s21 => 
                -- write reg
                if nxt = '1' then
                    txdata <= X"04";                                            
                    stp <= '1';                     
                    state := s22;
                end if;
            when s22 =>
                stp <= '0';                             
                txdata <= "00000000";       -- idle                 
                state := s30;
4

2 に答える 2

1

はい、手順を使用します。これはあなたがすでにここで尋ねたことではありませんか?

初期化用のVHDLステートマシンを設計する

于 2012-09-03T14:57:16.283 に答える
0

アドレスとデータの値にレジスタを使用することをお勧めします。次に、実際の書き込みを1つだけ説明する必要があります。それ以外は、registercontentsの変更にすぎません。それはあなたがあなたの執筆を始める前の状態で行うことができます...

于 2012-09-03T11:13:08.217 に答える