From cd7c1fe0d544dd5debca0fbd2787758495db1f44 Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Thu, 9 Sep 2021 10:13:17 +0100 Subject: [PATCH] ELGIP-159 passes test bench now, but with json and generics set to max values. Need to check other values --- .../18/doc/generic_sequencer_18.json | 70 +++++++++---------- .../generic_sequencer/18/sim/run_sim.py | 2 +- .../generic_sequencer/18/sim/sim_gen_seq.do | 16 ++--- .../18/src/generic_sequencer_18.vhd | 9 ++- .../18/src/test/generic_sequencer_18_tb.vhd | 4 +- 5 files changed, 52 insertions(+), 49 deletions(-) diff --git a/generic_ip/generic_sequencer/18/doc/generic_sequencer_18.json b/generic_ip/generic_sequencer/18/doc/generic_sequencer_18.json index 014f7f0..0a79c2c 100644 --- a/generic_ip/generic_sequencer/18/doc/generic_sequencer_18.json +++ b/generic_ip/generic_sequencer/18/doc/generic_sequencer_18.json @@ -103,7 +103,7 @@ "reset" : "0", "description" : "Master enable for the sequencer" }, - "reserved_0" : { + "reserved_0" : { "type" : "rsv", "bit_len" : "2", "description" : "Reserved bits" @@ -114,30 +114,30 @@ "reset" : "0", "description" : "Enter debug mode (only has effect if not busy)" }, - "rst_vector_out" : { + "rst_vector_out" : { "type" : "w", "bit_len" : "1", "reset" : "0", "description" : "Reset vector_out when start_req is asserted" }, - "reserved_1" : { + "reserved_1" : { "type" : "rsv", "bit_len" : "3", "description" : "Reserved bits" }, - "clr_seq_queue" : { + "clr_seq_queue" : { "type" : "w0", "bit_len" : "1", "reset" : "0", "description" : "Clear the sequencer queue" }, - "clr_seq_queue_exe": { + "clr_seq_queue_exe": { "type" : "w0", "bit_len" : "1", "reset" : "0", "description" : "Clear the executed sequences counter" }, - "reserved_2" : { + "reserved_2" : { "type" : "rsv", "bit_len" : "1", "description" : "Reserved bits" @@ -149,7 +149,7 @@ "width" : "11", "description" : "Control register read fields", "fields": { - "reserved_0" : { + "reserved_0" : { "type" : "rsv", "bit_len" : "2", "description" : "Reserved bits" @@ -160,7 +160,7 @@ "reset" : "0", "description" : "Busy status (writing has no effect---in this register for backwards compatibility)" }, - "reserved_1" : { + "reserved_1" : { "type" : "rsv", "bit_len" : "7", "description" : "Reserved bits" @@ -180,32 +180,32 @@ "fields": { "ram_rd_addr" : { "type" : "r", - "bit_len" : "8", + "bit_len" : "12", "reset" : "0", "description" : "Current RAM read address" }, - "reserved_0" : { + "reserved_0" : { "type" : "rsv", - "bit_len" : "8", + "bit_len" : "4", "description" : "Reserved bits" }, "return_addr" : { "type" : "r", - "bit_len" : "8", + "bit_len" : "12", "reset" : "0", "description" : "Current return address" }, - "reserved_1" : { + "reserved_1" : { "type" : "rsv", - "bit_len" : "8", + "bit_len" : "4", "description" : "Reserved bits" - } + } } }, "trigger" : { "address" : "6", "type" : "r", - "width" : "6", + "width" : "12", "reset" : "0", "description" : "Trigger input vector value" }, @@ -230,45 +230,45 @@ "reset" : "0", "description" : "Step request from CPU" }, - "aux_config" : { + "aux_config" : { "address" : "10", - "width" : "6", + "width" : "6", "description" : "Aux Configuration values for sequencer", "fields": { "ADD_VEC_PIPE" : { "type" : "r", "bit_len" : "1", - "reset" : "0", + "reset" : "0", "description" : "Add 1 level of pipeline on vector_out" }, "VECT_RAMP_EN" : { "type" : "r", "bit_len" : "1", - "reset" : "0", + "reset" : "0", "description" : "Enable support for VEC_RAMP_UP/DN instructions" }, "BUS_BURST_EN" : { "type" : "r", "bit_len" : "1", - "reset" : "0", + "reset" : "0", "description" : "Enable support for BUS_BURST instructions" }, "POS_BUS_EN" : { "type" : "r", "bit_len" : "1", - "reset" : "0", + "reset" : "0", "description" : "Enable support for POS input bus" }, "ALU_EN" : { "type" : "r", "bit_len" : "1", - "reset" : "0", + "reset" : "0", "description" : "Enable support for ALU instruction" }, - "QUEUE_EN" : { + "QUEUE_EN" : { "type" : "r", "bit_len" : "1", - "reset" : "0", + "reset" : "0", "description" : "Enable support for End-and-Queue instruction" } } @@ -278,39 +278,39 @@ "type" : "r", "width" : "24", "reset" : "0", - "subtype" : "signed", + "subtype" : "signed", "description" : "value of pos_store" }, - "seq_queue_w" : { + "seq_queue_w" : { "address" : "12", "width" : "8", "type" : "wp", - "reset" : "0", + "reset" : "0", "description" : "Sequence Execution Queue write" }, - "seq_queue_r" : { + "seq_queue_r" : { "address" : "13", "width" : "32", "description" : "Sequence Execution Queue read bits", - "fields": { + "fields": { "reserved_0" : { "type" : "rsv", "bit_len" : "8", "description" : "Reserved bits" }, - "queue_left" : { + "queue_left" : { "type" : "r", "bit_len" : "8", - "reset" : "0", + "reset" : "0", "description" : "Number of sequences currently in the queue" }, - "queue_exec" : { + "queue_exec" : { "type" : "r", "bit_len" : "16", - "reset" : "0", + "reset" : "0", "description" : "Number of sequences executed" } - } + } } } }, diff --git a/generic_ip/generic_sequencer/18/sim/run_sim.py b/generic_ip/generic_sequencer/18/sim/run_sim.py index 5ae816a..491b35d 100644 --- a/generic_ip/generic_sequencer/18/sim/run_sim.py +++ b/generic_ip/generic_sequencer/18/sim/run_sim.py @@ -86,7 +86,7 @@ def run_msim_script(sim_job, cmd_line_mode = 1): log_file = "./{0}.log".format(sim_job) - vsim_cmd = os.environ['QUARTUS_ROOTDIR']+"\\..\\modelsim_ae\\win32aloem\\vsim" + vsim_cmd = os.environ['QUARTUS_ROOTDIR']+"\\..\\modelsim_ae\\win32aloem\\vsim.exe" if os.path.isfile(vsim_cmd) == False: print("ERROR: Cannot find vsim file " + vsim_cmd) diff --git a/generic_ip/generic_sequencer/18/sim/sim_gen_seq.do b/generic_ip/generic_sequencer/18/sim/sim_gen_seq.do index 35ec34e..6649248 100644 --- a/generic_ip/generic_sequencer/18/sim/sim_gen_seq.do +++ b/generic_ip/generic_sequencer/18/sim/sim_gen_seq.do @@ -22,10 +22,10 @@ vcom -2008 -work $WORKLIB $COMMON_PATH/src/common_pkg.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/src/altera/alt_rw_dp_ram.vhd #vcom -2008 -work $WORKLIB ../src/dpram_sclk_16.vhd #vcom -2008 -work $WORKLIB ../src/altera/generic_seq_ram_16.vhd -vcom -2008 -work $WORKLIB ../src/generic_sequencer_17_cmd_pkg.vhd -vcom -2008 -work $WORKLIB ../src/generic_sequencer_17_pkg_auto.vhd -vcom -2008 -work $WORKLIB ../src/generic_sequencer_17_csr_regs_auto.vhd -vcom -2008 -work $WORKLIB ../src/generic_sequencer_17.vhd +vcom -2008 -work $WORKLIB ../src/generic_sequencer_18_cmd_pkg.vhd +vcom -2008 -work $WORKLIB ../src/generic_sequencer_18_pkg_auto.vhd +vcom -2008 -work $WORKLIB ../src/generic_sequencer_18_csr_regs_auto.vhd +vcom -2008 -work $WORKLIB ../src/generic_sequencer_18.vhd # Compile the constrained random related packages vlib OSVVM @@ -43,13 +43,13 @@ vcom -2008 -work $WORKLIB $COMMON_PATH/src/test/log_pkg.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/src/test/avalon_verify_pkg.vhd # Compile the testbench -vcom -2008 -work $WORKLIB ./../src/test/generic_sequencer_17_tb.vhd +vcom -2008 -work $WORKLIB ./../src/test/generic_sequencer_18_tb.vhd -vsim -t ps work.generic_sequencer_17_tb +vsim -t ps work.generic_sequencer_18_tb -#add wave /generic_sequencer_17_tb/* -#add wave /generic_sequencer_17_tb/iUUT/* +#add wave /generic_sequencer_18_tb/* +#add wave /generic_sequencer_18_tb/iUUT/* # remove warnings from standard numeric/arithmetic packages (speed-up simulation) set StdArithNoWarnings 1 diff --git a/generic_ip/generic_sequencer/18/src/generic_sequencer_18.vhd b/generic_ip/generic_sequencer/18/src/generic_sequencer_18.vhd index 64e8ad1..d08f54c 100644 --- a/generic_ip/generic_sequencer/18/src/generic_sequencer_18.vhd +++ b/generic_ip/generic_sequencer/18/src/generic_sequencer_18.vhd @@ -109,7 +109,7 @@ architecture rtl of generic_sequencer_18 is signal operand_comp : std_logic_vector(23 downto 0); signal opcode : std_logic_vector(3 downto 0); signal subcode : std_logic_vector(3 downto 0); - signal jump_addr_ext : std_logic_vector(11 downto 0); + signal jump_addr_ext : std_logic_vector(11 downto 0); -- FIXME hardcoded to 12 bits to match operand_1 and r1 but will be truncated if needed to match ram_rd_addr. This fails if ram_rd_addr is too long! signal jump_addr : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0); signal pc_value : std_logic_vector(log2(SEQ_DEPTH) - 1 downto 0); @@ -191,7 +191,7 @@ begin -- Control & Status Registers ----------------------------------------------------------------------------- - generic_sequencer_17_csr_regs_i : entity work.generic_sequencer_17_csr_regs + generic_sequencer_18_csr_regs_i : entity work.generic_sequencer_18_csr_regs generic map( ADDR_DECODE_WIDTH => 4 ) @@ -629,8 +629,11 @@ begin op_cnt_done <= '1' when op_cnt = operand_1 else '0'; + -- FIXME ram_rd_addr needs to be extended to allow for negative jumps and question over size of signed operand_1 + -- Need to put the bit extension back into ram_rd_addr + -- consider reducing the maximum ram_rd_addr width so that operand_1 can cover the whole range. jump_addr_ext <= operand_1 when jump_abs = '1' else - std_logic_vector(signed('0' & ram_rd_addr) + signed(operand_1) - 1) when jump_rel = '1' else + std_logic_vector(signed(ram_rd_addr) + signed(operand_1) - 1) when jump_rel = '1' else r1; jump_addr <= jump_addr_ext(jump_addr'range); diff --git a/generic_ip/generic_sequencer/18/src/test/generic_sequencer_18_tb.vhd b/generic_ip/generic_sequencer/18/src/test/generic_sequencer_18_tb.vhd index 0000f40..6c64ffa 100644 --- a/generic_ip/generic_sequencer/18/src/test/generic_sequencer_18_tb.vhd +++ b/generic_ip/generic_sequencer/18/src/test/generic_sequencer_18_tb.vhd @@ -19,7 +19,7 @@ architecture behav of generic_sequencer_18_tb is constant RAMP_WIDTH : natural range 1 to 16 := 14; constant BUS_WIDTH : natural range 1 to 32 := 32; constant POS_WIDTH : natural range 1 to 24 := 24; - constant SEQ_DEPTH : natural range 256 to 4096 := 512; + constant SEQ_DEPTH : natural range 256 to 4096 := 4096; constant ADD_VEC_PIPE : boolean := true; constant VECT_RAMP_EN : boolean := true; constant BUS_BURST_EN : boolean := true; @@ -28,7 +28,7 @@ architecture behav of generic_sequencer_18_tb is constant QUEUE_EN : boolean := true; constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF01"; - constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00001100"; + constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00001200"; -- decimal 18.00 constant CLK_PERIOD : time := 10 ns;