@@ -76,6 +76,7 @@ module chip_mocha_genesys2 #(
7676);
7777 // Local parameters
7878 localparam int unsigned InitialResetCycles = 4 ;
79+ localparam bit [31 : 0 ] FpgaHwId = 32'h0000_000A ; // FpgaGenesys2
7980
8081 // Rest of chip AXI crossbar configuration
8182 localparam axi_pkg :: xbar_cfg_t xbar_cfg = '{
@@ -97,7 +98,8 @@ module chip_mocha_genesys2 #(
9798 // Rest of chip AXI crossbar address mapping
9899 axi_pkg :: xbar_rule_64_t [xbar_cfg.NoAddrRules- 1 : 0 ] addr_map;
99100 assign addr_map = '{
100- '{ idx : top_pkg :: Ethernet, start_addr : top_pkg :: EthernetBase, end_addr : top_pkg :: EthernetBase + top_pkg :: EthernetLength }
101+ '{ idx : top_pkg :: SwDvWindowDevIdx, start_addr : top_pkg :: SwDvWindowBase, end_addr : top_pkg :: SwDvWindowBase + top_pkg :: SwDvWindowLength } ,
102+ '{ idx : top_pkg :: Ethernet, start_addr : top_pkg :: EthernetBase, end_addr : top_pkg :: EthernetBase + top_pkg :: EthernetLength }
101103 } ;
102104
103105 // Internal clock signals
@@ -155,6 +157,14 @@ module chip_mocha_genesys2 #(
155157 // Ethernet interrupt line
156158 logic ethernet_irq;
157159
160+ // SW-DV window AXI subordinate memory interface acting as a sink
161+ logic hw_id_mem_req;
162+ logic hw_id_mem_req_d;
163+ logic hw_id_mem_we;
164+ logic [top_pkg :: AxiAddrWidth- 1 : 0 ] hw_id_mem_addr;
165+ logic [top_pkg :: AxiDataWidth- 1 : 0 ] hw_id_mem_rdata;
166+ logic hw_id_sel_d;
167+
158168 // Clock generation
159169 clkgen_xil7series u_clk_gen (
160170 .clk_200m_i (clk_200m),
@@ -562,4 +572,44 @@ module chip_mocha_genesys2 #(
562572 .eth_rgmii_mdc_o (eth_mdc)
563573 );
564574
575+ // SW-DV window: read-only HW_ID register.
576+ // Uses the same axi_to_mem + 1-cycle loopback pattern as sim_sram_axi_sink.
577+ // Writes are accepted and discarded. Reads return FpgaHwId at offset +0x08, 0 elsewhere.
578+ axi_to_mem # (
579+ .axi_req_t (top_pkg :: axi_req_t ),
580+ .axi_resp_t (top_pkg :: axi_resp_t ),
581+ .DataWidth (top_pkg :: AxiDataWidth),
582+ .AddrWidth (top_pkg :: AxiAddrWidth),
583+ .IdWidth (top_pkg :: AxiIdWidth ),
584+ .NumBanks (1 )
585+ ) u_hw_id_axi_to_mem (
586+ .clk_i (u_top_chip_system.clkmgr_clocks.clk_main_infra ),
587+ .rst_ni (u_top_chip_system.rstmgr_resets.rst_main_n[rstmgr_pkg :: DomainMainSel]),
588+ .busy_o ( ),
589+ .axi_req_i (xbar_device_req [top_pkg :: SwDvWindowDevIdx] ),
590+ .axi_resp_o (xbar_device_resp[top_pkg :: SwDvWindowDevIdx] ),
591+ .mem_req_o (hw_id_mem_req ),
592+ .mem_gnt_i (1'b1 ),
593+ .mem_addr_o (hw_id_mem_addr ),
594+ .mem_wdata_o ( ), // Ignored: RO register
595+ .mem_strb_o ( ), // Ignored: RO register
596+ .mem_atop_o ( ), // Not used
597+ .mem_we_o (hw_id_mem_we ),
598+ .mem_rvalid_i (hw_id_mem_req_d ),
599+ .mem_rdata_i (hw_id_mem_rdata )
600+ );
601+
602+ always_ff @ (posedge u_top_chip_system.clkmgr_clocks.clk_main_infra
603+ or negedge u_top_chip_system.rstmgr_resets.rst_main_n[rstmgr_pkg :: DomainMainSel]) begin
604+ if (! u_top_chip_system.rstmgr_resets.rst_main_n[rstmgr_pkg :: DomainMainSel]) begin
605+ hw_id_mem_req_d <= 1'b0 ;
606+ hw_id_sel_d <= 1'b0 ;
607+ end else begin
608+ hw_id_mem_req_d <= hw_id_mem_req;
609+ hw_id_sel_d <= hw_id_mem_req && ! hw_id_mem_we && (hw_id_mem_addr[7 : 0 ] == 8'h08 );
610+ end
611+ end
612+
613+ assign hw_id_mem_rdata = hw_id_sel_d ? {{ (top_pkg :: AxiDataWidth- 32 ){ 1'b0 }} , FpgaHwId} : '0 ;
614+
565615endmodule
0 commit comments