📄 logan.vhd
字号:
when "1100" => rdata := mask(159 downto 128); when "1101" => rdata := mask(191 downto 160); when "1110" => rdata := mask(223 downto 192); when "1111" => rdata := mask(255 downto 224); when others => rdata := (others => '0'); end case; -- count/eq elsif apbi.paddr(14 downto 13) = "01" then tl := conv_integer(apbi.paddr(7 downto 2)); rdata(6 downto 1) := v.trig_conf(tl).count; rdata(0) := v.trig_conf(tl).eq; -- status elsif apbi.paddr(14 downto 13)&apbi.paddr(4 downto 2) = "00000" then rdata := conv_std_logic_vector(usereg,1) & conv_std_logic_vector(usequal,1) & r.armed & r.trigged & conv_std_logic_vector(dbits,8)& conv_std_logic_vector(depth-1,14)& conv_std_logic_vector(trigl,6); -- trace buffer index elsif apbi.paddr(14 downto 13)&apbi.paddr(4 downto 2) = "00001" then rdata(abits-1 downto 0) := tr.w_addr(abits-1 downto 0); -- page reg elsif apbi.paddr(14 downto 13)&apbi.paddr(4 downto 2) = "00010" then rdata(3 downto 0) := r.page; -- trigger counter elsif apbi.paddr(14 downto 13)&apbi.paddr(4 downto 2) = "00011" then rdata(abits-1 downto 0) := r.counter; -- divcount elsif apbi.paddr(14 downto 13)&apbi.paddr(4 downto 2) = "00100" then rdata(15 downto 0) := r.divcount; -- qualifier elsif apbi.paddr(14 downto 13)&apbi.paddr(4 downto 2) = "00101" then rdata(7 downto 0) := r.qualifier; rdata(8) := r.qual_val; end if; -- Read from trace buffer else -- address always r.page & apbi.paddr(14 downto 5) r_en <= '1'; -- Select word from pattern case apbi.paddr(4 downto 2) is when "000" => rdata := bufout(31 downto 0); when "001" => rdata := bufout(63 downto 32); when "010" => rdata := bufout(95 downto 64); when "011" => rdata := bufout(127 downto 96); when "100" => rdata := bufout(159 downto 128); when "101" => rdata := bufout(191 downto 160); when "110" => rdata := bufout(223 downto 192); when "111" => rdata := bufout(255 downto 224); when others => rdata := (others => '0'); end case; end if; end if; -- end read end if; if rstn = '0' then v.armed := '0'; v.trigged := '0'; v.finished := '0'; v.trig_demet := '0'; v.fin_demet := '0'; v.counter := (others => '0'); v.divcount := X"0001"; v.qualifier := (others => '0'); v.qual_val := '0'; v.page := (others => '0'); end if; apbo.prdata <= rdata; rin <= v; end process; -- Combinatorial process for trace clock domain comb2 : process (rstn, tr, r, sigreg) variable v : trace_reg_type; begin v := tr; v.sample := '0'; if tr.armed = '0' then v.trigged := '0'; v.counter := (others => '0'); end if; -- Synch arm signal v.arm_demet := r.armed; v.armed := tr.arm_demet; if tr.finished = '1' then v.finished := tr.armed; end if; -- Trigger -- if tr.armed = '1' and tr.finished = '0' then if tr.divcounter = X"0000" then v.divcounter := r.divcount-1; if usequal = 0 or sigreg(conv_integer(r.qualifier)) = r.qual_val then v.sample := '1'; end if; else v.divcounter := v.divcounter - 1; end if; if tr.sample = '1' then v.w_addr := tr.w_addr + 1; end if; if tr.trigged = '1' and tr.sample = '1' then if tr.counter = r.counter then v.trigged := '0'; v.sample := '0'; v.finished := '1'; v.counter := (others => '0'); else v.counter := tr.counter + 1; end if; else -- match? if ((sigreg xor r.trig_conf(tr.curr_tl).pattern) and r.trig_conf(tr.curr_tl).mask) = dz then -- trig on equal if r.trig_conf(tr.curr_tl).eq = '1' then if tr.match_count /= r.trig_conf(tr.curr_tl).count then v.match_count := tr.match_count + 1; else -- final match? if tr.curr_tl = trigl-1 then v.trigged := '1'; else v.curr_tl := tr.curr_tl + 1; end if; end if; end if; else -- not a match -- trig on inequal if r.trig_conf(tr.curr_tl).eq = '0' then if tr.match_count /= r.trig_conf(tr.curr_tl).count then v.match_count := tr.match_count + 1; else -- final match? if tr.curr_tl = trigl-1 then v.trigged := '1'; else v.curr_tl := tr.curr_tl + 1; end if; end if; end if; end if; end if; end if; -- end trigger if rstn = '0' then v.armed := '0'; v.trigged := '0'; v.sample := '0'; v.finished := '0'; v.arm_demet := '0'; v.curr_tl := 0; v.counter := (others => '0'); v.divcounter := (others => '0'); v.match_count := (others => '0'); v.w_addr := (others => '0'); end if; trin <= v; end process; -- clk traced signals through register to minimize fan out inreg: if usereg = 1 generate process (tclk) begin if rising_edge(tclk) then sigold <= sigreg; sigreg <= signals; end if; end process; end generate; noinreg: if usereg = 0 generate sigreg <= signals; sigold <= signals; end generate; -- Update registers reg: process(clk) begin if rising_edge(clk) then r <= rin; end if; end process; treg: process(tclk) begin if rising_edge(tclk) then tr <= trin; end if; end process; r_addr <= r.page & apbi.paddr(14 downto 5); trace_buf : syncram_2p generic map (tech => memtech, abits => abits, dbits => dbits) port map (clk, r_en, r_addr(abits-1 downto 0), bufout(dbits-1 downto 0), -- read tclk, tr.sample, tr.w_addr, sigold); -- write apbo.pconfig <= pconfig; apbo.pindex <= pindex; apbo.pirq <= (others => '0'); end architecture;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -