Skip to content

Commit

Permalink
cmoc: recover a possibly working cryomodule_badger_tb
Browse files Browse the repository at this point in the history
  • Loading branch information
ldoolitt committed Aug 31, 2024
1 parent 0689723 commit 58893b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 8 additions & 1 deletion cmoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include ../dir_list.mk

vpath %.v $(RTSIM_DIR) $(DSP_DIR) $(DSP_DIR)/hosted $(BADGER_DIR)
vpath %.c ../badger/tests

.PHONY: all
all: targets
Expand Down Expand Up @@ -56,7 +57,12 @@ $(AUTOGEN_DIR)/config_romx.v:

VFLAGS_DEP += -y $(BADGER_DIR)

cryomodule_badger_tb.v: $(RTEFI_V) $(AUTOGEN_DIR)/config_romx.v cordicg_b22.v cryomodule_auto
VFLAGS_cryomodule_badger_tb = -m ./tap-vpi

cryomodule_badger_tb: $(RTEFI_V) $(AUTOGEN_DIR)/config_romx.v cordicg_b22.v cryomodule_auto tap-vpi.vpi

CFLAGS_tap-vpi.o = $(VPI_CFLAGS) -D_POSIX_C_SOURCE=200809L
tap-vpi.vpi: ethernet_model.o tap_alloc.o crc32.o

CLEAN += $(RTEFI_CLEAN)

Expand All @@ -82,6 +88,7 @@ endif
# endif

CLEAN += $(TGT_) $(CHK_) *.bit *.in *.vcd
CLEAN += *.o tap-vpi.vpi
CLEAN += fdbk_core*.dat lim_step_file_in.dat setmp_step_file_in.dat cryomodule_in.dat cryomodule_p.dat cryomodule.dat $(RTEFI_CLEAN)
CLEAN_DIRS += _xilinx
include $(BUILD_DIR)/bottom_rules.mk
6 changes: 4 additions & 2 deletions cmoc/cryomodule_badger.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module cryomodule_badger (
// Ethernet configuration port
input eth_cfg_clk,
input [9:0] eth_cfg_set,
output [7:0] eth_status
output [7:0] eth_status,
output thinking
);

parameter ip ={8'd192, 8'd168, 8'd7, 8'd4};
Expand Down Expand Up @@ -58,10 +59,11 @@ rtefi_blob #(.ip(ip), .mac(mac)) badger(
.p3_control_rd(rtefi_lb_control_rd),
.p3_control_rd_valid(rtefi_lb_control_rd_valid),
.p3_data_out(rtefi_lb_data_out),
.p3_data_in(rtefi_lb_data_in)
.p3_data_in(rtefi_lb_data_in),
// // Dumb stuff to get LEDs blinking
// output rx_mon,
// output tx_mon,
.in_use(thinking)
);


Expand Down
5 changes: 3 additions & 2 deletions cmoc/cryomodule_badger_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module cryomodule_badger_tb;

// based mostly on aggregate_tb.v
parameter [31:0] ip = 32'd3232237316; // 192.168.7.4
parameter [31:0] ip = {8'd192, 8'd168, 8'd7, 8'd4}; // 192.168.7.4
parameter [47:0] mac = 48'h112233445566;

// Buffer memory to hold a packet read from a file
Expand Down Expand Up @@ -40,6 +40,7 @@ reg [7:0] eth_in=0, eth_in_=0;
reg eth_in_s=0, eth_in_s_=0;
wire [7:0] eth_out;
wire eth_out_s;
wire thinking; // hook to make things run efficiently

reg eth_out_s1=0, ok_to_print=1;
integer ci;
Expand All @@ -48,7 +49,7 @@ always @(posedge clk) begin
ci = cc % (data_len+150);
if (use_tap) begin
// Access to Linux tap interface, see tap-vpi.c
if (cc > 4) $tap_io(eth_out, eth_out_s, eth_in_, eth_in_s_);
if (cc > 4) $tap_io(eth_out, eth_out_s, eth_in_, eth_in_s_, thinking);
eth_in <= eth_in_;
eth_in_s <= eth_in_s_;
end else if ((ci>=100) & (ci<(100+data_len))) begin
Expand Down

0 comments on commit 58893b3

Please sign in to comment.