📄 mult_proc.v
字号:
`define ck begin @(posedge clk); if (reset) disable reset_loop; endmodule mult_proc(clk, reset, start, threshold, use_thresh_offset, cell_out, cell_out_valid, busy, done);input clk, reset, start, use_thresh_offset;input [7:0]threshold;output [15:0] cell_out;output cell_out_valid, done, busy;reg out, cell_out_valid, done, busy, cell_out_valid;reg [15:0] cell_out;reg [6:0] i;always begin : reset_loop /* synopsys resource BS0: dont_unroll = "read_write_loop"; */ /* synopsys resource RAM_A: variables = "cell", map_to_module = "cs_rr100x50"; */ reg [15:0] cell[199:0]; reg [7:0] cell1; reg [7:0] cell2; reg [15:0] cell_offset; reg [7:0] thresh1; reg [7:0] thresh2; reg [15:0] thresh_offset; reg [15:0] cell_value; done <= 0; busy <= 0; cell_out <= 0; cell_out_valid <= 0; `ck forever begin : operational_loop while (!start) begin : start_loop `ck end // start_loop `ck thresh1 = threshold; // synopsys line_label thresh1 busy <= 1; `ck thresh2 = threshold; // synopsys line_label thresh2 thresh_offset = calc_offset(thresh1, thresh2); `ck `ck for (i=0 ; i < 100 ; i = i + 2) begin : read_write_loop cell1 = cell[i]; // synopsys line_label mem_read1 `ck cell2 = cell[i+1]; // synopsys line_label mem_read2 `ck cell_offset = calc_offset(cell1, cell2); `ck `ck `ck if (use_thresh_offset) cell_value = cell_offset + thresh_offset; else cell_value = cell_offset; `ck `ck `ck cell[i+100] = cell_value; // synopsys line_label mem_write cell_out <= cell_value; cell_out_valid <= 1; `ck cell_out_valid <= 0; // synopsys line_label valid0 end // read_write_loop `ck done <= 1; // synopsys line_label assert_done busy <= 0; `ck done <= 0; `ck end // operational_loop end // reset_loop function [15:0] calc_offset; input [7:0] a,b; begin calc_offset = (a * b) + 1; end endfunctionendmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -