提交 730dcd86 编写于 作者: 饶先宏's avatar 饶先宏

202105191152

上级 106935bf
......@@ -33,3 +33,5 @@
* counter.h
202105180851: rxh, initial version
*/
IHDL4SEUnit** hdl4seCreateMain(IHDL4SEModule** parent, char* instanceparam, char* name);
\ No newline at end of file
......@@ -74,20 +74,20 @@ static IHDL4SEUnit** hdl4seCreateDec2seg(IHDL4SEModule** parent, char* instancep
wire_const[i] = hdl4seCreateUnit(module_dec2seg, CLSID_HDL4SE_WIRE, "8", tempname);
sprintf(tempname, "const_cst%d", i);
unit_const[i] = hdl4seCreateUnit(module_dec2seg, CLSID_HDL4SE_CONST, constparam[i], tempname);
objectCall5(wire_const[i], Connect, 0, unit_const[i], 0, 0, 8);
objectCall3(wire_const[i], Connect, 0, unit_const[i], 0);
}
/* 生成数据选择器unit_mux */
unit_mux16 = hdl4seCreateUnit(module_dec2seg, CLSID_HDL4SE_MUX16, "8", "mux_dec");
/*mux的输入连接到输入端口dec和线网constall上*/
objectCall5(unit_mux16, Connect, 0, unit_dec2seg, 0, 0, 4);
objectCall3(unit_mux16, Connect, 0, unit_dec2seg, 0);
for (i = 0; i < 10; i++) {
objectCall5(unit_mux16, Connect, i+1, wire_const[i], 0, 0, 8);
objectCall3(unit_mux16, Connect, i+1, wire_const[i], 0);
}
for (; i < 16; i++) {
objectCall5(unit_mux16, Connect, i + 11, wire_const[10], 0, 0, 8);
objectCall3(unit_mux16, Connect, i + 11, wire_const[10], 0);
}
/* 译码模块的输出seg连接到数据先择器的输出*/
objectCall5(unit_dec2seg, Connect, 1, unit_mux16, 17, 0, 8);
objectCall3(unit_dec2seg, Connect, 1, unit_mux16, 17);
/*释放module接口*/
objectRelease(module_dec2seg);
/*返回unit接口*/
......@@ -116,38 +116,38 @@ static IHDL4SEUnit** hdl4seCreateCounter(IHDL4SEModule** parent, char* instancep
IHDL4SEUnit** wire_wireout_bCurrentCounter = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "wireout_bCurrentCounter");
IHDL4SEUnit** reg_bCurrentCounter = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_REG, temp, "bCurrentCounter");
/*寄存器和线网连接在一起*/
objectCall5(reg_bCurrentCounter, Connect, 0, wire_wirein_bCurrentCounter, 0, 0, width);
objectCall5(wire_wireout_bCurrentCounter, Connect, 0, reg_bCurrentCounter, 1, 0, width);
objectCall3(reg_bCurrentCounter, Connect, 0, wire_wirein_bCurrentCounter, 0);
objectCall3(wire_wireout_bCurrentCounter, Connect, 0, reg_bCurrentCounter, 1);
objectCall3(unit_counter, Connect, 2, wire_wireout_bCurrentCounter, 0);
/*定义一个寄存器来表示计数器是否溢出*/
IHDL4SEUnit** wire_wirein_wOverflow = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wirein_wOverflow");
IHDL4SEUnit** wire_wireout_wOverflow = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wireout_wOverflow");
IHDL4SEUnit** reg_wOverflow = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_REG, "1, 0", "wOverflow");
/*寄存器和线网连接在一起*/
objectCall5(reg_wOverflow, Connect, 0, wire_wirein_wOverflow, 0, 0, 1);
objectCall5(wire_wireout_wOverflow, Connect, 0, reg_wOverflow, 1, 0, 1);
objectCall5(unit_counter, Connect, 2, wire_wireout_bCurrentCounter, 0, 0, width);
objectCall5(unit_counter, Connect, 3, wire_wireout_wOverflow, 0, 0, 1);
objectCall3(reg_wOverflow, Connect, 0, wire_wirein_wOverflow, 0);
objectCall3(wire_wireout_wOverflow, Connect, 0, reg_wOverflow, 1);
objectCall3(unit_counter, Connect, 3, wire_wireout_wOverflow, 0);
sprintf(temp, "%d", width);
IHDL4SEUnit** wire_bConst_MAXVALUE = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bConst_MAXVALUE");
sprintf(temp, "%d, %d", width, maxvalue);
IHDL4SEUnit** unit_const_MAXVALUE = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_CONST, temp, "const_MAXVALUE");
objectCall5(wire_bConst_MAXVALUE, Connect, 0, unit_const_MAXVALUE, 0, 0, width);
objectCall3(wire_bConst_MAXVALUE, Connect, 0, unit_const_MAXVALUE, 0);
sprintf(temp, "%d", width);
IHDL4SEUnit** wire_bConst_RESETVALUE = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bConst_RESETVALUE");
sprintf(temp, "%d, %d", width, resetvalue);
IHDL4SEUnit** unit_const_RESETVALUE = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_CONST, temp, "const_RESETVALUE");
objectCall5(wire_bConst_RESETVALUE, Connect, 0, unit_const_RESETVALUE, 0, 0, width);
objectCall3(wire_bConst_RESETVALUE, Connect, 0, unit_const_RESETVALUE, 0);
IHDL4SEUnit** wire_wEQ_bCurrentCounter_MAXVALUE = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wEQ_bCurrentCounter_MAXVALUE");
sprintf(temp, "%d, %d, 1, %d", width, width, BINOP_EQ);
IHDL4SEUnit** unit_binop_EQ_bCurrentCounter_MAXVALUE = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_BINOP, temp, "binop_EQ_bCurrentCounter_MAXVALUE");
objectCall5(unit_binop_EQ_bCurrentCounter_MAXVALUE, Connect, 0, wire_wireout_bCurrentCounter, 0, 0, width);
objectCall5(unit_binop_EQ_bCurrentCounter_MAXVALUE, Connect, 1, wire_bConst_MAXVALUE, 0, 0, width);
objectCall5(wire_wEQ_bCurrentCounter_MAXVALUE, Connect, 0, unit_binop_EQ_bCurrentCounter_MAXVALUE, 2, 0, 1);
objectCall3(unit_binop_EQ_bCurrentCounter_MAXVALUE, Connect, 0, wire_wireout_bCurrentCounter, 0);
objectCall3(unit_binop_EQ_bCurrentCounter_MAXVALUE, Connect, 1, wire_bConst_MAXVALUE, 0);
objectCall3(wire_wEQ_bCurrentCounter_MAXVALUE, Connect, 0, unit_binop_EQ_bCurrentCounter_MAXVALUE, 2);
/* bCurrentCounter+1 用加法器实现 */
/* 常数 1 */
......@@ -155,44 +155,75 @@ static IHDL4SEUnit** hdl4seCreateCounter(IHDL4SEModule** parent, char* instancep
IHDL4SEUnit** wire_bConst_One = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bConst_One");
sprintf(temp, "%d, %d", width, 1);
IHDL4SEUnit** unit_const_One = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_CONST, temp, "const_One");
objectCall5(wire_bConst_One, Connect, 0, unit_const_One, 0, 0, width);
objectCall3(wire_bConst_One, Connect, 0, unit_const_One, 0);
/* bCurrentCounter + 1 */
sprintf(temp, "%d", width);
IHDL4SEUnit** wire_bCurrentCounterPlusOne = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bCurrentCounterPlusOne");
sprintf(temp, "%d, %d, 1, %d", width, width, BINOP_ADD);
IHDL4SEUnit** unit_binop_bCurrentCounterInc = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_BINOP, temp, "binop_bCurrentCounterInc");
objectCall5(unit_binop_bCurrentCounterInc, Connect, 0, wire_wireout_bCurrentCounter, 0, 0, width);
objectCall5(unit_binop_bCurrentCounterInc, Connect, 1, wire_bConst_One, 0, 0, width);
objectCall5(wire_bCurrentCounterPlusOne, Connect, 0, unit_binop_bCurrentCounterInc, 2, 0, width);
IHDL4SEUnit** unit_binop_bCurrentCounterPlusOne = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_BINOP, temp, "binop_bCurrentCounterInc");
objectCall3(unit_binop_bCurrentCounterPlusOne, Connect, 0, wire_wireout_bCurrentCounter, 0);
objectCall3(unit_binop_bCurrentCounterPlusOne, Connect, 1, wire_bConst_One, 0);
objectCall3(wire_bCurrentCounterPlusOne, Connect, 0, unit_binop_bCurrentCounterPlusOne, 2);
/* if语句用数据选择器实现 */
sprintf(temp, "%d", width * 2);
IHDL4SEUnit** wire_bMuxIn = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bMuxIn");
sprintf(temp, "%d, %d", width, width);
IHDL4SEUnit** unit_bind2to1 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_BINDING2TO1, temp, "bMuxIn");
objectCall5(unit_bind2to1, Connect, 0, wire_bCurrentCounterPlusOne, 0, 0, width);
objectCall5(unit_bind2to1, Connect, 1, wire_bConst_RESETVALUE, 0, 0, width);
objectCall5(wire_bMuxIn, Connect, 0, unit_bind2to1, 2, 0, width);
sprintf(temp, "%d, %d, %d", 1, 2 * width, width);
IHDL4SEUnit** unit_muxCurrentCouter = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX, temp, "muxCurrentCouter");
objectCall5(unit_muxCurrentCouter, Connect, 0, wire_wEQ_bCurrentCounter_MAXVALUE, 0, 0, 1);
objectCall5(unit_muxCurrentCouter, Connect, 1, wire_bMuxIn, 0, 0, width * 2);
objectCall5(wire_wireout_bCurrentCounter, Connect, 0, unit_muxCurrentCouter, 2, 0, width);
IHDL4SEUnit** wire_bConst_10 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "2", "bConst_10");
IHDL4SEUnit** unit_const_10 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_CONST, "2, 2", "const_10");
objectCall5(wire_bConst_10, Connect, 0, unit_const_10, 0, 0, 2);
IHDL4SEUnit** unit_muxOverflow = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX, "1,2,1", "muxOverflow");
objectCall5(unit_muxOverflow, Connect, 0, wire_wEQ_bCurrentCounter_MAXVALUE, 0, 0, 1);
objectCall5(unit_muxOverflow, Connect, 1, wire_bConst_10, 0, 0, 2);
objectCall5(wire_wirein_wOverflow, Connect, 0, unit_muxOverflow, 2, 0, 1);
sprintf(temp, "%d", width);
IHDL4SEUnit** wire_bCurrentCounter_if_wCounterIt = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bCurrentCounter_if_wCounterIt");
IHDL4SEUnit** unit_muxCurrentCouter = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX2, temp, "mux_bCurrentCounter_if_wCounterIt");
objectCall3(unit_muxCurrentCouter, Connect, 0, wire_wEQ_bCurrentCounter_MAXVALUE, 0);
objectCall3(unit_muxCurrentCouter, Connect, 1, wire_bCurrentCounterPlusOne, 0);
objectCall3(unit_muxCurrentCouter, Connect, 2, wire_bConst_RESETVALUE, 0);
objectCall3(wire_bCurrentCounter_if_wCounterIt, Connect, 0, unit_muxCurrentCouter, 3);
IHDL4SEUnit** wire_wConst_0 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wConst_0");
IHDL4SEUnit** unit_const_0 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_CONST, "1, 0", "const_0");
objectCall3(wire_wConst_0, Connect, 0, unit_const_0, 0);
IHDL4SEUnit** wire_wConst_1 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wConst_1");
IHDL4SEUnit** unit_const_1 = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_CONST, "1, 1", "const_1");
objectCall3(wire_wConst_1, Connect, 0, unit_const_1, 0);
IHDL4SEUnit** wire_wOverflow_if_wCounterIt = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wOverflow_if_wCounterIt");
IHDL4SEUnit** unit_mux_wOverflow_if_wCounterIt = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX2, "1", "mux_wOverflow_if_wCounterIt");
objectCall3(unit_mux_wOverflow_if_wCounterIt, Connect, 0, wire_wEQ_bCurrentCounter_MAXVALUE, 0);
objectCall3(unit_mux_wOverflow_if_wCounterIt, Connect, 1, wire_wConst_0, 0);
objectCall3(unit_mux_wOverflow_if_wCounterIt, Connect, 2, wire_wConst_1, 0);
objectCall3(wire_wOverflow_if_wCounterIt, Connect, 0, unit_mux_wOverflow_if_wCounterIt, 3);
sprintf(temp, "%d", width);
IHDL4SEUnit** wire_bCurrentCounter_if_nwReset = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, temp, "bCurrentCounter_if_nwReset");
IHDL4SEUnit** unit_mux_bCurrentCounter_if_nwReset = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX2, temp, "mux_bCurrentCounter_if_nwReset");
objectCall3(unit_mux_bCurrentCounter_if_nwReset, Connect, 0, module_counter, 1);
objectCall3(unit_mux_bCurrentCounter_if_nwReset, Connect, 1, wire_wireout_bCurrentCounter, 0);
objectCall3(unit_mux_bCurrentCounter_if_nwReset, Connect, 2, wire_bCurrentCounter_if_wCounterIt, 0);
objectCall3(wire_bCurrentCounter_if_nwReset, Connect, 0, unit_mux_bCurrentCounter_if_nwReset, 3);
IHDL4SEUnit** wire_wOverflow_if_nwReset = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_WIRE, "1", "wOverfloat_if_nwReset");
IHDL4SEUnit** unit_mux_wOverflow_if_nwReset = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX2, "1", "mux_wOverflow_if_nwReset");
objectCall3(unit_mux_wOverflow_if_nwReset, Connect, 0, module_counter, 1);
objectCall3(unit_mux_wOverflow_if_nwReset, Connect, 1, wire_wireout_wOverflow, 0);
objectCall3(unit_mux_wOverflow_if_nwReset, Connect, 2, wire_wOverflow_if_wCounterIt, 0);
objectCall3(wire_wOverflow_if_nwReset, Connect, 0, unit_mux_wOverflow_if_nwReset, 3);
IHDL4SEUnit** unit_mux_bCurrentCounter = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX2, temp, "mux_bCurrentCounter");
objectCall3(unit_mux_bCurrentCounter, Connect, 0, module_counter, 1);
objectCall3(unit_mux_bCurrentCounter, Connect, 1, wire_bConst_RESETVALUE, 0);
objectCall3(unit_mux_bCurrentCounter, Connect, 2, wire_bCurrentCounter_if_nwReset, 0);
objectCall3(wire_wirein_bCurrentCounter, Connect, 0, unit_mux_bCurrentCounter, 3);
IHDL4SEUnit** unit_mux_wOverflow = hdl4seCreateUnit(module_counter, CLSID_HDL4SE_MUX2, "1", "mux_wOverflow");
objectCall3(unit_mux_wOverflow, Connect, 0, module_counter, 1);
objectCall3(unit_mux_wOverflow, Connect, 1, wire_wireout_wOverflow, 0);
objectCall3(unit_mux_wOverflow, Connect, 2, wire_wOverflow_if_wCounterIt, 0);
objectCall3(wire_wirein_wOverflow, Connect, 0, unit_mux_wOverflow, 3);
/*释放module接口*/
objectRelease(module_counter);
/*返回unit接口*/
return unit_counter;
}
IHDL4SEUnit** hdl4seCreateMain(IHDL4SEModule** parent, char* instanceparam, char* name)
{ /* module main */
}
\ No newline at end of file
......@@ -33,10 +33,16 @@
#include "stdlib.h"
#include "stdio.h"
#include "object.h"
#include "hdl4secell.h"
#include "hdl4sesim.h"
#include "counter.h"
IHDL4SEModule** sim;
IHDL4SEUnit** topmodule;
int main(int argc, char* argv[])
{
printf("Hello, World!");
sim = hdl4sesimCreateSimulator();
hdl4seCreateMain(sim, "", "main");
return 0;
}
\ No newline at end of file
......@@ -211,10 +211,10 @@ module main(input wClk,
/* 以下是计数器连接 */
wire nwResetCount;
assign wCounterin0 = wCounterIt;
wire wCountin0, wCountin1, wCountin2,
wCountin3, wCountin4, wCountin5,
wCountin6, wCountin7, wCountin8,
wCountin9;
wire wCounterin0, wCounterin1, wCounterin2,
wCounterin3, wCounterin4, wCounterin5,
wCounterin6, wCounterin7, wCounterin8,
wCounterin9;
wire [3:0] bCount0, bCount1, bCount2, bCount3, bCount4,
bCount5, bCount6, bCount7, bCount8, bCount9;
counter #(4,9,0) counter0(wClk, nwCounterReset, wCounterin0, bCount0, wCounterin1);
......@@ -228,11 +228,11 @@ module main(input wClk,
counter #(4,9,0) counter8(wClk, nwCounterReset, wCounterin8, bCount8, wCounterin9);
counter #(4,9,0) counter9(wClk, nwCounterReset, wCounterin9, bCount9, .wCounterOverflow());
wire [WIDTH-1:0] wirein_wCounterIt, wireout_wCounterIt;
wire wEn_wCounterIt;
hdl4se_reg #(1, 0) wCounterIt(
wClk, nwReset, wEn_wCounterIt,
wirein_wCounterIt, wireout_wCounterIt
wire wirein_wCounterIt, wireout_wCounterIt;
hdl4se_reg #(1) wCounterIt(
wClk,
wirein_wCounterIt,
wireout_wCounterIt
);
wire wButton0NotPressed;
hdl4se_unop #(1, 1, UNOP_NOT) Button0NotPressed(wButton0Pressed, wButton0NotPressed);
......@@ -279,8 +279,8 @@ dec2seg dec9(bCount9, code9);
晚一拍出来,所以变化情况也寄存一拍。
*/
wire [2:0] wirein_bCounterChanged, wireout_bCounterChanged;
hdl4se_reg #(3, 0) wCounterIt(
wClk, nwReset,
hdl4se_reg #(3) reg_wCounterIt(
wClk,
wirein_bCounterChanged,
wireout_bCounterChanged
);
......@@ -318,35 +318,170 @@ dec2seg dec9(bCount9, code9);
.wireout3(),
);
reg wWrite;
reg [31:0] bWriteAddr;
reg [31:0] bWriteData;
reg [3:0] bWriteMask;
wWrite : ~nwReset->1'b0
nwReset
always @posedge wClk)
if (~nwReset) begin
wWrite <= 1'b0;
bWriteAddr <= 32'b0;
bWriteData <= 32'b0;
bWriteMask <= 4'b0;
end else begin
wWrite <= 1'b0;
if (bCounterChanged[2]) begin
wWrite <= 1'b1;
bWriteMask <= 4'b1100;
bWriteAddr <= 32'hf0000018;
bWriteData <= {16'b0, code9, code8};
end else if (bCounterChanged[1]) begin
wWrite <= 1'b1;
bWriteAddr <= 32'hf0000014;
bWriteData <= {code7, code6, code5, code4};
end else if (bCounterChanged[0]) begin
wWrite <= 1'b1;
bWriteAddr <= 32'hf0000010;
bWriteData <= {code3, code2, code1, code0};
end
end
wire wirein_wWrite, wireout_wWrite;
hdl4se_reg #(1) reg_wWrite(
wClk,
wirein_wWrite,
wireout_wWrite
);
wire [31:0] wirein_bWriteAddr, wireout_bWriteAddr;
hdl4se_reg #(32) reg_bWriteAddr(
wClk,
wirein_bWriteAddr,
wireout_bWriteAddr
);
wire [31:0] wirein_bWriteData, wireout_bWriteData;
hdl4se_reg #(32) reg_bWriteData(
wClk,
wirein_bWriteData,
wireout_bWriteData
);
wire [3:0] wirein_bWriteMask, wireout_bWriteMask;
hdl4se_reg #(4) reg_bWriteMask(
wClk,
wirein_bWriteMask,
wireout_bWriteMask
);
wire [3:0] b8b0;
hdl4se_const #(8, 0) const_b8b0(b8b0);
wire [3:0] b4b0000;
hdl4se_const #(4, 0) const_b4b0000(b4b0000);
wire [3:0] b4b1100;
hdl4se_const #(4, 4'b1100) const_b4b1100(b4b1100);
wire [31:0] b32b0;
hdl4se_const #(32, 0) const_b32b0(b32b0);
wire [31:0] b32hf0000018;
hdl4se_const #(32, 32'hf0000018) const_b32hf0000018(b32hf0000018);
wire [31:0] b32hf0000014;
hdl4se_const #(32, 32'hf0000014) const_b32hf0000014(b32hf0000014);
wire [31:0] b32hf0000010;
hdl4se_const #(32, 32'hf0000010) const_b32hf0000018(b32hf0000010);
wire [31:0] b0098;
wire [31:0] b7654;
wire [31:0] b3210;
hdl4se_bind4(8,8,8,8) bind_0098(code8, code9, b8b0, b8b0, b0098);
hdl4se_bind4(8,8,8,8) bind_7654(code4, code5, code6, code7, b7654);
hdl4se_bind4(8,8,8,8) bind_3210(code0, code1, code2, code3, b3210);
wire [3:0] wire_bWriteMask_if_bCounterChanged0;
hdl4se_mux2 #(4) mux_bWriteMask_if_bCounterChanged0(wCounterChanged0,
wireout_bWriteMask,
b4b0000,
wire_bWriteMask_if_bCounterChanged0
);
wire [31:0] wire_bWriteAddr_if_bCounterChanged0;
hdl4se_mux2 #(32) mux_bWriteAddr_if_bCounterChanged0(wCounterChanged0,
wireout_bWriteAddr,
b3210,
wire_bWriteAddr_if_bCounterChanged0
);
wire [31:0] wire_bWriteData_if_bCounterChanged0;
hdl4se_mux2 #(32) mux_bWriteData_if_bCounterChanged0(wCounterChanged0,
wireout_bWriteData,
b32hf0000010,
wire_bWriteData_if_bCounterChanged0
);
wire [3:0] wire_bWriteMask_if_bCounterChanged1;
hdl4se_mux2 #(4) mux_bWriteMask_if_bCounterChanged1(wCounterChanged1,
wireout_bWriteMask,
b4b0000,
wire_bWriteMask_if_bCounterChanged1
);
wire [31:0] wire_bWriteAddr_if_bCounterChanged1;
hdl4se_mux2 #(32) mux_bWriteAddr_if_bCounterChanged1(wCounterChanged1,
wireout_bWriteAddr,
b3210,
wire_bWriteAddr_if_bCounterChanged1
);
wire [31:0] wire_bWriteData_if_bCounterChanged1;
hdl4se_mux2 #(32) mux_bWriteData_if_bCounterChanged1(wCounterChanged1,
wireout_bWriteData,
b32hf0000010,
wire_bWriteData_if_bCounterChanged1
);
wire [3:0] wire_bWriteMask_if_bCounterChanged2;
hdl4se_mux2 #(4) mux_bWriteMask_if_bCounterChanged2(wCounterChanged2,
wireout_bWriteMask,
b4b0000,
wire_bWriteMask_if_bCounterChanged2
);
wire [31:0] wire_bWriteAddr_if_bCounterChanged2;
hdl4se_mux2 #(32) mux_bWriteAddr_if_bCounterChanged1(wCounterChanged2,
wireout_bWriteAddr,
b3210,
wire_bWriteAddr_if_bCounterChanged2
);
wire [31:0] wire_bWriteData_if_bCounterChanged2;
hdl4se_mux2 #(32) mux_bWriteData_if_bCounterChanged2(wCounterChanged2,
wireout_bWriteData,
b32hf0000010,
wire_bWriteData_if_bCounterChanged2
);
wire [3:0] wire_bWriteMask_if_nwReset;
hdl4se_mux2 #(4) mux_bWriteMask_if_nwReset(nwReset,
wireout_bWriteMask,
b4b0000,
wire_bWriteMask_if_nwReset
);
wire [31:0] wire_bWriteAddr_if_nwReset;
hdl4se_mux2 #(32) mux_bWriteAddr_if_nwReset(nwReset,
wireout_bWriteAddr,
b3210,
wire_bWriteAddr_if_nwReset
);
wire [31:0] wire_bWriteData_if_nwReset;
hdl4se_mux2 #(32) mux_bWriteData_if_nwReset(nwReset,
wireout_bWriteData,
b32hf0000010,
wire_bWriteData_if_nwReset
);
hdl4se_mux2 #(4) mux_bWriteMask_if_nwReset(nwReset,
wireout_bWriteMask,
b4b0000,
wire_bWriteMask_if_nwReset
);
hdl4se_mux2 #(32) mux_bWriteAddr_if_nwReset(nwReset,
wireout_bWriteAddr,
b3210,
wire_bWriteAddr_if_nwReset
);
hdl4se_mux2 #(32) mux_bWriteData_if_nwReset(nwReset,
wireout_bWriteData,
b32hf0000010,
wire_bWriteData_if_nwReset
);
/*
wWrite <= nwReset & (bCounterChanged[0] | bCounterChanged[1] | bCounterChanged[2])
nwReset==0 ::
bWriteMask <= 4'b0000; bWriteAddr <= 32'b0; bWriteData <= 32'b0;
nwReset & bCounterChanged[2] :
bWriteMask <= 4'b1100; bWriteAddr <= 32'hf0000018; bWriteData <= {16'b0, code9, code8};
nwReset & ~bCounterChanged[2] & bCounterChanged[1]:
bWriteMask <= 4'b0000; bWriteAddr <= 32'hf0000014; bWriteData <= {code7, code6, code5, code4};
nwReset & ~bCounterChanged[2] & ~bCounterChanged[1] & bCounterChanged[0]:
bWriteMask <= 4'b0000; bWriteAddr <= 32'hf0000010; bWriteData <= {code3, code2, code1, code0};
nwReset & ~bCounterChanged[2] & ~bCounterChanged[1] & ~bCounterChanged[0]
bWriteMask <= bWriteMask; bWriteAddr <= bWriteAddr; bWriteData <= bWriteData;
*/
endmodule
......@@ -52,7 +52,7 @@ DEFINE_GUID(IID_HDL4SEUNIT, 0x57521e7a, 0xfdc5, 0x4682, 0x94, 0xc8, 0x8d, 0x2d,
typedef struct sIHDL4SEUnit {
OBJECT_INTERFACE
int (*Connect)(HOBJECT object, int index, HOBJECT from, int fromindex, int width);
int (*Connect)(HOBJECT object, int index, HOBJECT from, int fromindex);
int (*GetValue)(HOBJECT object, int index, int width, HDL4SEUINT32* value);
}IHDL4SEUnit;
......@@ -60,7 +60,7 @@ typedef struct sIHDL4SEUnit {
#define HDL4SEUNIT_VARINIT(_objptr, _sid)
#define HDL4SEUNIT_FUNCDECLARE(_obj, _clsid, _localstruct) \
static int _obj##_hdl4se_unit_Connect(HOBJECT object, int index, HOBJECT from, int fromindex, int width); \
static int _obj##_hdl4se_unit_Connect(HOBJECT object, int index, HOBJECT from, int fromindex); \
static int _obj##_hdl4se_unit_GetValue(HOBJECT object, int index, int width, HDL4SEUINT32 *value); \
static const IHDL4SEUnit _obj##_hdl4se_unit_interface = { \
INTERFACE_HEADER(_obj, IHDL4SEUnit, _localstruct) \
......
......@@ -33,4 +33,6 @@
* hdl4sesim.h
修改记录:
202105180851: rxh, initial version
*/
\ No newline at end of file
*/
IHDL4SEModule** hdl4sesimCreateSimulator();
\ No newline at end of file
......@@ -33,4 +33,14 @@
* hdl4sesim.c
修改记录:
202105180851: rxh, initial version
*/
\ No newline at end of file
*/
#include "stdlib.h"
#include "stdio.h"
#include "object.h"
#include "hdl4secell.h"
#include "hdl4sesim.h"
IHDL4SEModule** hdl4sesimCreateSimulator()
{
return NULL;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册