modified datapath
This commit is contained in:
parent
9a8b0f1e1f
commit
9664983050
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -180,6 +180,14 @@ begin
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
pr_sm : process (reset, clk)
|
pr_sm : process (reset, clk)
|
||||||
-- TODO: those bitwidth are not correct, we could optimize it later and find out how many bits each variable should be. But for now just make it big
|
-- TODO: those bitwidth are not correct, we could optimize it later and find out how many bits each variable should be. But for now just make it big
|
||||||
|
variable v_flattop : std_logic_vector(C_BITS_ADDR_TOP - 1 downto 0); -- wait times (flat_top), managed by an internal counter process sm_top_counter unter state S_WAVE_TOP
|
||||||
|
variable v_addr_length : std_logic_vector(C_BITS_ADDR_LENGTH - 1 downto 0); -- number of points/addresses used by the pulse edge, the bit width should increase with the amount of addresses the wavetable has
|
||||||
|
variable v_addr_start : std_logic_vector(C_BITS_ADDR_START - 1 downto 0); -- start address of the pulse edge data in the Waveform RAM, the bit width should increase with the amount of address the wavetable has.
|
||||||
|
variable v_addr_end : std_logic_vector(C_BITS_ADDR_START - 1 downto 0); -- end address of the pulse edge data in the Waveform RAM, the bit width should align with the bit width of v_addr_start
|
||||||
|
variable v_amplitude_factor : std_logic_vector(C_BITS_GAIN_FACTOR - 1 downto 0); -- pulse edge amplitude scale factor
|
||||||
|
variable v_time_factor : std_logic_vector(C_BITS_TIME_FACTOR - 1 downto 0); -- pulse edge time scale factor
|
||||||
|
variable v_cnt_time : std_logic_vector(23 downto 0); -- counter for the time, the bit width should increase with the amount of addresses the wavetable has
|
||||||
|
|
||||||
variable v_ram_waveform_addrb : unsigned(95 downto 0);
|
variable v_ram_waveform_addrb : unsigned(95 downto 0);
|
||||||
begin
|
begin
|
||||||
if (reset = '1') then
|
if (reset = '1') then
|
||||||
|
@ -203,6 +211,15 @@ begin
|
||||||
sm_wavedata <= (others=>'0');
|
sm_wavedata <= (others=>'0');
|
||||||
sm_wavedata_dv <= '0';
|
sm_wavedata_dv <= '0';
|
||||||
|
|
||||||
|
-- Actively read pulse definition RAM and update the variables
|
||||||
|
v_flattop := ram_pulse_doutb(C_BITS_ADDR_TOP - 1 downto 0);
|
||||||
|
v_addr_length := ram_pulse_doutb(C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP - 1 downto C_BITS_ADDR_TOP);
|
||||||
|
v_addr_start := ram_pulse_doutb(C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP - 1 downto C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP);
|
||||||
|
v_addr_end := std_logic_vector(unsigned(v_addr_start) + unsigned(v_addr_length) - 1);
|
||||||
|
v_amplitude_factor := ram_pulse_doutb(C_BITS_GAIN_FACTOR + C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP - 1 downto C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP);
|
||||||
|
v_time_factor := ram_pulse_doutb(C_BITS_TIME_FACTOR + C_BITS_GAIN_FACTOR + C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP - 1 downto C_BITS_GAIN_FACTOR + C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP);
|
||||||
|
v_cnt_time := ram_pulse_doutb(24 + C_BITS_TIME_FACTOR + C_BITS_GAIN_FACTOR + C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP - 1 downto C_BITS_TIME_FACTOR + C_BITS_GAIN_FACTOR + C_BITS_ADDR_START + C_BITS_ADDR_LENGTH + C_BITS_ADDR_TOP);
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Main state machine
|
-- Main state machine
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
@ -246,10 +263,10 @@ begin
|
||||||
when S_WAIT =>
|
when S_WAIT =>
|
||||||
|
|
||||||
-- Start to output wave and increment pulse position RAM address
|
-- Start to output wave and increment pulse position RAM address
|
||||||
if (ram_pulse_doutb(93 downto C_BITS_TIME_FACTOR) = cnt_time) then
|
if (v_cnt_time = cnt_time) then
|
||||||
sm_state <= S_WAVE_UP;
|
sm_state <= S_WAVE_UP;
|
||||||
-- set the wavetable's address to the starting address defined from the pulse ram
|
-- set the wavetable's address to the starting address defined from the pulse ram
|
||||||
ram_waveform_addrb <= ram_pulse_doutb(C_BITS_GAIN_FACTOR - 1 downto C_BITS_ADDR_START);
|
ram_waveform_addrb <= v_addr_start;
|
||||||
elsif (cnt_time = X"FFFFFF") then
|
elsif (cnt_time = X"FFFFFF") then
|
||||||
sm_state <= S_IDLE;
|
sm_state <= S_IDLE;
|
||||||
end if;
|
end if;
|
||||||
|
@ -261,46 +278,51 @@ begin
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
when S_WAVE_UP =>
|
when S_WAVE_UP =>
|
||||||
-- Check if is end of rise of the waveform, and hold the address
|
-- Check if is end of rise of the waveform, and hold the address
|
||||||
if (ram_waveform_addrb = std_logic_vector(unsigned(ram_pulse_doutb(C_BITS_GAIN_FACTOR - 1 downto C_BITS_ADDR_START)) + unsigned(ram_pulse_doutb(C_BITS_ADDR_START - 1 downto C_BITS_ADDR_LENGTH)))) then
|
if (ram_waveform_addrb = v_addr_end) then
|
||||||
sm_state <= S_WAVE_FLAT;
|
sm_state <= S_WAVE_FLAT;
|
||||||
-- initialize the counter for the flat top of the waveform
|
-- initialize the counter for the flat top of the waveform
|
||||||
cnt_wave_top <= std_logic_vector(to_unsigned(0, C_BITS_ADDR_TOP));
|
cnt_wave_top <= std_logic_vector(to_unsigned(0, C_BITS_ADDR_TOP));
|
||||||
else
|
else
|
||||||
-- Output waveform from RAM with rounded gain factor
|
-- Output waveform from RAM , and increment the address
|
||||||
v_ram_waveform_addrb := ((unsigned(ram_waveform_addrb) + 1) * unsigned(ram_pulse_doutb(C_BITS_TIME_FACTOR - 1 downto C_BITS_GAIN_FACTOR)));
|
-- TODO: apply scaling factor to the address and then to the output
|
||||||
ram_waveform_addrb <= std_logic_vector(v_ram_waveform_addrb(C_BITS_TIME_INT downto C_BITS_TIME_FRAC));
|
ram_waveform_addrb <= std_logic_vector(unsigned(ram_waveform_addrb) + 1);
|
||||||
sm_wavedata <= ram_waveform_doutb;
|
sm_wavedata <= ram_waveform_doutb;
|
||||||
sm_wavedata_dv <= '1';
|
sm_wavedata_dv <= '1';
|
||||||
|
|
||||||
end if;
|
end if;
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Hold the last address and output its data
|
||||||
|
-- decrement from this address when finished waiting
|
||||||
|
------------------------------------------------------------------------
|
||||||
when S_WAVE_FLAT =>
|
when S_WAVE_FLAT =>
|
||||||
if (cnt_wave_top = ram_pulse_doutb(C_BITS_ADDR_TOP - 1 downto 0)) then
|
if (cnt_wave_top = v_flattop) then
|
||||||
sm_state <= S_WAVE_DOWN;
|
sm_state <= S_WAVE_DOWN;
|
||||||
else
|
else
|
||||||
cnt_wave_top <= std_logic_vector(unsigned(cnt_wave_top) + 1);
|
cnt_wave_top <= std_logic_vector(unsigned(cnt_wave_top) + 1);
|
||||||
sm_wavedata <= ram_waveform_doutb;
|
sm_wavedata <= ram_waveform_doutb;
|
||||||
sm_wavedata_dv <= '1';
|
sm_wavedata_dv <= '1';
|
||||||
end if;
|
end if;
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Output the falling edge of a waveform
|
||||||
|
-- Hold the start address when complete
|
||||||
|
------------------------------------------------------------------------
|
||||||
when S_WAVE_DOWN =>
|
when S_WAVE_DOWN =>
|
||||||
-- End of waveform?
|
-- End of waveform?
|
||||||
if (ram_waveform_addrb = std_logic_vector(to_unsigned(C_LENGTH_WAVEFORM-1,10))) then
|
if (ram_waveform_addrb = v_addr_start) then
|
||||||
|
|
||||||
-- If the end of the pulse table is reached then go to idle
|
-- If the end of the pulse table is reached then go to idle
|
||||||
if (ram_pulse_addrb = std_logic_vector(to_unsigned(C_NUM_PULSE-1,10))) then
|
if (ram_pulse_addrb = std_logic_vector(to_unsigned(C_NUM_PULSE-1,4))) then
|
||||||
ram_pulse_addrb <= (others=>'0');
|
ram_pulse_addrb <= (others=>'0');
|
||||||
sm_state <= S_IDLE;
|
sm_state <= S_IDLE;
|
||||||
|
|
||||||
else -- Increment pulse address. Wait for next pulse start time
|
else -- increment pulse address for the next waveform
|
||||||
ram_pulse_addrb <= std_logic_vector(unsigned(ram_pulse_addrb) + 1);
|
ram_pulse_addrb <= std_logic_vector(unsigned(ram_pulse_addrb) + 1);
|
||||||
sm_state <= S_WAIT;
|
sm_state <= S_WAIT;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- Output waveform from RAM with decremented address
|
-- Output waveform from RAM with decremented address
|
||||||
else
|
else
|
||||||
v_ram_waveform_addrb := (unsigned(ram_waveform_addrb) - 1) * unsigned(ram_pulse_doutb(C_BITS_TIME_FACTOR - 1 downto C_BITS_GAIN_FACTOR));
|
ram_waveform_addrb <= std_logic_vector(unsigned(ram_waveform_addrb) - 1);
|
||||||
ram_waveform_addrb <= std_logic_vector(v_ram_waveform_addrb(C_BITS_TIME_INT downto C_BITS_TIME_FRAC));
|
|
||||||
sm_wavedata <= ram_waveform_doutb;
|
sm_wavedata <= ram_waveform_doutb;
|
||||||
sm_wavedata_dv <= '1';
|
sm_wavedata_dv <= '1';
|
||||||
end if;
|
end if;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
vlib work
|
vlib work
|
||||||
|
|
||||||
proc recursive_glob {dir} {
|
# proc recursive_glob {dir} {
|
||||||
set files [glob -nocomplain -type f -directory $dir *_sim_netlist.vhdl]
|
# set files [glob -nocomplain -type f -directory $dir *_sim_netlist.vhdl]
|
||||||
foreach subdir [glob -nocomplain -type d -directory $dir *] {
|
# foreach subdir [glob -nocomplain -type d -directory $dir *] {
|
||||||
lappend files {*}[recursive_glob $subdir]
|
# lappend files {*}[recursive_glob $subdir]
|
||||||
}
|
# }
|
||||||
return $files
|
# return $files
|
||||||
}
|
# }
|
||||||
|
|
||||||
set src_dir ../../prj/zcu_pulse_channel.gen
|
# set src_dir ../../prj/zcu_pulse_channel.gen
|
||||||
set files [recursive_glob $src_dir]
|
# set files [recursive_glob $src_dir]
|
||||||
|
|
||||||
foreach file $files {
|
# foreach file $files {
|
||||||
file copy -force $file ../../src/hdl/ip_gen
|
# file copy -force $file ../../src/hdl/ip_gen
|
||||||
}
|
# }
|
||||||
|
|
||||||
vcom ../../src/hdl/ip_gen/*.vhd*
|
vcom ../../src/hdl/ip_gen/*.vhd*
|
||||||
vcom ../../src/hdl/pkg/*pkg.vhd
|
vcom ../../src/hdl/pkg/*pkg.vhd
|
||||||
|
|
|
@ -336,12 +336,12 @@
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"ASSOCIATED_BUSIF": [ { "value": "AXI_SLAVE_S_AXI:AXILite_SLAVE_S_AXI", "value_src": "constant", "usage": "all" } ],
|
"ASSOCIATED_BUSIF": [ { "value": "AXI_SLAVE_S_AXI:AXILite_SLAVE_S_AXI", "value_src": "constant", "usage": "all" } ],
|
||||||
"ASSOCIATED_RESET": [ { "value": "s_aresetn", "value_src": "constant", "usage": "all" } ],
|
"ASSOCIATED_RESET": [ { "value": "s_aresetn", "value_src": "constant", "usage": "all" } ],
|
||||||
"FREQ_HZ": [ { "value": "100000000", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ],
|
"FREQ_HZ": [ { "value": "100000000", "resolve_type": "generated", "format": "long", "is_static_object": false } ],
|
||||||
"FREQ_TOLERANCE_HZ": [ { "value": "0", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ],
|
"FREQ_TOLERANCE_HZ": [ { "value": "0", "resolve_type": "generated", "format": "long", "is_static_object": false } ],
|
||||||
"PHASE": [ { "value": "0.0", "resolve_type": "generated", "format": "float", "is_ips_inferred": true, "is_static_object": false } ],
|
"PHASE": [ { "value": "0.0", "resolve_type": "generated", "format": "float", "is_static_object": false } ],
|
||||||
"CLK_DOMAIN": [ { "value": "", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"CLK_DOMAIN": [ { "value": "", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"ASSOCIATED_PORT": [ { "value": "", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"ASSOCIATED_PORT": [ { "value": "", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"INSERT_VIP": [ { "value": "0", "resolve_type": "user", "format": "long", "usage": "simulation.rtl", "is_ips_inferred": true, "is_static_object": false } ]
|
"INSERT_VIP": [ { "value": "0", "resolve_type": "user", "format": "long", "usage": "simulation.rtl", "is_static_object": false } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"RST.ARESETN": {
|
"RST.ARESETN": {
|
||||||
|
@ -350,7 +350,7 @@
|
||||||
"mode": "slave",
|
"mode": "slave",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"POLARITY": [ { "value": "ACTIVE_LOW", "value_src": "constant", "usage": "all" } ],
|
"POLARITY": [ { "value": "ACTIVE_LOW", "value_src": "constant", "usage": "all" } ],
|
||||||
"INSERT_VIP": [ { "value": "0", "resolve_type": "user", "format": "long", "usage": "simulation.rtl", "is_ips_inferred": true, "is_static_object": false } ]
|
"INSERT_VIP": [ { "value": "0", "resolve_type": "user", "format": "long", "usage": "simulation.rtl", "is_static_object": false } ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"BRAM_PORTA": {
|
"BRAM_PORTA": {
|
||||||
|
@ -358,12 +358,12 @@
|
||||||
"abstraction_type": "xilinx.com:interface:bram_rtl:1.0",
|
"abstraction_type": "xilinx.com:interface:bram_rtl:1.0",
|
||||||
"mode": "slave",
|
"mode": "slave",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"MEM_SIZE": [ { "value": "8192", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ],
|
"MEM_SIZE": [ { "value": "8192", "resolve_type": "generated", "format": "long", "is_static_object": false } ],
|
||||||
"MEM_WIDTH": [ { "value": "32", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ],
|
"MEM_WIDTH": [ { "value": "32", "resolve_type": "generated", "format": "long", "is_static_object": false } ],
|
||||||
"MEM_ECC": [ { "value": "NONE", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"MEM_ECC": [ { "value": "NONE", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"MASTER_TYPE": [ { "value": "OTHER", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"MASTER_TYPE": [ { "value": "OTHER", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"READ_WRITE_MODE": [ { "value": "", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"READ_WRITE_MODE": [ { "value": "", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"READ_LATENCY": [ { "value": "1", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ]
|
"READ_LATENCY": [ { "value": "1", "resolve_type": "generated", "format": "long", "is_static_object": false } ]
|
||||||
},
|
},
|
||||||
"port_maps": {
|
"port_maps": {
|
||||||
"ADDR": [ { "physical_name": "addra" } ],
|
"ADDR": [ { "physical_name": "addra" } ],
|
||||||
|
@ -379,12 +379,12 @@
|
||||||
"abstraction_type": "xilinx.com:interface:bram_rtl:1.0",
|
"abstraction_type": "xilinx.com:interface:bram_rtl:1.0",
|
||||||
"mode": "slave",
|
"mode": "slave",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"MEM_SIZE": [ { "value": "8192", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ],
|
"MEM_SIZE": [ { "value": "8192", "resolve_type": "generated", "format": "long", "is_static_object": false } ],
|
||||||
"MEM_WIDTH": [ { "value": "32", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ],
|
"MEM_WIDTH": [ { "value": "32", "resolve_type": "generated", "format": "long", "is_static_object": false } ],
|
||||||
"MEM_ECC": [ { "value": "NONE", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"MEM_ECC": [ { "value": "NONE", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"MASTER_TYPE": [ { "value": "OTHER", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"MASTER_TYPE": [ { "value": "OTHER", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"READ_WRITE_MODE": [ { "value": "", "resolve_type": "generated", "is_ips_inferred": true, "is_static_object": false } ],
|
"READ_WRITE_MODE": [ { "value": "", "resolve_type": "generated", "is_static_object": false } ],
|
||||||
"READ_LATENCY": [ { "value": "1", "resolve_type": "generated", "format": "long", "is_ips_inferred": true, "is_static_object": false } ]
|
"READ_LATENCY": [ { "value": "1", "resolve_type": "generated", "format": "long", "is_static_object": false } ]
|
||||||
},
|
},
|
||||||
"port_maps": {
|
"port_maps": {
|
||||||
"ADDR": [ { "physical_name": "addrb" } ],
|
"ADDR": [ { "physical_name": "addrb" } ],
|
||||||
|
|
Loading…
Reference in New Issue