@ -22,14 +22,19 @@ architecture behaviour of cr_file is
begin
begin
cr_create_0: process(all)
cr_create_0: process(all)
variable hi, lo : integer := 0;
variable hi, lo : integer := 0;
variable cr_tmp : std_ulogic_vector(31 downto 0) := (others => '0');
begin
begin
cr_tmp := crs;
for i in 0 to 7 loop
for i in 0 to 7 loop
if w_in.write_cr_mask(i) = '1' then
if w_in.write_cr_mask(i) = '1' then
lo := i*4;
lo := i*4;
hi := lo + 3;
hi := lo + 3;
crs_updated(hi downto lo) <= w_in.write_cr_data(hi downto lo);
cr_tmp(hi downto lo) := w_in.write_cr_data(hi downto lo);
end if;
end if;
end loop;
end loop;
crs_updated <= cr_tmp;
end process;
end process;
-- synchronous writes
-- synchronous writes
@ -38,23 +43,18 @@ begin
if rising_edge(clk) then
if rising_edge(clk) then
if w_in.write_cr_enable = '1' then
if w_in.write_cr_enable = '1' then
report "Writing " & to_hstring(w_in.write_cr_data) & " to CR mask " & to_hstring(w_in.write_cr_mask);
report "Writing " & to_hstring(w_in.write_cr_data) & " to CR mask " & to_hstring(w_in.write_cr_mask);
crs <= crs_updated;
end if;
end if;
crs <= crs_updated;
end if;
end if;
end process;
end process;
-- asynchronous reads
-- asynchronous reads
cr_read_0: process(all)
cr_read_0: process(all)
variable hi, lo : integer := 0;
begin
begin
-- just return the entire CR to make mfcrf easier for now
-- just return the entire CR to make mfcrf easier for now
if d_in.read = '1' then
if d_in.read = '1' then
report "Reading CR " & to_hstring(crs_updated);
report "Reading CR " & to_hstring(crs_updated);
end if;
end if;
if w_in.write_cr_enable then
d_out.read_cr_data <= crs;
d_out.read_cr_data <= crs_updated;
else
d_out.read_cr_data <= crs;
end if;
end process;
end process;
end architecture behaviour;
end architecture behaviour;