Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 'keep' boolean attribute #154

Closed
anfractuosity opened this issue Aug 26, 2021 · 1 comment
Closed

Support for 'keep' boolean attribute #154

anfractuosity opened this issue Aug 26, 2021 · 1 comment

Comments

@anfractuosity
Copy link

Hi,

I'm just wondering if it would be possible to pass the keep attribute to yosys so that the following kind of use of it would work:

architecture blink of leds is

signal clk_4hz: std_logic := '0';
constant gates: integer := 3 - 1;
signal max: integer := 3e6;
signal A: std_logic_vector(0 to gates) := ( others => '0');

attribute keep: boolean;
attribute keep of A: signal is true;  

signal B: std_logic := '1';
signal C: std_logic := '1';
signal val: std_logic := '0';
signal data: std_logic := '0';

begin 
  process (clk)
    variable counter : unsigned (23 downto 0) := (others => '0');
  begin
    if rising_edge(clk) then
      if counter >= max then
        counter := x"000000";
        clk_4hz <= not clk_4hz;
      else
        counter := counter + 1;
      end if;
    end if;
  end process;

GEN:
    for i in 0 to gates generate
        A(i) <= not A(gates - i);    
    end generate GEN;

  led2 <= clk_4hz;
  led3 <= clk_4hz;
  led4 <= clk_4hz;
  led5 <= clk_4hz;
end;

Many thanks!

@tgingold
Copy link
Member

So keep is currently handled in the front-end, but not always propagated to yosys. Still WIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants