diff --git a/lib/spi/sim/tb_spi_master.fdo b/lib/spi/sim/tb_spi_master.fdo index 82afc7b..8652a6c 100644 --- a/lib/spi/sim/tb_spi_master.fdo +++ b/lib/spi/sim/tb_spi_master.fdo @@ -13,12 +13,11 @@ vcom -explicit -93 "../../FIFO/src/fifo_async.vhd" vcom -explicit -93 "../../FIFO/src/fifo_sync_ctrl.vhd" vcom -explicit -93 "../../FIFO/src/fifo_sync.vhd" vcom -explicit -93 "../src/spi_types.vhd" -vcom -explicit -93 "../src/spi_tx.vhd" -vcom -explicit -93 "../src/spi_rx.vhd" -vcom -explicit -93 "../src/tb_spi.vhd" -vsim -t 1ps -lib work tb_spi +vcom -explicit -93 "../src/spi_master.vhd" +vcom -explicit -93 "../src/tb_spi_master.vhd" +vsim -t 1ps -lib work tb_spi_master view wave -do {tb_spi.wdo} +do {tb_spi_master.wdo} view structure view signals diff --git a/lib/spi/sim/tb_spi_master.wdo b/lib/spi/sim/tb_spi_master.wdo index 9b1a916..208ce36 100644 --- a/lib/spi/sim/tb_spi_master.wdo +++ b/lib/spi/sim/tb_spi_master.wdo @@ -1,59 +1,59 @@ onerror {resume} quietly WaveActivateNextPane {} 0 -add wave -noupdate -format Logic /tb_spi/clk -add wave -noupdate -format Logic /tb_spi/rst -add wave -noupdate -format Logic /tb_spi/mst_cmd_vld -add wave -noupdate -format Logic /tb_spi/mst_cmd_rdy -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/mst_cmd -add wave -noupdate -format Logic /tb_spi/mst_din_vld -add wave -noupdate -format Logic /tb_spi/mst_din_rdy -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/mst_din -add wave -noupdate -format Logic /tb_spi/mst_shift_en -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/mst_dout -add wave -noupdate -format Logic /tb_spi/mst_dout_vld -add wave -noupdate -format Logic /tb_spi/mst_dout_re -add wave -noupdate -format Logic /tb_spi/mosi -add wave -noupdate -format Logic /tb_spi/miso -add wave -noupdate -format Logic /tb_spi/mst_clk -add wave -noupdate -format Logic /tb_spi/mso -add wave -noupdate -format Literal /tb_spi/ctrl -add wave -noupdate -format Literal -expand /tb_spi/status -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/slv_rx_shiftreg -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/slv_rx_valid_pipe -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/slv_rx_data -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/mst_rx_data +add wave -noupdate -format Logic /tb_spi_master/clk +add wave -noupdate -format Logic /tb_spi_master/rst +add wave -noupdate -format Logic /tb_spi_master/mst_cmd_vld +add wave -noupdate -format Logic /tb_spi_master/mst_cmd_rdy +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/mst_cmd +add wave -noupdate -format Logic /tb_spi_master/mst_din_vld +add wave -noupdate -format Logic /tb_spi_master/mst_din_rdy +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/mst_din +add wave -noupdate -format Logic /tb_spi_master/mst_shift_en +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/mst_dout +add wave -noupdate -format Logic /tb_spi_master/mst_dout_vld +add wave -noupdate -format Logic /tb_spi_master/mst_dout_re +add wave -noupdate -format Logic /tb_spi_master/mosi +add wave -noupdate -format Logic /tb_spi_master/miso +add wave -noupdate -format Logic /tb_spi_master/mst_clk +add wave -noupdate -format Logic /tb_spi_master/mso +add wave -noupdate -format Literal /tb_spi_master/ctrl +add wave -noupdate -format Literal -expand /tb_spi_master/status +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/slv_rx_shiftreg +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/slv_rx_valid_pipe +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/slv_rx_data +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/mst_rx_data add wave -noupdate -divider TX -add wave -noupdate -format Literal /tb_spi/inst_spi_tx/word_width -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/rst -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/clk -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/cmd_vld -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/cmd_rdy -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/cmd -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/din_vld -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/din_rdy -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/din -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/shift_en -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/mosi -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/tx_shift_reg -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/sclk -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/xfer_count -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/cmd_reg -add wave -noupdate -format Literal /tb_spi/inst_spi_tx/state -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/data_load_en -add wave -noupdate -format Literal /tb_spi/inst_spi_tx/shift_cnt_pipe -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/xfer_count_en -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/xfer_count_busy -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/data_count -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/data_count_busy -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/spi_clk -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/cat_fifo_din -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/cat_fifo_dout -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/cat_fifo_full -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/cat_fifo_empty -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/write_fifo_din -add wave -noupdate -format Literal -radix hexadecimal /tb_spi/inst_spi_tx/write_fifo_dout -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/write_fifo_full -add wave -noupdate -format Logic /tb_spi/inst_spi_tx/write_fifo_empty +add wave -noupdate -format Literal /tb_spi_master/inst_spi_master/word_width +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/rst +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/clk +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/cmd_vld +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/cmd_rdy +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/cmd +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/din_vld +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/din_rdy +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/din +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/shift_en +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/mosi +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/tx_shift_reg +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/sclk +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/xfer_count +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/cmd_reg +add wave -noupdate -format Literal /tb_spi_master/inst_spi_master/state +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/data_load_en +add wave -noupdate -format Literal /tb_spi_master/inst_spi_master/shift_cnt_pipe +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/xfer_count_en +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/xfer_count_busy +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/data_count +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/data_count_busy +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/spi_clk +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/cat_fifo_din +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/cat_fifo_dout +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/cat_fifo_full +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/cat_fifo_empty +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/write_fifo_din +add wave -noupdate -format Literal -radix hexadecimal /tb_spi_master/inst_spi_master/write_fifo_dout +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/write_fifo_full +add wave -noupdate -format Logic /tb_spi_master/inst_spi_master/write_fifo_empty TreeUpdate [SetDefaultTree] WaveRestoreCursors {{Cursor 1} {17474865 ps} 0} configure wave -namecolwidth 197 diff --git a/lib/spi/src/spi_master.vhd b/lib/spi/src/spi_master.vhd index 2eb9bc5..6ae66e7 100644 --- a/lib/spi/src/spi_master.vhd +++ b/lib/spi/src/spi_master.vhd @@ -6,7 +6,7 @@ use std.textio.all; -- Imports the standard textio package. use work.utils_pkg.all; use work.spi_types.all; -ENTITY spi_tx IS +ENTITY spi_master IS Generic ( word_width : natural := 32; @@ -35,9 +35,9 @@ ENTITY spi_tx IS mso : out STD_LOGIC ); -END spi_tx; +END spi_master; -ARCHITECTURE behavior OF spi_tx IS +ARCHITECTURE behavior OF spi_master IS type state_t is (reset, idle, load_data, shift, finish); diff --git a/lib/spi/src/tb_spi_master.vhd b/lib/spi/src/tb_spi_master.vhd index 0663fbb..06db57c 100644 --- a/lib/spi/src/tb_spi_master.vhd +++ b/lib/spi/src/tb_spi_master.vhd @@ -28,10 +28,10 @@ USE ieee.numeric_std.ALL; use work.spi_types.all; -ENTITY tb_spi IS -END tb_spi; +ENTITY tb_spi_master IS +END tb_spi_master; -ARCHITECTURE behavior OF tb_spi IS +ARCHITECTURE behavior OF tb_spi_master IS constant CLK_PERIOD : time := 10 ns; @@ -67,7 +67,7 @@ BEGIN ctrl.cpha <= '0'; ctrl.msb_first <= '1'; -inst_spi_tx : entity work.spi_tx +inst_spi_master : entity work.spi_master GENERIC MAP ( word_width => 32